deliver 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +37 -10
- data/.rspec +1 -0
- data/.travis.yml +8 -0
- data/.yardopts +1 -0
- data/Gemfile.lock +106 -0
- data/LICENSE +21 -0
- data/README.md +268 -17
- data/Rakefile +3 -0
- data/assets/PDFExample.png +0 -0
- data/assets/SubmitForReviewInformation.png +0 -0
- data/assets/deliver.png +0 -0
- data/assets/deliver.pxm +0 -0
- data/assets/deliverFullSize.png +0 -0
- data/bin/deliver +32 -0
- data/deliver.gemspec +15 -9
- data/lib/assets/DeliverfileDefault +47 -0
- data/lib/assets/DeliverfileExample +62 -0
- data/lib/assets/ScreenshotsHelp +4 -0
- data/lib/deliver.rb +20 -1
- data/lib/deliver/app.rb +146 -0
- data/lib/deliver/app_metadata.rb +487 -0
- data/lib/deliver/app_screenshot.rb +119 -0
- data/lib/deliver/commands.rb +4 -0
- data/lib/deliver/commands/init.rb +12 -0
- data/lib/deliver/commands/run.rb +20 -0
- data/lib/deliver/deliver_process.rb +241 -0
- data/lib/deliver/deliverer.rb +112 -0
- data/lib/deliver/deliverfile/deliverfile.rb +35 -0
- data/lib/deliver/deliverfile/deliverfile_creator.rb +115 -0
- data/lib/deliver/deliverfile/dsl.rb +124 -0
- data/lib/deliver/dependency_checker.rb +32 -0
- data/lib/deliver/helper.rb +55 -0
- data/lib/deliver/ipa_uploader.rb +160 -0
- data/lib/deliver/itunes_connect.rb +514 -0
- data/lib/deliver/itunes_search_api.rb +48 -0
- data/lib/deliver/itunes_transporter.rb +154 -0
- data/lib/deliver/languages.rb +6 -0
- data/lib/deliver/metadata_item.rb +94 -0
- data/lib/deliver/password_manager.rb +86 -0
- data/lib/deliver/pdf_generator.rb +131 -0
- data/lib/deliver/version.rb +1 -1
- data/spec/app_metadata_spec.rb +350 -0
- data/spec/app_screenshot_spec.rb +88 -0
- data/spec/app_spec.rb +85 -0
- data/spec/deliverer_spec.rb +48 -0
- data/spec/deliverfile_creator_spec.rb +73 -0
- data/spec/example_deliver_files_spec.rb +227 -0
- data/spec/fixtures/Deliverfiles/DeliverfileCallbacks +14 -0
- data/spec/fixtures/Deliverfiles/DeliverfileCallbacksFailingTests +14 -0
- data/spec/fixtures/Deliverfiles/DeliverfileCallbacksNoErrorBlock +6 -0
- data/spec/fixtures/Deliverfiles/DeliverfileDefaultLanguageNotOnTop +8 -0
- data/spec/fixtures/Deliverfiles/DeliverfileDuplicateIpa +2 -0
- data/spec/fixtures/Deliverfiles/DeliverfileLocales +16 -0
- data/spec/fixtures/Deliverfiles/DeliverfileMetadataJson +6 -0
- data/spec/fixtures/Deliverfiles/DeliverfileMissingAppVersion +1 -0
- data/spec/fixtures/Deliverfiles/DeliverfileMissingBlockForTests +7 -0
- data/spec/fixtures/Deliverfiles/DeliverfileMissingIdentifier +1 -0
- data/spec/fixtures/Deliverfiles/DeliverfileMissingLanguage +1 -0
- data/spec/fixtures/Deliverfiles/DeliverfileMissingValue +3 -0
- data/spec/fixtures/Deliverfiles/DeliverfileMixed +37 -0
- data/spec/fixtures/Deliverfiles/DeliverfileNoVersion +3 -0
- data/spec/fixtures/Deliverfiles/DeliverfileScreenshots +6 -0
- data/spec/fixtures/Deliverfiles/DeliverfileScreenshotsFallbackDefaultLanguage +7 -0
- data/spec/fixtures/Deliverfiles/DeliverfileSimple +8 -0
- data/spec/fixtures/Deliverfiles/DeliverfileVersionMismatchPackage +8 -0
- data/spec/fixtures/Deliverfiles/DeliverfileWrongIdentifier +5 -0
- data/spec/fixtures/Deliverfiles/DeliverfileWrongVersion +5 -0
- data/spec/fixtures/Deliverfiles/metadata.json +24 -0
- data/spec/fixtures/example1.itmsp/metadata.xml +121 -0
- data/spec/fixtures/example2.itmsp/metadata.xml +54 -0
- data/spec/fixtures/ipas/Example1.ipa +0 -0
- data/spec/fixtures/metadata/ipa_result.xml +12 -0
- data/spec/fixtures/metadata/ipa_result2.xml +12 -0
- data/spec/fixtures/packages/464686641.itmsp/metadata.xml +104 -0
- data/spec/fixtures/packages/794902327.itmsp/metadata.xml +107 -0
- data/spec/fixtures/packages/878567776.itmsp/metadata.xml +104 -0
- data/spec/fixtures/screenshots/de-DE/iPhone4.png +0 -0
- data/spec/fixtures/screenshots/de-DE/iPhone6.png +0 -0
- data/spec/fixtures/screenshots/de-DE/iPhone6Plus1.png +0 -0
- data/spec/fixtures/screenshots/de-DE/iPhone6Plus2.png +0 -0
- data/spec/fixtures/screenshots/de-DE/screenshot1.png +0 -0
- data/spec/fixtures/screenshots/de-DE/screenshot2.png +0 -0
- data/spec/fixtures/screenshots/de-DE/screenshot3.png +0 -0
- data/spec/fixtures/screenshots/de-DE/screenshot5.png +0 -0
- data/spec/fixtures/screenshots/en-US/english.png +0 -0
- data/spec/fixtures/screenshots/iPhone4.png +0 -0
- data/spec/fixtures/screenshots/invalidImage.png +0 -0
- data/spec/fixtures/screenshots/screenshot1.png +0 -0
- data/spec/fixtures/screenshots/tooMany/de-DE/iPhone4 2.png +0 -0
- data/spec/fixtures/screenshots/tooMany/de-DE/iPhone4 copy 2.png +0 -0
- data/spec/fixtures/screenshots/tooMany/de-DE/iPhone4 copy 3.png +0 -0
- data/spec/fixtures/screenshots/tooMany/de-DE/iPhone4 copy 4.png +0 -0
- data/spec/fixtures/screenshots/tooMany/de-DE/iPhone4 copy 5.png +0 -0
- data/spec/fixtures/screenshots/tooMany/de-DE/iPhone4 copy 6.png +0 -0
- data/spec/fixtures/screenshots/tooMany/de-DE/iPhone4 copy.png +0 -0
- data/spec/fixtures/screenshots/tooMany/de-DE/iPhone4.png +0 -0
- data/spec/helper_spec.rb +16 -0
- data/spec/ipa_uploader_spec.rb +61 -0
- data/spec/itunes_connect_spec.rb +12 -0
- data/spec/itunes_search_api_spec.rb +24 -0
- data/spec/itunes_transporter_spec.rb +52 -0
- data/spec/languages_spec.rb +7 -0
- data/spec/metadata_item_spec.rb +36 -0
- data/spec/mocking/transporter_mocking.rb +40 -0
- data/spec/mocking/webmocking.rb +31 -0
- data/spec/password_manager_spec.rb +27 -0
- data/spec/responses/itunesLookup-.json +4 -0
- data/spec/responses/itunesLookup-0.json +4 -0
- data/spec/responses/itunesLookup-284882215.json +106 -0
- data/spec/responses/itunesLookup-at.felixkrause.iTanky.json +8 -0
- data/spec/responses/itunesLookup-com.facebook.Facebook.json +106 -0
- data/spec/responses/itunesLookup-invalid.json +4 -0
- data/spec/responses/itunesLookup-net.sunapps.invalid.json +4 -0
- data/spec/responses/transporter/download_invalid_apple_id.txt +35 -0
- data/spec/responses/transporter/download_valid_apple_id.txt +32 -0
- data/spec/responses/transporter/upload_invalid.txt +174 -0
- data/spec/responses/transporter/upload_valid.txt +290 -0
- data/spec/spec_helper.rb +23 -0
- data/tasks/rspec.rake +3 -0
- metadata +242 -8
- data/LICENSE.txt +0 -22
@@ -0,0 +1,48 @@
|
|
1
|
+
describe Deliver do
|
2
|
+
describe Deliver::Deliverer do
|
3
|
+
describe "#initialize with hash" do
|
4
|
+
it "raises an exception when some information is missing" do
|
5
|
+
expect {
|
6
|
+
@meta = Deliver::Deliverer.new(nil, hash: {})
|
7
|
+
}.to raise_exception("You have to pass a valid app identifier using the Deliver file. (e.g. 'app_identifier \"net.sunapps.app\"')".red)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "works with valid data" do
|
11
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/download_valid_apple_id.txt")
|
12
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt") # metadata
|
13
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt") # ipa file
|
14
|
+
|
15
|
+
version = '1.0'
|
16
|
+
identifier = 'at.felixkrause.iTanky'
|
17
|
+
ipa = "spec/fixtures/ipas/Example1.ipa"
|
18
|
+
|
19
|
+
@meta = Deliver::Deliverer.new(nil, hash: {
|
20
|
+
app_identifier: identifier,
|
21
|
+
version: version,
|
22
|
+
ipa: ipa
|
23
|
+
})
|
24
|
+
|
25
|
+
expect(@meta.deliver_process.deploy_information[:version]).to eq(version)
|
26
|
+
expect(@meta.deliver_process.deploy_information[:app_identifier]).to eq(identifier)
|
27
|
+
expect(@meta.deliver_process.deploy_information[:ipa]).to eq(ipa)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#set_new_value" do
|
32
|
+
it "raises an exception when invalid key is used" do
|
33
|
+
expect {
|
34
|
+
Deliver::Deliverer.new(nil, hash: { app_identifier: 'net.sunapps.54', invalid_key: '1' })
|
35
|
+
}.to raise_error("Invalid key 'invalid_key', must be contained in Deliverer::ValKey.".red)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "works when the same value is set twice" do
|
39
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/download_valid_apple_id.txt")
|
40
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
41
|
+
|
42
|
+
del = Deliver::Deliverer.new(nil, hash: { app_identifier: 'net.sunapps.54', version: '1.0', apple_id: 878567776 })
|
43
|
+
del.set_new_value(:version, '2.0')
|
44
|
+
expect(del.deliver_process.deploy_information[:version]).to eq("2.0")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
describe Deliver do
|
2
|
+
describe Deliver::DeliverfileCreator do
|
3
|
+
before do
|
4
|
+
@path = "/tmp"
|
5
|
+
@deliver_path = [@path, 'Deliverfile'].join("/")
|
6
|
+
|
7
|
+
FileUtils.rm(@deliver_path) rescue nil
|
8
|
+
end
|
9
|
+
|
10
|
+
it "can create an example Deliverfile" do
|
11
|
+
Deliver::DeliverfileCreator.create_example_deliver_file(@deliver_path, 'deliver')
|
12
|
+
expect(File.read(@deliver_path)).to include("Dynamic generation of the ipa file")
|
13
|
+
|
14
|
+
default = File.read("./lib/assets/DeliverfileExample")
|
15
|
+
default.gsub!("[[APP_NAME]]", "deliver") # default name
|
16
|
+
expect(File.read(@deliver_path)).to eq(default)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "raises an error if Deliverfile already exists" do
|
20
|
+
Deliver::DeliverfileCreator.create_example_deliver_file(@deliver_path, 'deliver')
|
21
|
+
expect {
|
22
|
+
Deliver::DeliverfileCreator.create(@path)
|
23
|
+
}.to raise_error("Deliverfile already exists at path '/tmp/Deliverfile'. Run 'deliver' to use Deliver.".red)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "Can create a Deliverfile based on an existing app" do
|
27
|
+
identifier = 'net.sunapps.54'
|
28
|
+
apple_id = 284882215
|
29
|
+
|
30
|
+
deliver_path = "/tmp/deliver/"
|
31
|
+
FileUtils.rm_rf(deliver_path) rescue nil
|
32
|
+
FileUtils.rm_rf("/tmp/#{apple_id}.itmsp") rescue nil
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/download_valid_apple_id.txt")
|
38
|
+
|
39
|
+
folder = "/tmp/#{apple_id}.itmsp"
|
40
|
+
system("cp -R './spec/fixtures/example1.itmsp/' '#{folder}'")
|
41
|
+
|
42
|
+
project_name = "somethingFancy"
|
43
|
+
Deliver::DeliverfileCreator.create_based_on_identifier(@path, identifier, project_name)
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
# Check if all the files were correctly created at /tmp
|
48
|
+
|
49
|
+
# Check metadata.json
|
50
|
+
metadata = JSON.parse(File.read("#{deliver_path}/metadata.json"))
|
51
|
+
expect(metadata['en-US']['title']).to eq('Default English Title')
|
52
|
+
expect(metadata['de-DE']['title']).to eq('Example App Title')
|
53
|
+
expect(metadata['de-DE']['description']).to include('3D GPS Birdiebuch')
|
54
|
+
expect(metadata['de-DE']['version_whats_new']).to include('- Changelog Line 1')
|
55
|
+
expect(metadata['de-DE']['software_url']).to eq('http://sunapps.net')
|
56
|
+
expect(metadata['de-DE']['support_url']).to eq('http://www.sunapps.net/')
|
57
|
+
expect(metadata['de-DE']['keywords']).to eq(%w|personal sunapps sun sunapps felix krause|)
|
58
|
+
|
59
|
+
# Check Deliverfile
|
60
|
+
correct = File.read("./lib/assets/DeliverfileDefault")
|
61
|
+
correct.gsub!("[[APP_IDENTIFIER]]", 'net.sunapps.54')
|
62
|
+
correct.gsub!("[[APP_NAME]]", project_name)
|
63
|
+
expect(File.read("/tmp/Deliverfile")).to eq(correct)
|
64
|
+
|
65
|
+
expect(File.directory?([deliver_path, "screenshots"].join("/"))).to eq(true)
|
66
|
+
expect(File.directory?([deliver_path, "screenshots", "de-DE"].join("/"))).to eq(true)
|
67
|
+
expect(File.directory?([deliver_path, "screenshots", "en-US"].join("/"))).to eq(true)
|
68
|
+
expect(File.directory?([deliver_path, "screenshots", "en-AU"].join("/"))).to eq(false)
|
69
|
+
|
70
|
+
expect(File.read("/tmp/deliver/screenshots/README.txt")).to eq(File.read("./lib/assets/ScreenshotsHelp"))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
describe Deliver do
|
2
|
+
describe Deliver::Deliverer do
|
3
|
+
describe "#initialize" do
|
4
|
+
describe "Different Deliverfiles" do
|
5
|
+
it "raises an error when file was not found" do
|
6
|
+
expect {
|
7
|
+
Deliver::Deliverer.new(nil)
|
8
|
+
}.to raise_exception "Deliverfile not found at path './Deliverfile'".red
|
9
|
+
end
|
10
|
+
|
11
|
+
it "raises an error if some key information is missing" do
|
12
|
+
expect {
|
13
|
+
Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileMissingAppVersion")
|
14
|
+
}.to raise_exception("You have to pass a valid version number using the Deliver file. (e.g. 'version \"1.0\"')".red)
|
15
|
+
|
16
|
+
expect {
|
17
|
+
Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileMissingIdentifier")
|
18
|
+
}.to raise_exception("You have to pass a valid app identifier using the Deliver file. (e.g. 'app_identifier \"net.sunapps.app\"')".red)
|
19
|
+
|
20
|
+
expect {
|
21
|
+
Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileMissingLanguage")
|
22
|
+
}.to raise_exception(Deliver::Deliverfile::Deliverfile::DSL::SPECIFY_LANGUAGE_FOR_VALUE.red)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "throws an exception when both ipa and beta_ipa are given" do
|
26
|
+
expect {
|
27
|
+
Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileDuplicateIpa")
|
28
|
+
}.to raise_exception("You can not set both ipa and beta_ipa in one file. Either it's a beta build or a release build".red)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "throws an exception when block does not return anything" do
|
32
|
+
expect {
|
33
|
+
Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileMissingValue")
|
34
|
+
}.to raise_exception("You have to pass either a value or a block to the given method.".red)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "throws an exception when no block is given for tests" do
|
38
|
+
expect {
|
39
|
+
Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileMissingBlockForTests")
|
40
|
+
}.to raise_exception("Value for unit_tests must be a Ruby block. Use 'unit_tests' do ... end.".red)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "throws an exception when default_language is not on top of file" do
|
44
|
+
expect {
|
45
|
+
Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileDefaultLanguageNotOnTop")
|
46
|
+
}.to raise_exception("'default_language' must be on the top of the Deliverfile.".red)
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "Valid Deliverfiles" do
|
50
|
+
before do
|
51
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/download_valid_apple_id.txt")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "successfully loads the Deliverfile if it's valid" do
|
55
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
56
|
+
|
57
|
+
meta = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileSimple")
|
58
|
+
|
59
|
+
thanks_for_facebook = "Thanks for using Facebook! To make our app better for you, we bring updates to the App Store every 4 weeks."
|
60
|
+
|
61
|
+
expect(meta.deliver_process.app.app_identifier).to eq("net.sunapps.54")
|
62
|
+
expect(meta.deliver_process.deploy_information[:version]).to eq("943.0")
|
63
|
+
expect(meta.deliver_process.deploy_information[:changelog]).to eq({
|
64
|
+
'en-US' => thanks_for_facebook
|
65
|
+
})
|
66
|
+
|
67
|
+
# Stored in XML file
|
68
|
+
expect(meta.deliver_process.app.metadata.fetch_value("//x:version").first['string']).to eq("943.0")
|
69
|
+
expect(meta.deliver_process.app.metadata.fetch_value("//x:version_whats_new").count).to eq(1) # one language only
|
70
|
+
expect(meta.deliver_process.app.metadata.fetch_value("//x:version_whats_new").first.content).to eq(thanks_for_facebook)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "Sets all the available metadata" do
|
74
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
75
|
+
|
76
|
+
meta = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileMixed")
|
77
|
+
|
78
|
+
expect(meta.deliver_process.app.app_identifier).to eq("net.sunapps.54")
|
79
|
+
|
80
|
+
expect(meta.deliver_process.deploy_information[:changelog]).to eq({"en-US"=>"Thanks for using this app"})
|
81
|
+
expect(meta.deliver_process.deploy_information[:version]).to eq("943.0")
|
82
|
+
expect(meta.deliver_process.deploy_information[:description]).to eq({"en-US"=>"App description"})
|
83
|
+
expect(meta.deliver_process.deploy_information[:privacy_url].values.first).to eq("http://privacy.sunapps.net")
|
84
|
+
expect(meta.deliver_process.deploy_information[:marketing_url].values.first).to eq("http://www.sunapps.net")
|
85
|
+
expect(meta.deliver_process.deploy_information[:support_url].values.first).to eq("http://support.sunapps.net")
|
86
|
+
expect(meta.deliver_process.deploy_information[:title]).to eq({"en-US"=>"The ultimate iPhone app"})
|
87
|
+
expect(meta.deliver_process.deploy_information[:keywords]).to eq({"en-US"=>["keyword1", "something", "else"]})
|
88
|
+
end
|
89
|
+
|
90
|
+
it "Uploads all the available screenshots" do
|
91
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
92
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileScreenshots")
|
93
|
+
screenshots = deliv.deliver_process.app.metadata.fetch_value("//x:software_screenshot")
|
94
|
+
expect(screenshots.count).to eq(9)
|
95
|
+
|
96
|
+
screenshots_path = "spec/fixtures/packages/#{deliv.deliver_process.app.apple_id}.itmsp/*.png"
|
97
|
+
expect(Dir.glob(screenshots_path).count).to equal(screenshots.count)
|
98
|
+
Dir.glob(screenshots_path) do |file|
|
99
|
+
File.delete(file)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
it "Falls back to the default language if only one screenshot path is given" do
|
104
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
105
|
+
|
106
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileScreenshotsFallbackDefaultLanguage")
|
107
|
+
expect(deliv.deliver_process.deploy_information[:screenshots_path]).to eq({"de-DE"=>"/tmp"})
|
108
|
+
end
|
109
|
+
|
110
|
+
it "Does not require an app version, when an ipa is given" do
|
111
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
112
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt") # the ipa file
|
113
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileNoVersion")
|
114
|
+
|
115
|
+
expect(deliv.deliver_process.app.apple_id).to eq(464686641)
|
116
|
+
expect(deliv.deliver_process.app.app_identifier).to eq('at.felixkrause.iTanky')
|
117
|
+
expect(deliv.deliver_process.deploy_information.values.count).to eq(3)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "Let's the user specify which languages should be supported" do
|
121
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
122
|
+
|
123
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileLocales")
|
124
|
+
|
125
|
+
metadata = deliv.deliver_process.app.metadata
|
126
|
+
expect(metadata.fetch_value("//x:locale").count).to eq(3)
|
127
|
+
expect(metadata.fetch_value("//x:title").count).to eq(3)
|
128
|
+
|
129
|
+
expect(metadata.information['de-DE'][:title][:value]).to eq("Deutscher Titel")
|
130
|
+
expect(metadata.information['en-US'][:title][:value]).to eq("The ultimate iPhone app")
|
131
|
+
expect(metadata.information['en-GB'][:title][:value]).to eq("The ultimate iPhone app") # default language
|
132
|
+
|
133
|
+
expect(metadata.information['de-DE'][:version_whats_new][:value]).to eq("Deutscher Changelog")
|
134
|
+
expect(metadata.information['en-US'][:version_whats_new][:value]).to eq("Thanks for using this app")
|
135
|
+
expect(metadata.information['en-GB'][:version_whats_new][:value]).to eq("So british")
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "#load_config_json_folder" do
|
139
|
+
it "Correctly parses all the values for all the languages" do
|
140
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
141
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileMetadataJson")
|
142
|
+
|
143
|
+
expect(deliv.deliver_process.deploy_information[:title].values.count).to eq(2) # languages
|
144
|
+
expect(deliv.deliver_process.deploy_information[:title]['de-DE']).to eq("Mein App Titel")
|
145
|
+
expect(deliv.deliver_process.deploy_information[:title]['en-US']).to eq("My App Title")
|
146
|
+
expect(deliv.deliver_process.deploy_information[:description]['de-DE']).to eq("German Description")
|
147
|
+
expect(deliv.deliver_process.deploy_information[:description]['en-US']).to eq("English Description here")
|
148
|
+
expect(deliv.deliver_process.deploy_information[:keywords]['de-DE'].last).to eq("Tag1")
|
149
|
+
expect(deliv.deliver_process.deploy_information[:keywords]['en-US'].last).to eq("Keyword1")
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "Test Deliver Callback blocks" do
|
154
|
+
before do
|
155
|
+
path = "/tmp/"
|
156
|
+
@tests_path = "#{path}/deliver_unit_tests.txt"
|
157
|
+
@success_path = "#{path}/deliver_success.txt"
|
158
|
+
@error_path = "#{path}/deliver_error.txt"
|
159
|
+
paths = [@tests_path, @success_path, @error_path]
|
160
|
+
|
161
|
+
# Delete files from previous runs
|
162
|
+
paths.each do |current|
|
163
|
+
File.delete(current) if File.exists?current
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
it "Successful" do
|
168
|
+
expect(File.exists?@tests_path).to eq(false)
|
169
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
170
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt") # the ipa file
|
171
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileCallbacks")
|
172
|
+
expect(File.exists?@tests_path).to eq(true)
|
173
|
+
expect(File.exists?@success_path).to eq(true)
|
174
|
+
expect(File.exists?@error_path).to eq(false)
|
175
|
+
end
|
176
|
+
|
177
|
+
it "Error on ipa upload" do
|
178
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_valid.txt")
|
179
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_invalid.txt") # the ipa file
|
180
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileCallbacks")
|
181
|
+
expect(File.exists?@tests_path).to eq(true)
|
182
|
+
expect(File.exists?@success_path).to eq(false)
|
183
|
+
expect(File.exists?@error_path).to eq(true)
|
184
|
+
end
|
185
|
+
|
186
|
+
it "Error on app metadata upload" do
|
187
|
+
Deliver::ItunesTransporter.set_mock_file("spec/responses/transporter/upload_invalid.txt")
|
188
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileCallbacks")
|
189
|
+
expect(File.exists?@tests_path).to eq(true)
|
190
|
+
expect(File.exists?@success_path).to eq(false)
|
191
|
+
expect(File.exists?@error_path).to eq(true)
|
192
|
+
end
|
193
|
+
|
194
|
+
it "Error on unit tests" do
|
195
|
+
Deliver::ItunesTransporter.clear_mock_files # since we don't even download the metadata
|
196
|
+
|
197
|
+
expect(File.exists?@tests_path).to eq(false)
|
198
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileCallbacksFailingTests")
|
199
|
+
expect(File.exists?@tests_path).to eq(true)
|
200
|
+
expect(File.exists?@success_path).to eq(false)
|
201
|
+
expect(File.exists?@error_path).to eq(true)
|
202
|
+
end
|
203
|
+
|
204
|
+
it "Error on unit tests with no error block raises an exception" do
|
205
|
+
Deliver::ItunesTransporter.clear_mock_files # since we don't even download the metadata
|
206
|
+
expect {
|
207
|
+
deliv = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileCallbacksNoErrorBlock")
|
208
|
+
}.to raise_exception("Unit tests failed. Got result: 'false'. Need 'true' or 1 to succeed.".red)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
it "raises an exception if app identifier of ipa does not match the given one" do
|
214
|
+
expect {
|
215
|
+
meta = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileWrongIdentifier")
|
216
|
+
}.to raise_exception("App Identifier of IPA does not match with the given one ('net.sunapps.321' != 'at.felixkrause.iTanky')".red)
|
217
|
+
end
|
218
|
+
|
219
|
+
it "raises an exception if app version of ipa does not match the given one" do
|
220
|
+
expect {
|
221
|
+
meta = Deliver::Deliverer.new("./spec/fixtures/Deliverfiles/DeliverfileWrongVersion")
|
222
|
+
}.to raise_exception("App Version of IPA does not match with the given one (128378973 != 1.0)".red)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
ipa "./spec/fixtures/ipas/Example1.ipa"
|
2
|
+
|
3
|
+
unit_tests do
|
4
|
+
File.write('/tmp/deliver_unit_tests.txt', Time.now.to_i)
|
5
|
+
true # to indicate everything's alright
|
6
|
+
end
|
7
|
+
|
8
|
+
success do
|
9
|
+
File.write('/tmp/deliver_success.txt', Time.now.to_i)
|
10
|
+
end
|
11
|
+
|
12
|
+
error do
|
13
|
+
File.write('/tmp/deliver_error.txt', Time.now.to_i)
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
ipa "./spec/fixtures/ipas/Example1.ipa"
|
2
|
+
|
3
|
+
unit_tests do
|
4
|
+
File.write('/tmp/deliver_unit_tests.txt', Time.now.to_i)
|
5
|
+
false
|
6
|
+
end
|
7
|
+
|
8
|
+
success do
|
9
|
+
File.write('/tmp/deliver_success.txt', Time.now.to_i)
|
10
|
+
end
|
11
|
+
|
12
|
+
error do |exception|
|
13
|
+
File.write('/tmp/deliver_error.txt', exception)
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
version '943.0'
|
3
|
+
|
4
|
+
app_identifier 'net.sunapps.54'
|
5
|
+
apple_id 'id878567776'
|
6
|
+
|
7
|
+
changelog({
|
8
|
+
'en-US' => "Thanks for using this app",
|
9
|
+
'de-DE' => "Deutscher Changelog",
|
10
|
+
'en-GB' => "So british"
|
11
|
+
})
|
12
|
+
|
13
|
+
title({
|
14
|
+
'en-US' => "The ultimate iPhone app",
|
15
|
+
'de-DE' => "Deutscher Titel"
|
16
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
app_identifier "net.sunapps.1"
|
@@ -0,0 +1 @@
|
|
1
|
+
version "1.0"
|