Skip to content

Commit

Permalink
Merge branch 'output_parser_main_only'
Browse files Browse the repository at this point in the history
  • Loading branch information
sshaw committed Mar 8, 2015
2 parents d49481c + 19ff5b6 commit 4df92bf
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 22 deletions.
15 changes: 12 additions & 3 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
v0.1.2 2015-03-07
--------------------
Changes:
* Only parse errors from the main iTMSTransporter thread

Enhancements:
* Look for the iTMSTransporter at known locations on OS X
* Add the :streams (-numStreams) option to upload

v0.1.1 2013-08-14
--------------------
Changes:
* Added post_install_message letting Windows users know they need to modify iTMSTransporter.CMD
Changes:
* Added post_install_message letting Windows users know they need to modify iTMSTransporter.CMD
* Transporter is now a module, new() returns an instance of ITMSTransporter

Bug fixes:
Expand All @@ -22,7 +31,7 @@ Enhancements:
* `itms` added --no-config option
* `itms` allow boolean options to be set to false via --no-XXXX, e.g., --no-print-stderr

Bug Fixes:
Bug Fixes:
* `itms status` passed the wrong arguments to the underlying method
* `itms` failed when the config file was empty
* Verify command :verify_assets => true would disable asset verification
Expand Down
4 changes: 2 additions & 2 deletions lib/itunes/store/transporter/output_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class OutputParser
attr :errors
attr :warnings

ERROR_LINE = />\s+ERROR:\s+(.+)/
WARNING_LINE = />\s+WARN:\s+(.+)/
ERROR_LINE = /<main>\s+ERROR:\s+(.+)/
WARNING_LINE = /<main>\s+WARN:\s+(.+)/

# Generic messages we want to ignore.
SKIP_ERRORS = [ /\boperation was not successful/i,
Expand Down
2 changes: 1 addition & 1 deletion lib/itunes/store/transporter/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ITunes
module Store
module Transporter
VERSION = "0.1.1"
VERSION = "0.1.2"
end
end
end
17 changes: 15 additions & 2 deletions spec/fixtures/errors_and_warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ no_error_number: |
[2000-01-01 00:00:00] <main> INFO: Transporter is doing something fun
[2000-01-01 00:00:00] <main> INFO: Transporter is still doing some fun stuff
[2000-01-01 00:00:00] <main> ERROR: "An error occurred while doing fun stuff" at Location1 (Class)
[2000-01-01 00:00:00] <Some Class> ERROR: "An exception has occurred: network timeout" at Location2 (Class)
[2000-01-01 00:00:00] <main> ERROR: "An exception has occurred: network timeout" at Location2 (Class)
[2000-01-01 00:00:00] <main> DBG-X: About to exit
Package Summary:
Expand All @@ -26,7 +26,7 @@ with_error_number: |
ERROR ITMS-4000 "This is error 4000"
ERROR ITMS-5000 "This is error 5000"
single_warning: |
single_warning: |
[2000-01-01 00:00:00] <main> INFO: Transporter is doing something fun
[2000-01-01 00:00:00] <main> WARN: WARNING ITMS-4010: "You've been warned!" at Location1 (Class)
[2000-01-01 00:00:00] <main> INFO: I'm outta here
Expand All @@ -43,3 +43,16 @@ duplicate_errors: |
[2000-01-01 00:00:00] <main> INFO: Transporter is doing something fun
[2000-01-01 00:00:00] <main> ERROR: ERROR ITMS-7000: "Error 3" at Location3 (ClassX)
[2000-01-01 00:00:00] <main> INFO: I'm outta here
error_from_main_and_class: |
[2000-01-01 00:00:00] <main> INFO: Transporter is doing something fun
[2000-01-01 00:00:00] <main> INFO: Transporter is still doing some fun stuff
[2000-01-01 00:00:00] <in.some.Class> ERROR: "An exception has occurred in.some.Class: network timeout"
[2000-01-01 00:00:00] <main> INFO: Transporter is still doing some fun stuff
[2000-01-01 00:00:00] <main> ERROR: Another error has occurred
[2000-01-01 00:00:00] <main> DBG-X: About to exit
Package Summary:
1 package was uploaded successfully:
/home/sshaw/123123123.itmsp
38 changes: 24 additions & 14 deletions spec/output_parser_spec.rb
Original file line number Diff line number Diff line change
@@ -1,68 +1,78 @@
require "spec_helper"

describe ITunes::Store::Transporter::OutputParser do
describe "parsing errors" do
describe "parsing errors" do
# TODO: test various error message/code formats handled by the parser

context "without an error code" do
context "without an error code" do
before(:all) { @parser = described_class.new(fixture("errors_and_warnings.no_error_number")) }

subject { @parser }
its(:warnings) { should be_empty }
its(:errors) { should have(2).items }

describe "the first error" do
describe "the first error" do
subject { @parser.errors.first }
its(:code) { should be_nil }
its(:message) { should == "An error occurred while doing fun stuff" }
end

describe "the second error" do
describe "the second error" do
subject { @parser.errors.last }
its(:code) { should be_nil }
its(:message) { should == "An exception has occurred: network timeout" }
end
end

context "with an error code" do
context "with errors from main and from a class" do
before(:all) { @parser = described_class.new(fixture("errors_and_warnings.error_from_main_and_class")) }
subject { @parser }

it "only parses the error from main" do
expect(@parser.errors.size).to eq 1
expect(@parser.errors.first.message).to eq "Another error has occurred"
end
end

context "with an error code" do
before(:all) { @parser = described_class.new(fixture("errors_and_warnings.with_error_number")) }

subject { @parser }
its(:warnings) { should be_empty }
its(:errors) { should have(2).items }


describe "the first error" do

describe "the first error" do
subject { @parser.errors.first }
its(:code) { should == 4000 }
its(:message) { should == "This is error 4000" }
end

describe "the second error" do
describe "the second error" do
subject { @parser.errors.last }
its(:code) { should == 5000 }
its(:message) { should == "This is error 5000" }
end
end

context "with duplicate messages" do
context "with duplicate messages" do
before(:all) { @parser = described_class.new(fixture("errors_and_warnings.duplicate_errors")) }
it "does not include duplicates" do

it "does not include duplicates" do
errors = @parser.errors.map { |e| e.message }
errors.should == ["Error 1", "Error 2", "Error 3"]
end
end
end

describe "parsing warnings" do
describe "parsing warnings" do
before(:all) { @parser = described_class.new(fixture("errors_and_warnings.single_warning")) }

subject { @parser }
its(:errors) { should be_empty }
its(:warnings) { should have(1).item }

describe "the warning" do
describe "the warning" do
subject { @parser.warnings.first }
its(:code) { should == 4010 }
its(:message) { should == "You've been warned!" }
Expand Down

0 comments on commit 4df92bf

Please sign in to comment.