itunes_store_transporter 0.1.2 → 0.1.3
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 +4 -4
- data/Changes +5 -0
- data/README.rdoc +2 -2
- data/lib/itunes/store/transporter.rb +1 -0
- data/lib/itunes/store/transporter/command.rb +38 -0
- data/lib/itunes/store/transporter/command/lookup.rb +6 -5
- data/lib/itunes/store/transporter/command/option.rb +2 -3
- data/lib/itunes/store/transporter/command/upload.rb +1 -2
- data/lib/itunes/store/transporter/command/verify.rb +1 -3
- data/lib/itunes/store/transporter/itms_transporter.rb +2 -0
- data/lib/itunes/store/transporter/version.rb +1 -1
- data/spec/command_spec.rb +36 -3
- data/spec/transporter_spec.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 603cbf0b2fe54965a1fcd25315fc2434f9987188
|
4
|
+
data.tar.gz: 4c197138304f80f540f508c8a8f09910532ceef6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57b4de9c4cc1571829c9151ec91e8b0773d094299454252ff40d348faed32100d65e242a1dcd322c014347d4167e5c9a3f93a6373e3ba7f7e8578d1ebda769af
|
7
|
+
data.tar.gz: 812887659a510890d27f5e4a497b96463dca4ffe371e281e9be9b50a613e0bff3d2cd4a2df53eae8b82bd395ec4990f5240a6639b22b986efe58d975fb829809
|
data/Changes
CHANGED
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= iTunes::Store::Transporter
|
2
2
|
|
3
|
-
{<img src="https://secure.travis-ci.org/sshaw/itunes_store_transporter.
|
4
|
-
{<img src="https://codeclimate.com/github/sshaw/itunes_store_transporter.
|
3
|
+
{<img src="https://secure.travis-ci.org/sshaw/itunes_store_transporter.svg"/>}[http://travis-ci.org/sshaw/itunes_store_transporter]
|
4
|
+
{<img src="https://codeclimate.com/github/sshaw/itunes_store_transporter.svg" />}[https://codeclimate.com/github/sshaw/itunes_store_transporter]
|
5
5
|
|
6
6
|
Upload and manage your assets in the iTunes Store using the iTunes Store's Transporter (+iTMSTransporter+).
|
7
7
|
|
@@ -43,6 +43,7 @@ module ITunes
|
|
43
43
|
end
|
44
44
|
|
45
45
|
protected
|
46
|
+
|
46
47
|
attr :config
|
47
48
|
attr :default_options
|
48
49
|
|
@@ -86,6 +87,8 @@ module ITunes
|
|
86
87
|
options.on *SHORTNAME
|
87
88
|
end
|
88
89
|
|
90
|
+
protected
|
91
|
+
|
89
92
|
def create_transporter_options(optz)
|
90
93
|
optz[:mode] = mode
|
91
94
|
super
|
@@ -96,6 +99,41 @@ module ITunes
|
|
96
99
|
end
|
97
100
|
end
|
98
101
|
|
102
|
+
class BatchMode < Mode
|
103
|
+
BatchOption = Optout::Option.create(:package, "-f", :required => true, :validator => Optout::Dir.exists)
|
104
|
+
PackageOption = Optout::Option.create(:package, "-f", :required => true, :validator => Optout::Dir.exists.named(/\.itmsp\z/))
|
105
|
+
|
106
|
+
protected
|
107
|
+
|
108
|
+
def create_transporter_options(optz)
|
109
|
+
batch = optz.delete(:batch)
|
110
|
+
package = optz.delete(:package)
|
111
|
+
|
112
|
+
argv = super
|
113
|
+
|
114
|
+
klass = if batch == true
|
115
|
+
BatchOption
|
116
|
+
else
|
117
|
+
if package !~ /\.itmsp\z/
|
118
|
+
warn "WARNING: In version 0.3.0 directories without an itmsp extension be treated as a batch upload. " \
|
119
|
+
"This will result in the processing of all child directories with an itmsp extension. " \
|
120
|
+
"To prevent this behavior in 0.3.0 you must set the :batch option to false"
|
121
|
+
end
|
122
|
+
|
123
|
+
PackageOption
|
124
|
+
end
|
125
|
+
|
126
|
+
opt = klass.new(package)
|
127
|
+
|
128
|
+
begin
|
129
|
+
opt.validate!
|
130
|
+
rescue Optout::OptionError => e
|
131
|
+
raise OptionError, e.message
|
132
|
+
end
|
133
|
+
|
134
|
+
argv.concat(opt.to_a)
|
135
|
+
end
|
136
|
+
end
|
99
137
|
end
|
100
138
|
end
|
101
139
|
end
|
@@ -9,12 +9,12 @@ module ITunes
|
|
9
9
|
module Command
|
10
10
|
|
11
11
|
##
|
12
|
-
# Retrieve the metadata for a previously delivered package.
|
12
|
+
# Retrieve the metadata for a previously delivered package.
|
13
13
|
#
|
14
14
|
class Lookup < Mode
|
15
15
|
def initialize(*config)
|
16
16
|
super
|
17
|
-
# These 2 are mutually exclusive, and one is required.
|
17
|
+
# These 2 are mutually exclusive, and one is required.
|
18
18
|
# Optout has no way to denote this
|
19
19
|
options.on *VENDOR_ID
|
20
20
|
options.on *APPLE_ID
|
@@ -23,12 +23,13 @@ module ITunes
|
|
23
23
|
|
24
24
|
def run(options = {})
|
25
25
|
options[:destination] = Dir.mktmpdir
|
26
|
-
super
|
26
|
+
super
|
27
27
|
ensure
|
28
28
|
FileUtils.rm_rf(options[:destination]) if options[:destination]
|
29
29
|
end
|
30
30
|
|
31
31
|
protected
|
32
|
+
|
32
33
|
def handle_success(stdout_lines, stderr_lines, options)
|
33
34
|
id = options[:apple_id] || options[:vendor_id]
|
34
35
|
path = File.join(options[:destination], "#{id}.itmsp", "metadata.xml")
|
@@ -37,8 +38,8 @@ module ITunes
|
|
37
38
|
raise TransporterError, "No metadata file exists at #{path}"
|
38
39
|
end
|
39
40
|
|
40
|
-
begin
|
41
|
-
metadata = File.read(path)
|
41
|
+
begin
|
42
|
+
metadata = File.read(path)
|
42
43
|
rescue StandardError => e
|
43
44
|
raise TransporterError, "Failed to read metadata file #{path}: #{e}"
|
44
45
|
end
|
@@ -11,9 +11,8 @@ module ITunes
|
|
11
11
|
SHORTNAME = [ :shortname, "-s", /\w/ ]
|
12
12
|
TRANSPORT = [ :transport, "-t", %w|Aspera Signiant DAV| ]
|
13
13
|
SUCCESS = [ :success, "-success", Optout::Dir.exists ]
|
14
|
-
FAILURE = [ :failure, "-failure", Optout::Dir.exists ]
|
15
|
-
|
16
|
-
DESTINATION = [ :destination, "-destination" ]
|
14
|
+
FAILURE = [ :failure, "-failure", Optout::Dir.exists ]
|
15
|
+
DESTINATION = [ :destination, "-destination" ]
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
@@ -11,11 +11,9 @@ module ITunes
|
|
11
11
|
##
|
12
12
|
# Validate the contents of a package's metadata and assets.
|
13
13
|
#
|
14
|
-
|
15
|
-
class Verify < Mode
|
14
|
+
class Verify < BatchMode
|
16
15
|
def initialize(*config)
|
17
16
|
super
|
18
|
-
options.on *PACKAGE
|
19
17
|
options.on :verify_assets, "-disableAssetVerification", Optout::Boolean # If false verify MD only no assets
|
20
18
|
end
|
21
19
|
|
@@ -143,6 +143,7 @@ module ITunes
|
|
143
143
|
# [:delete (Boolean)] Delete the package if the upload succeeds. Defaults to +false+.
|
144
144
|
# [:log_history (String)] Write an +iTMSTransporter+ log to this directory. Off by default.
|
145
145
|
# [:streams (Integer)] Number of data streams to use. Optional, only used with +Signiant+
|
146
|
+
# [:batch (Boolean)] Allow batch uploads if +package+ is a regular directory. Optional, defaults to +false+ but <b>will default to +true+ in <code>v0.3.0</code></b>.
|
146
147
|
#
|
147
148
|
# === Errors
|
148
149
|
#
|
@@ -169,6 +170,7 @@ module ITunes
|
|
169
170
|
#
|
170
171
|
# === Options
|
171
172
|
#
|
173
|
+
# [:batch (Boolean)] Allow batch verification if +package+ is a regular directory. Optional, defaults to +false+ but <b>will default to +true+ in <code>v0.3.0</code></b>.
|
172
174
|
# [:verify_assets (Boolean)] If false the assets will not be verified. Defaults to +true+.
|
173
175
|
#
|
174
176
|
# === Errors
|
data/spec/command_spec.rb
CHANGED
@@ -195,6 +195,7 @@ shared_examples_for "a transporter mode" do
|
|
195
195
|
end
|
196
196
|
|
197
197
|
shared_examples_for "a command that requires a package argument" do
|
198
|
+
# TODO: it_should_behave_like "a transporter option", {:package => "xxx"}, "f", "xxx"
|
198
199
|
it_should_behave_like "a required option", :package
|
199
200
|
|
200
201
|
context "when a directory" do
|
@@ -208,16 +209,48 @@ shared_examples_for "a command that requires a package argument" do
|
|
208
209
|
|
209
210
|
it "must end in .itmsp" do
|
210
211
|
options = create_options(:package => @tmpdir)
|
211
|
-
|
212
|
+
expect { subject.run(options) }.to raise_error(ITunes::Store::Transporter::OptionError, /must match/i)
|
212
213
|
|
213
214
|
mock_output(:exit => 0)
|
214
215
|
options = create_options(:package => @pkgdir)
|
215
|
-
|
216
|
+
expect { subject.run(options) }.not_to raise_error
|
216
217
|
end
|
217
218
|
|
218
219
|
it "must exist" do
|
219
220
|
options = create_options(:package => File.join(@tmpdir, "badpkg.itmsp"))
|
220
|
-
|
221
|
+
expect { subject.run(options) }.to raise_error(ITunes::Store::Transporter::OptionError, /does not exist/i)
|
222
|
+
end
|
223
|
+
|
224
|
+
context "when it does not end in .itmsp" do
|
225
|
+
before do
|
226
|
+
@realerr = $stderr
|
227
|
+
$stderr = StringIO.new
|
228
|
+
end
|
229
|
+
|
230
|
+
after { $stderr = @realerr }
|
231
|
+
|
232
|
+
it "prints a deprecation warning to stderr" do
|
233
|
+
options = create_options(:package => @tmpdir)
|
234
|
+
subject.run(options) rescue nil
|
235
|
+
expect($stderr.string).to match(/^WARNING:/)
|
236
|
+
end
|
237
|
+
|
238
|
+
context "and :batch is true" do
|
239
|
+
before do
|
240
|
+
mock_output
|
241
|
+
@options = create_options(:package => @tmpdir, :batch => true)
|
242
|
+
end
|
243
|
+
|
244
|
+
it "does not raise an exception" do
|
245
|
+
expect { subject.run(@options) }.to_not raise_error
|
246
|
+
end
|
247
|
+
|
248
|
+
it "does not print a deprecation warning to stderr" do
|
249
|
+
options = create_options(:package => @tmpdir)
|
250
|
+
subject.run(@options)
|
251
|
+
expect($stderr.string).not_to match(/^WARNING:/)
|
252
|
+
end
|
253
|
+
end
|
221
254
|
end
|
222
255
|
end
|
223
256
|
|
data/spec/transporter_spec.rb
CHANGED
@@ -10,8 +10,8 @@ shared_examples_for "a transporter method" do
|
|
10
10
|
:print_stdout => true
|
11
11
|
}
|
12
12
|
|
13
|
-
s =
|
14
|
-
s.
|
13
|
+
s = double(command)
|
14
|
+
allow(s).to receive(:run)
|
15
15
|
|
16
16
|
klass = ITunes::Store::Transporter::Command.const_get(command)
|
17
17
|
klass.should_receive(:new).with(config, defaults).and_return(s)
|
@@ -20,7 +20,7 @@ shared_examples_for "a transporter method" do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
shared_examples_for "a transporter method without a package argument" do
|
23
|
+
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
|
@@ -29,7 +29,7 @@ shared_examples_for "a transporter method without a package argument" do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
shared_examples_for "a transporter method with a package argument" do
|
32
|
+
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
|
@@ -94,13 +94,13 @@ describe ITunes::Store::Transporter::ITMSTransporter do
|
|
94
94
|
let(:method) { :verify }
|
95
95
|
let(:command) { "Verify" }
|
96
96
|
|
97
|
-
it_behaves_like "a transporter method with a package argument"
|
97
|
+
it_behaves_like "a transporter method with a package argument"
|
98
98
|
end
|
99
99
|
|
100
100
|
describe "#version" do
|
101
101
|
let(:method) { :version }
|
102
102
|
let(:command) { "Version" }
|
103
103
|
|
104
|
-
it_behaves_like "a transporter method without a package argument"
|
104
|
+
it_behaves_like "a transporter method without a package argument"
|
105
105
|
end
|
106
106
|
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skye Shaw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: childprocess
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.4.
|
139
|
+
rubygems_version: 2.4.3
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Upload and manage your assets in the iTunes Store using the iTunes Store's
|