itunes_store_transporter 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Changes +10 -0
- data/README.rdoc +16 -27
- data/bin/itms +2 -1
- data/lib/itunes/store/transporter/command/lookup.rb +4 -1
- data/lib/itunes/store/transporter/command/option.rb +1 -0
- data/lib/itunes/store/transporter/command/schema.rb +3 -0
- data/lib/itunes/store/transporter/command/status.rb +2 -0
- data/lib/itunes/store/transporter/command/upload.rb +2 -0
- data/lib/itunes/store/transporter/command/verify.rb +2 -0
- data/lib/itunes/store/transporter/command.rb +0 -1
- data/lib/itunes/store/transporter/itms_transporter.rb +2 -1
- data/lib/itunes/store/transporter/version.rb +1 -1
- data/lib/itunes/store/transporter.rb +1 -1
- data/spec/command_spec.rb +33 -21
- data/spec/errors_spec.rb +34 -23
- data/spec/output_parser_spec.rb +31 -11
- data/spec/spec_helper.rb +2 -2
- data/spec/transporter_spec.rb +5 -5
- metadata +57 -40
- data/spec/xml_status_spec.rb~ +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: aa59be438d80fefc468734ca36a70e1a52dd085e29688b356b2a4083d709b9ac
|
|
4
|
+
data.tar.gz: 900733939f310a8bcbecd808586c5d1103fc794350d8aad3bee9c99dbef14193
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: caee4e939c3ae0f697862a64d045d3c2b27ce0da7d354f2afcad8ecd3d123a44aaa8b018a9abdeff05b43ba3c927ebaf299fc58030dfa8e11e3ee9b2594f1456
|
|
7
|
+
data.tar.gz: 51e3a73d953bf730ba9a5bf0f06ab2e1c055bdd63cf0def61e9b66e5ab998d4840ed6f238d61c11f1c043bf64dea8dfbd43c09bca716713891364a87481e0b5d
|
data/Changes
CHANGED
data/README.rdoc
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
= iTunes::Store::Transporter
|
|
2
2
|
|
|
3
|
-
{<img src="https://
|
|
3
|
+
{<img src="https://github.com/sshaw/itunes_store_transporter/actions/workflows/ci.yml/badge.svg"/>}[https://github.com/sshaw/itunes_store_transporter/actions/workflows/ci.yml]
|
|
4
4
|
{<img src="https://ci.appveyor.com/api/projects/status/k6w6ob5f7s9j8pv8?svg=true"/>}[https://ci.appveyor.com/project/sshaw/itunes-store-transporter]
|
|
5
5
|
{<img src="https://codeclimate.com/github/sshaw/itunes_store_transporter.svg" />}[https://codeclimate.com/github/sshaw/itunes_store_transporter]
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ Upload and manage your assets in the iTunes Store using the iTunes Store's Trans
|
|
|
11
11
|
require "itunes/store/transporter"
|
|
12
12
|
|
|
13
13
|
itms = iTunes::Store::Transporter.new(:username => "SomeUser",
|
|
14
|
-
:shortname => "shrt",
|
|
14
|
+
:shortname => "shrt", # or :itc_provider, if you have no shortname
|
|
15
15
|
:password => "w3c@llYoU!")
|
|
16
16
|
|
|
17
17
|
itms.upload("/path/to/yourpackage.itmsp")
|
|
@@ -46,39 +46,24 @@ that it can send email notifications and allows one to set global/per-command de
|
|
|
46
46
|
=== Requirements
|
|
47
47
|
|
|
48
48
|
* Optout (<code>gem install optout</code>)
|
|
49
|
-
* iTunes Store Transporter (
|
|
49
|
+
* iTunes Store Transporter (https://help.apple.com/itc/transporteruserguide/)
|
|
50
50
|
|
|
51
|
-
===
|
|
52
|
-
|
|
53
|
-
If the +iTMSTransporter+ cannot be found in {one your platform's known locations}[https://github.com/sshaw/itunes_store_transporter/tree/master/lib/itunes/store/transporter/shell.rb#L28-L40] you must specify it when creating an instance of <code>iTunes::Store::Transporter</code> via {the <code>:path</code> option}[http://ruby-doc.org/gems/docs/i/itunes_store_transporter-0.1.1/ITunes/Store/Transporter/ITMSTransporter.html#method-c-new-label-Options].
|
|
54
|
-
|
|
55
|
-
If you're using the bundled +itms+ command you must use its +--path+ option or specify the path in the itms config file. See the +itms+ section for more info.
|
|
56
|
-
|
|
57
|
-
=== Running on Windows
|
|
58
|
-
|
|
59
|
-
On Windows +iTMSTransporter+ is called via the +iTMSTransporter.CMD+ batch file. This file does not handle the
|
|
60
|
-
+iTMSTransporter+'s exit status correctly, causing <code>iTunes::Store::Transporter</code> to report everything as a success.
|
|
51
|
+
=== Installation
|
|
61
52
|
|
|
62
|
-
|
|
53
|
+
Add `gem "itunes_store_transporter"` to your Ruby project's Gemfile to use as a library, or run `gem install itunes_store_transporter` to install system-wide for CLI usage.
|
|
63
54
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
call iTMSTransporter\iTMSTransporter %*
|
|
67
|
-
|
|
68
|
-
REM Add this line:
|
|
69
|
-
set exited=%errorlevel%
|
|
55
|
+
=== Locating iTMSTransporter
|
|
70
56
|
|
|
71
|
-
|
|
57
|
+
If the +iTMSTransporter+ cannot be found in {one your platform's known locations}[https://github.com/sshaw/itunes_store_transporter/blob/fcb4f0f9ada4a45764160beac6a049b0d419c8a9/lib/itunes/store/transporter/shell.rb#L31] you must specify it when creating an instance of <code>iTunes::Store::Transporter</code> via {the <code>:path</code> option}[http://www.rubydoc.info/gems/itunes_store_transporter/ITunes/Store/Transporter/ITMSTransporter#initialize-instance_method].
|
|
72
58
|
|
|
73
|
-
|
|
74
|
-
exit /b %exited%
|
|
59
|
+
If you're using the bundled +itms+ command you must use its +--path+ option or specify the path in the itms config file. See the +itms+ section for more info.
|
|
75
60
|
|
|
76
61
|
=== Using itms
|
|
77
62
|
|
|
78
63
|
<code>itms COMMAND [OPTIONS] [PACKAGE]</code>
|
|
79
64
|
|
|
80
|
-
* +COMMAND+ - The command to run, which can be any one of {the <code>iTunes::Store::Transporter</code> methods}[http://
|
|
81
|
-
* +OPTIONS+ - These are quivalent to the given +COMMAND+'s options except they must be given in a strict long option format. For example <code>:apple_id => "X123"</code> would be <code>--apple-id=X123</code>. Boolean options can be negated with the <code>--no-</code> prefix. For more info see {each command's options}[http://
|
|
65
|
+
* +COMMAND+ - The command to run, which can be any one of {the <code>iTunes::Store::Transporter</code> methods}[http://sshaw.github.io/itunes_store_transporter/classes/ITunes/Store/Transporter/ITMSTransporter.html]
|
|
66
|
+
* +OPTIONS+ - These are quivalent to the given +COMMAND+'s options except they must be given in a strict long option format. For example <code>:apple_id => "X123"</code> would be <code>--apple-id=X123</code>. Boolean options can be negated with the <code>--no-</code> prefix. For more info see {each command's options}[http://sshaw.github.io/itunes_store_transporter/classes/ITunes/Store/Transporter/ITMSTransporter.html].
|
|
82
67
|
* +PACKAGE+ - The package or directory to operate on, if required by the command
|
|
83
68
|
|
|
84
69
|
<b>Note that options with a value must contain the equals character</b> (<code>"="</code>).
|
|
@@ -166,10 +151,10 @@ As you can see, command options are turned into template variables.
|
|
|
166
151
|
|
|
167
152
|
=== More Info
|
|
168
153
|
|
|
169
|
-
* Docs: http://
|
|
154
|
+
* Docs: http://sshaw.github.io/itunes_store_transporter
|
|
170
155
|
* Bugs: http://github.com/sshaw/itunes_store_transporter/issues
|
|
171
156
|
* Source Code: http://github.com/sshaw/itunes_store_transporter
|
|
172
|
-
* Transporter GUI: http://
|
|
157
|
+
* iTunes Store Transporter: GUI: http://transportergui.com
|
|
173
158
|
|
|
174
159
|
=== Author
|
|
175
160
|
|
|
@@ -178,3 +163,7 @@ Skye Shaw [skye.shaw AT gmail.com]
|
|
|
178
163
|
=== License
|
|
179
164
|
|
|
180
165
|
Released under the MIT License: http://www.opensource.org/licenses/MIT
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
Made by {ScreenStaring}[http://screenstaring.com]
|
data/bin/itms
CHANGED
|
@@ -258,7 +258,8 @@ def load_config(command)
|
|
|
258
258
|
path = File.join(home, CONFIG_FILE_NAME)
|
|
259
259
|
return {} unless File.file?(path)
|
|
260
260
|
|
|
261
|
-
|
|
261
|
+
# Psych 4+ (Ruby 3.1+, which introduced unsafe_load_file) disables YAML aliases by default
|
|
262
|
+
config = YAML.respond_to?(:unsafe_load_file) ? YAML.load_file(path, :aliases => true) : YAML.load_file(path)
|
|
262
263
|
return {} unless config
|
|
263
264
|
|
|
264
265
|
# Get the global defaults. select() returns an aray on Ruby < 1.9
|
|
@@ -14,6 +14,9 @@ module ITunes
|
|
|
14
14
|
class Lookup < Mode
|
|
15
15
|
def initialize(*config)
|
|
16
16
|
super
|
|
17
|
+
options.on *SHORTNAME
|
|
18
|
+
options.on *ITC_PROVIDER
|
|
19
|
+
|
|
17
20
|
# These 2 are mutually exclusive, and one is required.
|
|
18
21
|
# Optout has no way to denote this
|
|
19
22
|
options.on *VENDOR_ID
|
|
@@ -34,7 +37,7 @@ module ITunes
|
|
|
34
37
|
id = options[:apple_id] || options[:vendor_id]
|
|
35
38
|
path = File.join(options[:destination], "#{id}.itmsp", "metadata.xml")
|
|
36
39
|
|
|
37
|
-
if !File.
|
|
40
|
+
if !File.exist?(path)
|
|
38
41
|
raise TransporterError, "No metadata file exists at #{path}"
|
|
39
42
|
end
|
|
40
43
|
|
|
@@ -9,6 +9,7 @@ module ITunes
|
|
|
9
9
|
VENDOR_ID = [ :vendor_id, "-vendor_id", /\w/ ]
|
|
10
10
|
APPLE_ID = [ :apple_id, "-apple_id", /\w/ ]
|
|
11
11
|
SHORTNAME = [ :shortname, "-s", /\w/ ]
|
|
12
|
+
ITC_PROVIDER= [ :itc_provider, "-itc_provider", /\w/ ]
|
|
12
13
|
TRANSPORT = [ :transport, "-t", %w|Aspera Signiant DAV| ]
|
|
13
14
|
SUCCESS = [ :success, "-success", Optout::Dir.exists ]
|
|
14
15
|
FAILURE = [ :failure, "-failure", Optout::Dir.exists ]
|
|
@@ -12,6 +12,9 @@ module ITunes
|
|
|
12
12
|
class Schema < Mode
|
|
13
13
|
def initialize(*config)
|
|
14
14
|
super
|
|
15
|
+
options.on *SHORTNAME
|
|
16
|
+
options.on *ITC_PROVIDER
|
|
17
|
+
|
|
15
18
|
options.on *DESTINATION
|
|
16
19
|
options.on :type, "-schemaType", /\A(transitional|strict)\z/i, :required => true
|
|
17
20
|
options.on :version, "-schema", /\w+/i, :required => true
|
|
@@ -12,6 +12,8 @@ module ITunes
|
|
|
12
12
|
class Status < Mode
|
|
13
13
|
def initialize(*config)
|
|
14
14
|
super
|
|
15
|
+
options.on *SHORTNAME
|
|
16
|
+
options.on *ITC_PROVIDER
|
|
15
17
|
options.on :vendor_id, "-vendor_ids", /\w/, :multiple => true
|
|
16
18
|
options.on :apple_id, "-apple_ids", /\w/, :multiple => true
|
|
17
19
|
options.on :format, "-outputFormat", %w[xml]
|
|
@@ -15,6 +15,8 @@ module ITunes
|
|
|
15
15
|
options.on *TRANSPORT
|
|
16
16
|
options.on *SUCCESS
|
|
17
17
|
options.on *FAILURE
|
|
18
|
+
options.on *SHORTNAME
|
|
19
|
+
options.on *ITC_PROVIDER
|
|
18
20
|
options.on :delete, "-delete", Optout::Boolean
|
|
19
21
|
options.on :rate, "-k", Integer # Required if TRANSPORT is Aspera or Signiant
|
|
20
22
|
options.on :streams, "-numStreams", Integer # Only valid if TRANSPORT is Signiant
|
|
@@ -18,7 +18,8 @@ module ITunes
|
|
|
18
18
|
#
|
|
19
19
|
# [:username (String)] Your username
|
|
20
20
|
# [:password (String)] Your password
|
|
21
|
-
# [:shortname (String)] Your shortname. Optional, not every iTunes account has one
|
|
21
|
+
# [:shortname (String)] Your shortname (encoding house user). Optional, not every iTunes account has one
|
|
22
|
+
# [:itc_provider (String)] Your iTunes Connect user. Optional, not every iTunes account has one
|
|
22
23
|
# [:path (String)] The path to the +iTMSTransporter+. Optional.
|
|
23
24
|
# [:print_stdout (Boolean)] Print +iTMSTransporter+'s stdout to your stdout. Defaults to +false+.
|
|
24
25
|
# [:print_stderr (Boolean)] Print +iTMSTransporter+'s stderr to your stderr. Defaults to +false+.
|
data/spec/command_spec.rb
CHANGED
|
@@ -19,7 +19,7 @@ shared_examples_for "a transporter option that expects a directory" do |option,
|
|
|
19
19
|
|
|
20
20
|
context "when the directory does not exist" do
|
|
21
21
|
it "raises an OptionError" do
|
|
22
|
-
|
|
22
|
+
expect { subject.run(options.merge(option => "__baaaaahd_directory__")) }.to raise_exception(ITunes::Store::Transporter::OptionError, /does not exist/)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -34,7 +34,7 @@ shared_examples_for "a boolean transporter option" do |option, expected|
|
|
|
34
34
|
|
|
35
35
|
context "when false" do
|
|
36
36
|
it "does not create the command line argument" do
|
|
37
|
-
ITunes::Store::Transporter::Shell.
|
|
37
|
+
allow_any_instance_of(ITunes::Store::Transporter::Shell).to receive(:exec) { |_instance, *arg| expect(arg.first).not_to include(*expected); 0 }
|
|
38
38
|
subject.run(options.merge(option => false))
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -54,7 +54,13 @@ shared_examples_for "a required option" do |option|
|
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
shared_examples_for "a command that accepts an itc_provider argument" do
|
|
58
|
+
it_should_behave_like "a transporter option", { :itc_provider => "sshaw" }, "-itc_provider", "sshaw"
|
|
59
|
+
end
|
|
60
|
+
|
|
57
61
|
shared_examples_for "a command that accepts a shortname argument" do
|
|
62
|
+
it_should_behave_like "a transporter option", { :shortname => "sshaw" }, "-s", "sshaw"
|
|
63
|
+
|
|
58
64
|
context "when the shortname's invalid" do
|
|
59
65
|
it "raises an OptionError" do
|
|
60
66
|
expect { subject.run(options.merge(:shortname => "+")) }.to raise_exception(ITunes::Store::Transporter::OptionError, /shortname/)
|
|
@@ -77,7 +83,7 @@ shared_examples_for "a subclass of Command::Base" do
|
|
|
77
83
|
ENV["PROGRAMFILES"] = "C:\\"
|
|
78
84
|
shell = ITunes::Store::Transporter::Shell
|
|
79
85
|
expect_shell_args("-WONoPause", "true")
|
|
80
|
-
shell.
|
|
86
|
+
allow(shell).to receive(:windows?).and_return(true)
|
|
81
87
|
subject.run(options)
|
|
82
88
|
end
|
|
83
89
|
end
|
|
@@ -97,7 +103,7 @@ shared_examples_for "a subclass of Command::Base" do
|
|
|
97
103
|
let(:print?) { true }
|
|
98
104
|
|
|
99
105
|
it "prints to stderr" do
|
|
100
|
-
$stderr.string.chomp.
|
|
106
|
+
expect($stderr.string.chomp).to eq "ERR 1"
|
|
101
107
|
end
|
|
102
108
|
end
|
|
103
109
|
|
|
@@ -125,7 +131,7 @@ shared_examples_for "a subclass of Command::Base" do
|
|
|
125
131
|
let(:print?) { true }
|
|
126
132
|
|
|
127
133
|
it "prints to stdout" do
|
|
128
|
-
$stdout.string.chomp.
|
|
134
|
+
expect($stdout.string.chomp).to eq "OUT 1"
|
|
129
135
|
end
|
|
130
136
|
end
|
|
131
137
|
|
|
@@ -142,8 +148,8 @@ shared_examples_for "a subclass of Command::Base" do
|
|
|
142
148
|
context "when successful" do
|
|
143
149
|
it "calls #handle_success" do
|
|
144
150
|
mock_output(:exit => 0)
|
|
145
|
-
subject.
|
|
146
|
-
subject.
|
|
151
|
+
expect(subject).to receive(:handle_success)
|
|
152
|
+
expect(subject).not_to receive(:handle_error)
|
|
147
153
|
subject.run(options)
|
|
148
154
|
end
|
|
149
155
|
end
|
|
@@ -151,15 +157,15 @@ shared_examples_for "a subclass of Command::Base" do
|
|
|
151
157
|
context "when not successful" do
|
|
152
158
|
it "calls #handler_error" do
|
|
153
159
|
mock_output(:exit => 1)
|
|
154
|
-
subject.
|
|
155
|
-
subject.
|
|
160
|
+
expect(subject).to receive(:handle_error)
|
|
161
|
+
expect(subject).not_to receive(:handle_success)
|
|
156
162
|
subject.run(options)
|
|
157
163
|
end
|
|
158
164
|
|
|
159
165
|
context "when an error is output to stderr" do
|
|
160
166
|
it "raises an ExecutionError" do
|
|
161
167
|
mock_output(:exit => 1, :stderr => "stderr.errors")
|
|
162
|
-
|
|
168
|
+
expect { subject.run(options) }.to raise_error { |e|
|
|
163
169
|
expect(e).to be_a(ITunes::Store::Transporter::ExecutionError)
|
|
164
170
|
|
|
165
171
|
expect(e.exitstatus).to eq 1
|
|
@@ -259,7 +265,7 @@ shared_examples_for "a command that requires a package argument" do
|
|
|
259
265
|
path = Tempfile.new("").path
|
|
260
266
|
options = create_options(:package => path)
|
|
261
267
|
# TODO: Optout's error message will probably be changed to something more descriptive, change this when that happens
|
|
262
|
-
|
|
268
|
+
expect { subject.run(options) }.to raise_error(ITunes::Store::Transporter::OptionError, /dir/i)
|
|
263
269
|
end
|
|
264
270
|
end
|
|
265
271
|
end
|
|
@@ -288,6 +294,7 @@ describe ITunes::Store::Transporter::Command::Upload do
|
|
|
288
294
|
it_behaves_like "a transporter mode"
|
|
289
295
|
it_behaves_like "a command that requires a package argument"
|
|
290
296
|
it_behaves_like "a command that accepts a shortname argument"
|
|
297
|
+
it_behaves_like "a command that accepts an itc_provider argument"
|
|
291
298
|
|
|
292
299
|
subject { described_class.new({}) }
|
|
293
300
|
let(:options) { create_options(:package => create_package, :transport => "Aspera") }
|
|
@@ -348,6 +355,7 @@ end
|
|
|
348
355
|
describe ITunes::Store::Transporter::Command::Lookup do
|
|
349
356
|
it_behaves_like "a transporter mode"
|
|
350
357
|
it_behaves_like "a command that accepts a shortname argument"
|
|
358
|
+
it_behaves_like "a command that accepts an itc_provider argument"
|
|
351
359
|
|
|
352
360
|
subject { described_class.new({}) }
|
|
353
361
|
|
|
@@ -356,7 +364,7 @@ describe ITunes::Store::Transporter::Command::Lookup do
|
|
|
356
364
|
# Fake the directory iTMSTransporter creates for the metadata
|
|
357
365
|
before(:each) do
|
|
358
366
|
@tmpdir = Dir.mktmpdir
|
|
359
|
-
Dir.
|
|
367
|
+
allow(Dir).to receive(:mktmpdir).and_return(@tmpdir)
|
|
360
368
|
|
|
361
369
|
id = options[:vendor_id] || options[:apple_id]
|
|
362
370
|
@package = File.join(@tmpdir, "#{id}.itmsp")
|
|
@@ -379,14 +387,14 @@ describe ITunes::Store::Transporter::Command::Lookup do
|
|
|
379
387
|
context "when successful" do
|
|
380
388
|
it "returns the metadata and deletes the temp directory used to output the metadata" do
|
|
381
389
|
expect(subject.run(options)).to eq @metadata
|
|
382
|
-
expect(File.
|
|
390
|
+
expect(File.exist?(@tmpdir)).to be false
|
|
383
391
|
end
|
|
384
392
|
|
|
385
393
|
context "when the metadata file was not created" do
|
|
386
394
|
before { FileUtils.rm_rf(@tmpdir) }
|
|
387
395
|
|
|
388
396
|
it "raises a TransporterError" do
|
|
389
|
-
|
|
397
|
+
expect { subject.run(options) }.to raise_exception(ITunes::Store::Transporter::TransporterError, /no metadata file/i)
|
|
390
398
|
end
|
|
391
399
|
end
|
|
392
400
|
end
|
|
@@ -409,6 +417,7 @@ end
|
|
|
409
417
|
describe ITunes::Store::Transporter::Command::Schema do
|
|
410
418
|
it_behaves_like "a transporter mode"
|
|
411
419
|
it_behaves_like "a command that accepts a shortname argument"
|
|
420
|
+
it_behaves_like "a command that accepts an itc_provider argument"
|
|
412
421
|
|
|
413
422
|
subject { described_class.new({}) }
|
|
414
423
|
let(:options) { create_options(:type => "strict", :version => "film5") }
|
|
@@ -422,7 +431,7 @@ describe ITunes::Store::Transporter::Command::Schema do
|
|
|
422
431
|
context "when successful" do
|
|
423
432
|
it "returns the requested schema" do
|
|
424
433
|
mock_output(:stdout => [ "<x>Film Schema</x>" ], :stderr => "stderr.info")
|
|
425
|
-
subject.run(options).
|
|
434
|
+
expect(subject.run(options)).to eq "<x>Film Schema</x>"
|
|
426
435
|
end
|
|
427
436
|
end
|
|
428
437
|
end
|
|
@@ -458,6 +467,8 @@ end
|
|
|
458
467
|
describe ITunes::Store::Transporter::Command::Status do
|
|
459
468
|
# Ugh, issue with stubbed print_stdout test, we need XML here :(
|
|
460
469
|
#it_behaves_like "a transporter mode"
|
|
470
|
+
it_behaves_like "a command that accepts a shortname argument"
|
|
471
|
+
it_behaves_like "a command that accepts an itc_provider argument"
|
|
461
472
|
|
|
462
473
|
subject { described_class.new({}) }
|
|
463
474
|
let(:options) { create_options(:vendor_id => 123123) }
|
|
@@ -578,6 +589,7 @@ describe ITunes::Store::Transporter::Command::Verify do
|
|
|
578
589
|
it_behaves_like "a transporter mode"
|
|
579
590
|
it_behaves_like "a command that requires a package argument"
|
|
580
591
|
it_behaves_like "a command that accepts a shortname argument"
|
|
592
|
+
it_behaves_like "a command that accepts an itc_provider argument"
|
|
581
593
|
|
|
582
594
|
subject { described_class.new({}) }
|
|
583
595
|
let(:options) { create_options(:package => create_package) }
|
|
@@ -610,7 +622,7 @@ describe ITunes::Store::Transporter::Command::Verify do
|
|
|
610
622
|
describe ":verify_assets" do
|
|
611
623
|
context "when true" do
|
|
612
624
|
it "does not create the command line argument" do
|
|
613
|
-
ITunes::Store::Transporter::Shell.
|
|
625
|
+
allow_any_instance_of(ITunes::Store::Transporter::Shell).to receive(:exec) { |_instance, *arg| expect(arg.first).not_to include("-disableAssetVerification"); 0 }
|
|
614
626
|
subject.run(options.merge(:verify_assets => true))
|
|
615
627
|
end
|
|
616
628
|
end
|
|
@@ -636,35 +648,35 @@ describe ITunes::Store::Transporter::Command::Version do
|
|
|
636
648
|
context "when the version is major" do
|
|
637
649
|
it "returns the version" do
|
|
638
650
|
mock_output(:stdout => output_version("1"))
|
|
639
|
-
subject.run.
|
|
651
|
+
expect(subject.run).to eq "1"
|
|
640
652
|
end
|
|
641
653
|
end
|
|
642
654
|
|
|
643
655
|
context "when the version is major.minor" do
|
|
644
656
|
it "returns the version" do
|
|
645
657
|
mock_output(:stdout => output_version("1.10"))
|
|
646
|
-
subject.run.
|
|
658
|
+
expect(subject.run).to eq "1.10"
|
|
647
659
|
end
|
|
648
660
|
end
|
|
649
661
|
|
|
650
662
|
context "when the version is major.minor.release" do
|
|
651
663
|
it "returns the version" do
|
|
652
664
|
mock_output(:stdout => output_version("1.10.100"))
|
|
653
|
-
subject.run.
|
|
665
|
+
expect(subject.run).to eq "1.10.100"
|
|
654
666
|
end
|
|
655
667
|
end
|
|
656
668
|
|
|
657
669
|
context "when the version is major.minor.release.build format" do
|
|
658
670
|
it "returns the version" do
|
|
659
671
|
mock_output(:stdout => output_version("1.10.100.1234"))
|
|
660
|
-
subject.run.
|
|
672
|
+
expect(subject.run).to eq "1.10.100.1234"
|
|
661
673
|
end
|
|
662
674
|
end
|
|
663
675
|
|
|
664
676
|
context "when the version it's somthing else" do
|
|
665
677
|
it "returns 'Unknown'" do
|
|
666
678
|
mock_output(:stdout => ["bad version here"])
|
|
667
|
-
subject.run.
|
|
679
|
+
expect(subject.run).to eq "Unknown"
|
|
668
680
|
end
|
|
669
681
|
end
|
|
670
682
|
end
|
data/spec/errors_spec.rb
CHANGED
|
@@ -2,51 +2,62 @@ require "spec_helper"
|
|
|
2
2
|
|
|
3
3
|
describe ITunes::Store::Transporter::TransporterMessage do
|
|
4
4
|
subject { ITunes::Store::Transporter::TransporterMessage.new("some message", 1) }
|
|
5
|
-
its(:code) { should == 1 }
|
|
6
|
-
its(:message) { should == "some message" }
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
end
|
|
6
|
+
it "has the expected code and message" do
|
|
7
|
+
expect(subject.code).to eq 1
|
|
8
|
+
expect(subject.message).to eq "some message"
|
|
12
9
|
end
|
|
13
10
|
|
|
14
|
-
describe "
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
describe "#to_s" do
|
|
12
|
+
it "includes the code and message" do
|
|
13
|
+
expect(subject.to_s).to eq "some message (1)"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe "error predicate methods" do
|
|
18
|
+
method_codes = {
|
|
19
|
+
:bad_data? => [3000, 3999],
|
|
17
20
|
:invalid_data? => [4000, 4999],
|
|
18
21
|
:missing_data? => [5000, 5999],
|
|
19
|
-
:unsupported_feature? => [6000, 6999],
|
|
20
|
-
:schema_error? => [8000, 8999],
|
|
21
|
-
:asset_error? => [9000, 9999]
|
|
22
|
+
:unsupported_feature? => [6000, 6999],
|
|
23
|
+
:schema_error? => [8000, 8999],
|
|
24
|
+
:asset_error? => [9000, 9999]
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
method_codes.each do |method, codes|
|
|
25
28
|
[codes.first, codes.last].each do |code|
|
|
26
29
|
|
|
27
|
-
context "code #{code}" do
|
|
30
|
+
context "code #{code}" do
|
|
28
31
|
subject { described_class.new("", code) }
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
|
|
33
|
+
it "returns true for #{method} and #validation_error?" do
|
|
34
|
+
expect(subject.public_send(method)).to be true
|
|
35
|
+
expect(subject.validation_error?).to be true
|
|
36
|
+
end
|
|
31
37
|
|
|
32
38
|
(method_codes.keys - [method]).each do |other|
|
|
33
|
-
|
|
39
|
+
it "returns false for #{other}" do
|
|
40
|
+
expect(subject.public_send(other)).to be false
|
|
41
|
+
end
|
|
34
42
|
end
|
|
35
43
|
end
|
|
36
44
|
end
|
|
37
45
|
end
|
|
38
46
|
end
|
|
39
47
|
end
|
|
40
|
-
|
|
41
|
-
describe ITunes::Store::Transporter::ExecutionError do
|
|
48
|
+
|
|
49
|
+
describe ITunes::Store::Transporter::ExecutionError do
|
|
42
50
|
subject { described_class.new(messages, 1) }
|
|
43
51
|
let(:messages) { 2.times.inject([]) { |err, i| err << ITunes::Store::Transporter::TransporterMessage.new("message #{i}", i) } }
|
|
44
|
-
its(:exitstatus) { should == 1 }
|
|
45
|
-
its(:errors) { should == messages }
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
it "has the expected exitstatus and errors" do
|
|
54
|
+
expect(subject.exitstatus).to eq 1
|
|
55
|
+
expect(subject.errors).to eq messages
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe "#to_s" do
|
|
59
|
+
it "includes each messages and its code" do
|
|
60
|
+
expect(subject.to_s).to eq "message 0 (0), message 1 (1)"
|
|
50
61
|
end
|
|
51
62
|
end
|
|
52
63
|
end
|
data/spec/output_parser_spec.rb
CHANGED
|
@@ -54,20 +54,31 @@ describe ITunes::Store::Transporter::OutputParser do
|
|
|
54
54
|
before(:all) { @parser = described_class.new(fixture("errors_and_warnings.with_error_number")) }
|
|
55
55
|
|
|
56
56
|
subject { @parser }
|
|
57
|
-
its(:warnings) { should be_empty }
|
|
58
|
-
its(:errors) { should have(2).items }
|
|
59
57
|
|
|
58
|
+
it "generates no warnings" do
|
|
59
|
+
expect(@parser.warnings).to be_empty
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "generates two errors" do
|
|
63
|
+
expect(@parser.errors.size).to eq 2
|
|
64
|
+
end
|
|
60
65
|
|
|
61
66
|
describe "the first error" do
|
|
62
67
|
subject { @parser.errors.first }
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
|
|
69
|
+
it "has the expected code and message" do
|
|
70
|
+
expect(subject.code).to eq 4000
|
|
71
|
+
expect(subject.message).to eq "This is error 4000"
|
|
72
|
+
end
|
|
65
73
|
end
|
|
66
74
|
|
|
67
75
|
describe "the second error" do
|
|
68
76
|
subject { @parser.errors.last }
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
|
|
78
|
+
it "has the expected code and message" do
|
|
79
|
+
expect(subject.code).to eq 5000
|
|
80
|
+
expect(subject.message).to eq "This is error 5000"
|
|
81
|
+
end
|
|
71
82
|
end
|
|
72
83
|
end
|
|
73
84
|
|
|
@@ -76,7 +87,7 @@ describe ITunes::Store::Transporter::OutputParser do
|
|
|
76
87
|
|
|
77
88
|
it "does not include duplicates" do
|
|
78
89
|
errors = @parser.errors.map { |e| e.message }
|
|
79
|
-
errors.
|
|
90
|
+
expect(errors).to eq ["Error 1", "Error 2", "Error 3"]
|
|
80
91
|
end
|
|
81
92
|
end
|
|
82
93
|
end
|
|
@@ -85,13 +96,22 @@ describe ITunes::Store::Transporter::OutputParser do
|
|
|
85
96
|
before(:all) { @parser = described_class.new(fixture("errors_and_warnings.single_warning")) }
|
|
86
97
|
|
|
87
98
|
subject { @parser }
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
|
|
100
|
+
it "generates no errors" do
|
|
101
|
+
expect(@parser.errors).to be_empty
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it "generates one warning" do
|
|
105
|
+
expect(@parser.warnings.size).to eq 1
|
|
106
|
+
end
|
|
90
107
|
|
|
91
108
|
describe "the warning" do
|
|
92
109
|
subject { @parser.warnings.first }
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
|
|
111
|
+
it "has the expected code and message" do
|
|
112
|
+
expect(subject.code).to eq 4010
|
|
113
|
+
expect(subject.message).to eq "You've been warned!"
|
|
114
|
+
end
|
|
95
115
|
end
|
|
96
116
|
end
|
|
97
117
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -17,7 +17,7 @@ module SpecHelper
|
|
|
17
17
|
|
|
18
18
|
def expect_shell_args(*expected)
|
|
19
19
|
output = expected.last.is_a?(Hash) ? expected.pop : {}
|
|
20
|
-
ITunes::Store::Transporter::Shell.
|
|
20
|
+
allow_any_instance_of(ITunes::Store::Transporter::Shell).to receive(:exec) do |_instance, *args, &block|
|
|
21
21
|
expect(args.first).to include(*expected)
|
|
22
22
|
|
|
23
23
|
[:stdout, :stderr].each do |fd|
|
|
@@ -47,7 +47,7 @@ module SpecHelper
|
|
|
47
47
|
outputs << [ lines, fd ]
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
ITunes::Store::Transporter::Shell.
|
|
50
|
+
allow_any_instance_of(ITunes::Store::Transporter::Shell).to receive(:exec) do |_instance, *options, &block|
|
|
51
51
|
outputs.each do |lines, fd|
|
|
52
52
|
lines.each { |line| block.call(line, fd) }
|
|
53
53
|
end
|
data/spec/transporter_spec.rb
CHANGED
|
@@ -14,7 +14,7 @@ shared_examples_for "a transporter method" do
|
|
|
14
14
|
allow(s).to receive(:run)
|
|
15
15
|
|
|
16
16
|
klass = ITunes::Store::Transporter::Command.const_get(command)
|
|
17
|
-
klass.
|
|
17
|
+
expect(klass).to receive(:new).with(config, defaults).and_return(s)
|
|
18
18
|
|
|
19
19
|
described_class.new(config.merge(defaults)).send(method, options)
|
|
20
20
|
end
|
|
@@ -24,7 +24,7 @@ shared_examples_for "a transporter method without a package argument" do
|
|
|
24
24
|
it_behaves_like "a transporter method"
|
|
25
25
|
|
|
26
26
|
it "executes the underlying command" do
|
|
27
|
-
ITunes::Store::Transporter::Command.const_get(command).
|
|
27
|
+
expect_any_instance_of(ITunes::Store::Transporter::Command.const_get(command)).to receive(:run).with(options)
|
|
28
28
|
subject.send(method, options)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -33,7 +33,7 @@ shared_examples_for "a transporter method with a package argument" do
|
|
|
33
33
|
it_behaves_like "a transporter method"
|
|
34
34
|
|
|
35
35
|
it "executes the underlying command" do
|
|
36
|
-
ITunes::Store::Transporter::Command.const_get(command).
|
|
36
|
+
expect_any_instance_of(ITunes::Store::Transporter::Command.const_get(command)).to receive(:run).with(:package => "package.itmsp")
|
|
37
37
|
subject.send(method, "package.itmsp")
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -45,7 +45,7 @@ describe ITunes::Store::Transporter::ITMSTransporter do
|
|
|
45
45
|
describe "#new" do
|
|
46
46
|
context "when the options are not a Hash or nil" do
|
|
47
47
|
it "raises an ArgumentError" do
|
|
48
|
-
|
|
48
|
+
expect { described_class.new(123) }.to raise_exception(ArgumentError, /must be/)
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -57,7 +57,7 @@ describe ITunes::Store::Transporter::ITMSTransporter do
|
|
|
57
57
|
it_behaves_like "a transporter method without a package argument"
|
|
58
58
|
|
|
59
59
|
it "executes the underlying command" do
|
|
60
|
-
ITunes::Store::Transporter::Command::Lookup.
|
|
60
|
+
expect_any_instance_of(ITunes::Store::Transporter::Command::Lookup).to receive(:run)
|
|
61
61
|
subject.lookup
|
|
62
62
|
end
|
|
63
63
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: itunes_store_transporter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Skye Shaw
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: childprocess
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: '5.1'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: '5.1'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: optout
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -38,43 +38,79 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: 0.0.2
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rexml
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: net-smtp
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
41
69
|
- !ruby/object:Gem::Dependency
|
|
42
70
|
name: rake
|
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
|
44
72
|
requirements:
|
|
45
73
|
- - "~>"
|
|
46
74
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0
|
|
75
|
+
version: '13.0'
|
|
48
76
|
type: :development
|
|
49
77
|
prerelease: false
|
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
79
|
requirements:
|
|
52
80
|
- - "~>"
|
|
53
81
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0
|
|
82
|
+
version: '13.0'
|
|
55
83
|
- !ruby/object:Gem::Dependency
|
|
56
84
|
name: rspec
|
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
|
58
86
|
requirements:
|
|
59
87
|
- - "~>"
|
|
60
88
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
62
|
-
- - "<"
|
|
63
|
-
- !ruby/object:Gem::Version
|
|
64
|
-
version: '3'
|
|
89
|
+
version: '3.13'
|
|
65
90
|
type: :development
|
|
66
91
|
prerelease: false
|
|
67
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
68
93
|
requirements:
|
|
69
94
|
- - "~>"
|
|
70
95
|
- !ruby/object:Gem::Version
|
|
71
|
-
version: '
|
|
72
|
-
|
|
96
|
+
version: '3.13'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec-its
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '1.3'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
73
109
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '3'
|
|
75
|
-
description:
|
|
76
|
-
|
|
77
|
-
|
|
110
|
+
version: '1.3'
|
|
111
|
+
description: |2
|
|
112
|
+
iTunes::Store::Transporter is a wrapper around Apple's iTMSTransporter program. It allows you to upload packages to the
|
|
113
|
+
Apple Store, validate them, retrieve status information, lookup metadata, and more!
|
|
78
114
|
email: skye.shaw@gmail.com
|
|
79
115
|
executables:
|
|
80
116
|
- itms
|
|
@@ -115,16 +151,11 @@ files:
|
|
|
115
151
|
- spec/spec_helper.rb
|
|
116
152
|
- spec/transporter_spec.rb
|
|
117
153
|
- spec/xml_status_spec.rb
|
|
118
|
-
- spec/xml_status_spec.rb~
|
|
119
154
|
homepage: http://github.com/sshaw/itunes_store_transporter
|
|
120
155
|
licenses:
|
|
121
156
|
- MIT
|
|
122
157
|
metadata: {}
|
|
123
|
-
post_install_message:
|
|
124
|
-
\ ATTENTION WINDOWS USERS !!\n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n
|
|
125
|
-
\ \n You must make a small change to the iTMSTransporter.CMD batch file, otherwise
|
|
126
|
-
\n this library will not function correctly. \n \n For details see: http://github.com/sshaw/itunes_store_transporter#running-on-windows
|
|
127
|
-
\ \n\n"
|
|
158
|
+
post_install_message:
|
|
128
159
|
rdoc_options: []
|
|
129
160
|
require_paths:
|
|
130
161
|
- lib
|
|
@@ -139,23 +170,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
170
|
- !ruby/object:Gem::Version
|
|
140
171
|
version: '0'
|
|
141
172
|
requirements: []
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
signing_key:
|
|
173
|
+
rubygems_version: 3.5.16
|
|
174
|
+
signing_key:
|
|
145
175
|
specification_version: 4
|
|
146
176
|
summary: Upload and manage your assets in the iTunes Store using the iTunes Store's
|
|
147
177
|
Transporter (iTMSTransporter).
|
|
148
|
-
test_files:
|
|
149
|
-
- spec/command_spec.rb
|
|
150
|
-
- spec/errors_spec.rb
|
|
151
|
-
- spec/fixtures/errors_and_warnings.yml
|
|
152
|
-
- spec/fixtures/providers.yml
|
|
153
|
-
- spec/fixtures/status.yml
|
|
154
|
-
- spec/fixtures/stderr.yml
|
|
155
|
-
- spec/fixtures/stdout.yml
|
|
156
|
-
- spec/output_parser_spec.rb
|
|
157
|
-
- spec/shell_spec.rb
|
|
158
|
-
- spec/spec_helper.rb
|
|
159
|
-
- spec/transporter_spec.rb
|
|
160
|
-
- spec/xml_status_spec.rb
|
|
161
|
-
- spec/xml_status_spec.rb~
|
|
178
|
+
test_files: []
|
data/spec/xml_status_spec.rb~
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
RSpec.describe ITunes::Store::Transporter::XML::Status do
|
|
4
|
-
context "given a valid XML doc with a single status" do
|
|
5
|
-
it "returns a Hash with a single status" do
|
|
6
|
-
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
context "given a valid XML doc with multiple statuses" do
|
|
12
|
-
it "returns a Hash with multiple statuses" do
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
context "given an XML invalid XML doc" do
|
|
18
|
-
it "raises a ParseError" do
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|