produce 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c1c0a2d16abf2c211f538b3ac2d3d27c2e71a66
4
- data.tar.gz: ec587d863398c11fcfb3ca30a8f0dc62831d81c4
3
+ metadata.gz: d1d943a72c729b732c93e5296beff29dbfd8e8fc
4
+ data.tar.gz: ba189da362633a440c7c0fbaa0e0da8cd56135a9
5
5
  SHA512:
6
- metadata.gz: 7b06a6d825ea66c3c6a26be5997109290cbde812a4d634ae783021ea47355507e75429fd7f0ae6e3b8e4b4ae7d6600194c8cdef59316b0137f6c9cbb18c1344a
7
- data.tar.gz: f3689ba88738e7be220eb2064d4b73c3b6849b8d9d1ec092f2e3ff2ddb1021b10ed70821ce7feb12dcab3b094dee7d8529f20206d58f6e029ae0355dc1dbb98c
6
+ metadata.gz: 6be980fab023211da0f014da33865ab7a6e9eb4a9a4fa61b9a3e8bb831518ecc8306bab7a97118031e07ecfdf6fc6e74fedff986da48d3f6cecddf83bf4496c1
7
+ data.tar.gz: 628e138521cc5b6ac37e4b96bac9868b483689948ca44a2618ac97e695b0b16a1f308b6c210368234c6a48d9e72a019d707338a0d6a02a08791bd8b1f026cd69
data/README.md CHANGED
@@ -61,18 +61,31 @@ Get in contact with the developer on Twitter: [@KrauseFx](https://twitter.com/Kr
61
61
  # Installation
62
62
  sudo gem install produce
63
63
 
64
- Make sure, you have the latest version of the Xcode command line tools installed:
64
+ # Usage
65
65
 
66
- xcode-select --install
66
+ produce
67
+
68
+ # Parameters
67
69
 
68
- If you don't already have homebrew installed, [install it here](http://brew.sh/).
70
+ Get the latest list of all available parameters;
69
71
 
70
- # Usage
72
+ produce --help
71
73
 
72
- produce
74
+ ```
75
+ -u, --username STRING Your Apple ID Username (PRODUCE_USERNAME)
76
+ -b, --bundle_identifier STRING App Identifier (Bundle ID, e.g. com.krausefx.app) (PRODUCE_APP_IDENTIFIER)
77
+ -b, --bundle_identifier_suffix STRING App Identifier Suffix (Ignored if App Identifier does not ends with .*) (PRODUCE_APP_IDENTIFIER_SUFFIX)
78
+ -a, --app_name STRING App Name (PRODUCE_APP_IDENTIFIER)
79
+ -i, --initial_version STRING Initial version number (e.g. '1.0') (PRODUCE_VERSION)
80
+ -s, --sku STRING SKU Number (e.g. '1234') (PRODUCE_SKU)
81
+ -p, --primary_language STRING Primary Language (e.g. 'English', 'German') (PRODUCE_LANGUAGE)
82
+ -i, --skip_itc Skip the creation of the app on iTunes Connect (PRODUCE_SKIP_ITC)
83
+ -d, --skip_devcenter Skip the creation of the app on the Apple Developer Portal (PRODUCE_SKIP_DEVCENTER)
84
+ -h, --help Display help documentation
85
+ ```
73
86
 
74
87
  ## Environment Variables
75
- In case you want to pass more information to `produce`:
88
+ In case you want to pass more information to `produce` using environment variables:
76
89
 
77
90
  - `PRODUCE_USERNAME` (your iTunes Connect username)
78
91
  - `PRODUCE_APP_IDENTIFIER` (the bundle identifier of the new app)
@@ -83,22 +96,23 @@ In case you want to pass more information to `produce`:
83
96
  - `PRODUCE_SKIP_ITC` (should iTunes Connect app be created)
84
97
  - `PRODUCE_SKIP_DEVCENTER` (should Apple Developer Portal app be created)
85
98
  - `FASTLANE_TEAM_ID` (the Team ID, e.g. `Q2CBPK58CA`)
86
- - `FASTLANE_TEAM_NAME` (the Team Name, e.g. `Felix Krause`)
99
+ - `FASTLANE_TEAM_NAME` (the Team Name, e.g. `Felix Krause`)
100
+
87
101
 
88
102
  ## [`fastlane`](https://github.com/KrauseFx/fastlane) Integration
89
103
 
90
104
  Your `Fastfile` should look like this
91
105
  ```ruby
92
106
  lane :appstore do
93
- produce({
94
- produce_username: 'felix@krausefx.com',
95
- produce_app_identifier: 'com.krausefx.app',
96
- produce_app_name: 'MyApp',
97
- produce_language: 'English',
98
- produce_version: '1.0',
99
- produce_sku: 123,
100
- produce_team_name: 'SunApps GmbH' # only necessary when in multiple teams
101
- })
107
+ produce(
108
+ username: 'felix@krausefx.com',
109
+ app_identifier: 'com.krausefx.app',
110
+ app_name: 'MyApp',
111
+ language: 'English',
112
+ version: '1.0',
113
+ sku: 123,
114
+ team_name: 'SunApps GmbH' # only necessary when in multiple teams
115
+ )
102
116
 
103
117
  deliver
104
118
  end
@@ -112,16 +126,10 @@ apple_id ENV['PRODUCE_APPLE_ID']
112
126
 
113
127
  This will tell `deliver`, which `App ID` to use, since the app is not yet available in the App Store.
114
128
 
115
- # How does it work?
116
-
117
- ```produce``` will access the ```iOS Dev Center``` to create your `App ID`. Check out the full source code: [developer_center.rb](https://github.com/KrauseFx/produce/blob/master/lib/produce/developer_center.rb).
118
-
119
- After finishing the first step, `produce` will access `iTunes Connect` to create the new app with some initial values. Check out the full source code: [itunes_connect.rb](https://github.com/KrauseFx/produce/blob/master/lib/produce/itunes_connect.rb).
120
-
121
129
  You'll still have to fill out the remaining information (like screenshots, app description and pricing). You can use [deliver](https://github.com/KrauseFx/deliver) to upload your app metadata using a CLI
122
130
 
123
131
  ## How is my password stored?
124
- ```produce``` uses the [password manager](https://github.com/KrauseFx/CredentialsManager) from `fastlane`. Take a look the [CredentialsManager README](https://github.com/KrauseFx/CredentialsManager) for more information.
132
+ `produce` uses the [password manager](https://github.com/fastlane/CredentialsManager) from `fastlane`. Take a look the [CredentialsManager README](https://github.com/fastlane/CredentialsManager) for more information.
125
133
 
126
134
  # Tips
127
135
  ## [`fastlane`](https://fastlane.tools) Toolchain
data/bin/produce CHANGED
@@ -5,6 +5,7 @@ $:.push File.expand_path("../../lib", __FILE__)
5
5
  require 'produce'
6
6
  require 'commander'
7
7
  require 'credentials_manager/appfile_config'
8
+ require 'produce/options'
8
9
 
9
10
  HighLine.track_eof = false
10
11
 
@@ -21,26 +22,19 @@ class ProduceApplication
21
22
 
22
23
  always_trace!
23
24
 
24
- global_option('-u', '--username STRING', 'Your Apple ID username')
25
+ FastlaneCore::CommanderGenerator.new.generate(Produce::Options.available_options)
25
26
 
26
27
  command :create do |c|
27
28
  c.syntax = 'produce create'
28
29
  c.description = 'Creates a new app on iTunes Connect and the Apple Developer Portal'
29
30
 
30
31
  c.action do |args, options|
31
- set_username(options.username)
32
+ Produce.config = FastlaneCore::Configuration.create(Produce::Options.available_options, options.__hash__)
32
33
 
33
34
  puts Produce::Manager.start_producing
34
35
  end
35
36
  end
36
37
 
37
- def set_username(username)
38
- user = username
39
- user ||= ENV["PRODUCE_USERNAME"]
40
- user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
41
- CredentialsManager::PasswordManager.shared_manager(user) if user
42
- end
43
-
44
38
  default_command :create
45
39
 
46
40
  run!
@@ -4,8 +4,7 @@ require 'babosa'
4
4
  module Produce
5
5
  class DeveloperCenter
6
6
 
7
- def run(config)
8
- @config = config
7
+ def run
9
8
  login
10
9
  create_new_app
11
10
  end
@@ -14,14 +13,14 @@ module Produce
14
13
  ENV["CREATED_NEW_APP_ID"] = Time.now.to_i.to_s
15
14
 
16
15
  if app_exists?
17
- Helper.log.info "App '#{@config[:app_name]}' already exists, nothing to do on the Dev Center".green
16
+ Helper.log.info "App '#{Produce.config[:app_name]}' already exists, nothing to do on the Dev Center".green
18
17
  ENV["CREATED_NEW_APP_ID"] = nil
19
18
  # Nothing to do here
20
19
  else
21
- app_name = valid_name_for(@config[:app_name])
20
+ app_name = valid_name_for(Produce.config[:app_name])
22
21
  Helper.log.info "Creating new app '#{app_name}' on the Apple Dev Center".green
23
22
 
24
- app = Spaceship.app.create!(bundle_id: @config[:bundle_identifier].to_s,
23
+ app = Spaceship.app.create!(bundle_id: Produce.config[:bundle_identifier].to_s,
25
24
  name: app_name)
26
25
 
27
26
  Helper.log.info "Created app #{app.app_id}"
@@ -43,16 +42,11 @@ module Produce
43
42
 
44
43
  private
45
44
  def app_exists?
46
- Spaceship.app.find(@config[:bundle_identifier].to_s) != nil
45
+ Spaceship.app.find(Produce.config[:bundle_identifier].to_s) != nil
47
46
  end
48
47
 
49
48
  def login
50
- user = ENV["CERT_USERNAME"] || ENV["DELIVER_USER"] || CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
51
- manager = CredentialsManager::PasswordManager.shared_manager(user)
52
-
53
- ENV["FASTLANE_TEAM_NAME"] ||= ENV['PRODUCE_TEAM_NAME']
54
-
55
- Spaceship.login(user, manager.password)
49
+ Spaceship.login(Produce.config[:username], nil)
56
50
  Spaceship.select_team
57
51
  end
58
52
  end
@@ -1,148 +1,49 @@
1
- require 'fastlane_core/itunes_connect/itunes_connect'
1
+ require 'spaceship'
2
2
 
3
3
  module Produce
4
- # Every method you call here, might take a time
5
- class ItunesConnect < FastlaneCore::ItunesConnect
4
+ class ItunesConnect
6
5
 
7
- APPS_URL = "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app"
6
+ def run
7
+ @full_bundle_identifier = Produce.config[:bundle_identifier]
8
+ @full_bundle_identifier.gsub!('*', Produce.config[:bundle_identifier_suffix].to_s) if wildcard_bundle?
8
9
 
9
- NEW_APP_CLASS = ".new-button.ng-isolate-scope"
10
+ Spaceship::Tunes.login(Produce.config[:username], nil)
10
11
 
11
- def run(config)
12
- @config = config
13
- @full_bundle_identifier = config[:bundle_identifier].gsub('*', config[:bundle_identifier_suffix].to_s)
14
-
15
- if ENV["CREATED_NEW_APP_ID"].to_i > 0
16
- # We just created this App ID, this takes about 3 minutes to show up on iTunes Connect
17
- Helper.log.info "Waiting for 3 minutes to make sure, the App ID is synced to iTunes Connect".yellow
18
- sleep 180
19
-
20
- open_new_app_popup # for some reason, we have to refresh the page twice to get it working
21
- unless bundle_exist?
22
- Helper.log.info "Couldn't find new app yet, we're waiting for another 2 minutes.".yellow
23
- sleep 120
24
- end
25
- end
26
-
27
- return create_new_app
28
- rescue => ex
29
- error_occured(ex)
12
+ create_new_app
30
13
  end
31
14
 
32
15
  def create_new_app
33
- if app_exists?
34
- Helper.log.info "App '#{@config[:app_name]}' exists already, nothing to do on iTunes Connect".green
16
+ application = fetch_application
17
+ if application
18
+ Helper.log.info "App '#{Produce.config[:app_name]}' exists already (#{application.apple_id}), nothing to do on iTunes Connect".green
35
19
  # Nothing to do here
36
20
  else
37
- Helper.log.info "Creating new app '#{@config[:app_name]}' on iTunes Connect".green
38
-
39
- initial_create
40
-
41
- initial_pricing
42
-
43
- raise "Something went wrong when creating the new app - it's not listed in the App's list" unless app_exists?
44
-
45
- Helper.log.info "Finished creating new app '#{@config[:app_name]}' on iTunes Connect".green
46
- end
47
-
48
- return fetch_apple_id
49
- end
50
-
51
- def fetch_apple_id
52
- # First try it using the Apple API
53
- data = JSON.parse(open("https://itunes.apple.com/lookup?bundleId=#{@full_bundle_identifier}").read)
54
-
55
- if data['resultCount'] == 0 or true
56
- visit APPS_URL
57
- sleep 10
58
-
59
- first("input[ng-model='searchModel']").set @full_bundle_identifier
60
-
61
- if all("div[bo-bind='app.name']").count == 2
62
- raise "There were multiple results when looking for the new app. This might be due to having same app identifiers included in each other (see generated screenshots)".red
63
- end
64
-
65
- app_url = first("a[bo-href='appBundleLink(app.adamId, app.type)']")[:href]
66
- apple_id = app_url.split('/').last
67
-
68
- Helper.log.info "Found Apple ID #{apple_id}".green
69
- return apple_id
70
- else
71
- return data['results'].first['trackId'] # already in the store
72
- end
73
- end
74
-
75
- def initial_create
76
- open_new_app_popup
77
-
78
- # Fill out the initial information
79
- wait_for_elements("input[ng-model='createAppDetails.newApp.name.value']").first.set @config[:app_name]
80
- wait_for_elements("input[ng-model='createAppDetails.versionString.value']").first.set @config[:version]
81
- wait_for_elements("input[ng-model='createAppDetails.newApp.vendorId.value']").first.set @config[:sku]
82
- if not @config[:company_name].to_s.empty?
83
- Capybara.ignore_hidden_elements = false
84
- wait_for_elements("input[ng-model='createAppDetails.companyName.value']").first.set @config[:company_name]
85
- Capybara.ignore_hidden_elements = true
86
- end
87
-
88
- all(:xpath, "//option[text()='#{@config[:primary_language]}']").first.select_option
89
- wait_for_elements("option[value='#{@config[:bundle_identifier]}']").first.select_option
21
+ Helper.log.info "Creating new app '#{Produce.config[:app_name]}' on iTunes Connect".green
90
22
 
91
- if wildcard_bundle?
92
- wait_for_elements("input[ng-model='createAppDetails.newApp.bundleIdSuffix.value']").first.set @config[:bundle_identifier_suffix]
93
- end
94
-
95
- click_on "Create"
23
+ Produce.config[:bundle_identifier_suffix] = '' unless wildcard_bundle?
96
24
 
97
- sleep 5 # this usually takes some time
25
+ Spaceship::Tunes::Application.create!(name: Produce.config[:app_name],
26
+ primary_language: Produce.config[:primary_language],
27
+ version: Produce.config[:initial_version],
28
+ sku: Produce.config[:sku],
29
+ bundle_id: Produce.config[:bundle_identifier],
30
+ bundle_id_suffix: Produce.config[:bundle_identifier_suffix])
31
+ application = fetch_application
32
+ raise "Something went wrong when creating the new app - it's not listed in the App's list" unless application
98
33
 
99
- if all("p[ng-repeat='error in errorText']").count == 1
100
- raise all("p[ng-repeat='error in errorText']").first.text.to_s.red # an error when creating this app
34
+ Helper.log.info "Successfully created new app '#{Produce.config[:app_name]}' on iTunes Connect with ID #{application.apple_id}".green
101
35
  end
102
36
 
103
- wait_for_elements(".language.hasPopOver") # looking good
104
-
105
- Helper.log.info "Successfully created new app '#{@config[:app_name]}' on iTC. Setting up the initial information now.".green
106
- end
107
-
108
- def initial_pricing
109
- # It's not important here which is the price set. It will be updated by deliver
110
- sleep 3
111
- click_on "Pricing"
112
- first('#pricingPopup > option[value="0"]').select_option
113
- first('.saveChangesActionButton').click
37
+ return Spaceship::Application.find(@full_bundle_identifier).apple_id
114
38
  end
115
39
 
116
40
  private
117
- def bundle_exist?
118
- open_new_app_popup # to get the dropdown of available app identifier, if it's there, the app was not yet created
119
- sleep 4
120
-
121
- return (all("option[value='#{@config[:bundle_identifier]}']").count == 0)
122
- end
123
-
124
- def app_exists?
125
- visit APPS_URL
126
- sleep 10
127
-
128
- first("input[ng-model='searchModel']").set @full_bundle_identifier
129
-
130
- return (all("div[bo-bind='app.name']").count == 1)
41
+ def fetch_application
42
+ Spaceship::Application.find(@full_bundle_identifier)
131
43
  end
132
44
 
133
45
  def wildcard_bundle?
134
- return @config[:bundle_identifier].end_with?("*")
135
- end
136
-
137
- def open_new_app_popup
138
- visit APPS_URL
139
- sleep 8 # this usually takes some time
140
-
141
- wait_for_elements(NEW_APP_CLASS).first.click
142
- wait_for_elements('#new-menu > * > a').first.click # Create a new App
143
-
144
- sleep 5 # this usually takes some time - this is important
145
- wait_for_elements("input[ng-model='createAppDetails.newApp.name.value']") # finish loading
46
+ return Produce.config[:bundle_identifier].end_with?("*")
146
47
  end
147
48
  end
148
49
  end
@@ -1,11 +1,9 @@
1
1
  module Produce
2
2
  class Manager
3
3
  # Produces app at DeveloperCenter and ItunesConnect
4
- # @param config (Config) (optional) config to use. Will fallback to
5
- # config with ENV values if not specified.
6
- def self.start_producing(config = Config.new)
7
- Produce::DeveloperCenter.new.run(config) unless config[:skip_devcenter]
8
- return Produce::ItunesConnect.new.run(config) unless config[:skip_itc]
4
+ def self.start_producing
5
+ Produce::DeveloperCenter.new.run unless Produce.config[:skip_devcenter]
6
+ return Produce::ItunesConnect.new.run unless Produce.config[:skip_itc]
9
7
  end
10
8
  end
11
9
  end
@@ -0,0 +1,56 @@
1
+ require 'fastlane_core'
2
+ require 'credentials_manager'
3
+
4
+ module Produce
5
+ class Options
6
+ def self.available_options
7
+ @@options ||= [
8
+ FastlaneCore::ConfigItem.new(key: :username,
9
+ short_option: "-u",
10
+ env_name: "PRODUCE_USERNAME",
11
+ description: "Your Apple ID Username",
12
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:apple_id),
13
+ verify_block: Proc.new do |value|
14
+ CredentialsManager::PasswordManager.shared_manager(value)
15
+ end),
16
+ FastlaneCore::ConfigItem.new(key: :bundle_identifier,
17
+ env_name: "PRODUCE_APP_IDENTIFIER",
18
+ description: "App Identifier (Bundle ID, e.g. com.krausefx.app)",
19
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)),
20
+ FastlaneCore::ConfigItem.new(key: :bundle_identifier_suffix,
21
+ env_name: "PRODUCE_APP_IDENTIFIER_SUFFIX",
22
+ description: "App Identifier Suffix (Ignored if App Identifier does not ends with .*)"),
23
+ FastlaneCore::ConfigItem.new(key: :app_name,
24
+ env_name: "PRODUCE_APP_IDENTIFIER",
25
+ description: "App Name"),
26
+ FastlaneCore::ConfigItem.new(key: :initial_version,
27
+ env_name: "PRODUCE_VERSION",
28
+ description: "Initial version number (e.g. '1.0')"),
29
+ FastlaneCore::ConfigItem.new(key: :sku,
30
+ env_name: "PRODUCE_SKU",
31
+ description: "SKU Number (e.g. '1234')",
32
+ default_value: Time.now.to_i.to_s),
33
+ FastlaneCore::ConfigItem.new(key: :primary_language,
34
+ env_name: "PRODUCE_LANGUAGE",
35
+ description: "Primary Language (e.g. 'English', 'German')",
36
+ default_value: "English",
37
+ verify_block: Proc.new do |language|
38
+ raise "Please enter one of available languages: #{AvailableDefaultLanguages.all_languages}".red unless AvailableDefaultLanguages.all_languages.include?(language)
39
+ end),
40
+ FastlaneCore::ConfigItem.new(key: :skip_itc,
41
+ short_option: "-i",
42
+ env_name: "PRODUCE_SKIP_ITC",
43
+ description: "Skip the creation of the app on iTunes Connect",
44
+ is_string: false,
45
+ default_value: false),
46
+ FastlaneCore::ConfigItem.new(key: :skip_devcenter,
47
+ short_option: "-d",
48
+ env_name: "PRODUCE_SKIP_DEVCENTER",
49
+ description: "Skip the creation of the app on the Apple Developer Portal",
50
+ is_string: false,
51
+ default_value: false)
52
+
53
+ ]
54
+ end
55
+ end
56
+ end
@@ -1,3 +1,3 @@
1
1
  module Produce
2
- VERSION = "0.3.5"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/produce.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'json'
2
2
  require 'produce/version'
3
- require 'produce/config'
4
3
  require 'produce/manager'
5
4
  require 'produce/dependency_checker'
6
5
  require 'produce/developer_center'
@@ -10,9 +9,14 @@ require 'produce/available_default_languages'
10
9
  require 'fastlane_core'
11
10
 
12
11
  module Produce
12
+ class << self
13
+ attr_accessor :config
14
+ end
15
+
13
16
  Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
14
17
 
15
18
  ENV['FASTLANE_TEAM_ID'] ||= ENV["PRODUCE_TEAM_ID"]
19
+ ENV['DELIVER_USER'] ||= ENV["PRODUCE_USERNAME"]
16
20
 
17
21
  DependencyChecker.check_dependencies
18
22
  end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: produce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2015-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.7.6
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
26
  version: 0.7.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spaceship
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.10
33
+ version: 0.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.10
40
+ version: 0.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 3.1.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 3.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: yard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.8.7.4
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.8.7.4
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: webmock
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 1.19.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.19.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: codeclimate-test-reporter
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: Create new iOS apps on iTunes Connect and Dev Portal using the command
@@ -150,11 +150,11 @@ files:
150
150
  - bin/produce
151
151
  - lib/produce.rb
152
152
  - lib/produce/available_default_languages.rb
153
- - lib/produce/config.rb
154
153
  - lib/produce/dependency_checker.rb
155
154
  - lib/produce/developer_center.rb
156
155
  - lib/produce/itunes_connect.rb
157
156
  - lib/produce/manager.rb
157
+ - lib/produce/options.rb
158
158
  - lib/produce/version.rb
159
159
  homepage: https://fastlane.tools
160
160
  licenses:
@@ -166,17 +166,17 @@ require_paths:
166
166
  - lib
167
167
  required_ruby_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - '>='
169
+ - - ">="
170
170
  - !ruby/object:Gem::Version
171
171
  version: 2.0.0
172
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  requirements:
174
- - - '>='
174
+ - - ">="
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
178
  rubyforge_project:
179
- rubygems_version: 2.4.7
179
+ rubygems_version: 2.4.6
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: Create new iOS apps on iTunes Connect and Dev Portal using the command line
@@ -1,118 +0,0 @@
1
- module Produce
2
- class Config
3
- ASK_MESSAGES = {
4
- bundle_identifier: "App Identifier (Bundle ID, e.g. com.krausefx.app): ",
5
- bundle_identifier_suffix: "App Identifier Suffix (Ignored if App Identifier does not ends with .*): ",
6
- app_name: "App Name: ",
7
- version: "Initial version number (e.g. '1.0'): ",
8
- sku: "SKU Number (e.g. '1234'): ",
9
- primary_language: "Primary Language (e.g. 'English', 'German'): "
10
- }
11
-
12
- # Left to prevent fastlane from crashing. Should be removed upon version bump.
13
- def self.shared_config
14
- end
15
-
16
- # Creates new Config instance using ENV variables.
17
- # @param options (Hash) (optional) config options hash. If duplicates keys
18
- # specified by ENV variable, `options` has value will be used.
19
- # @return (Config) created Config instance
20
- def initialize(options = {})
21
- @config = env_options.merge(options)
22
- end
23
-
24
- # Retrieves the value for given `key`. If not found, will promt user with
25
- # `ASK_MESSAGES[key]` till gets valid response. Thus, always returns value.
26
- # Raises exception if given `key` is not Symbol or unknown.
27
- def val(key)
28
- raise "Please only pass symbols, no Strings to this method".red unless key.kind_of? Symbol
29
-
30
- # bundle_identifier_suffix can be set to empty string, if bundle_identifier is not a wildcard id
31
- # (does not end with '*'). bundle_identifier_suffix is ignored on non wildcard bundle_identifiers
32
- if key == :bundle_identifier_suffix
33
- unless @config[:bundle_identifier].end_with?("*")
34
- @config[key] = '' # set empty string, if no wildcard bundle_indentifiier
35
- end
36
- end
37
-
38
- return nil if key == :company_name
39
-
40
- unless @config.has_key?key
41
- @config[key] = ask(ASK_MESSAGES[key]) do |q|
42
- case key
43
- when :primary_language
44
- q.validate = lambda { |val| is_valid_language?(val) }
45
- q.responses[:not_valid] = "Please enter one of available languages: #{AvailableDefaultLanguages.all_languages}"
46
- else
47
- q.validate = lambda { |val| !val.empty? }
48
- q.responses[:not_valid] = "#{key.to_s.gsub('_', ' ').capitalize} can't be blank"
49
- end
50
- end
51
- end
52
-
53
- return @config[key]
54
- end
55
-
56
- # Aliases `[key]` to `val(key)` because Ruby can do it.
57
- alias_method :[], :val
58
-
59
- # Returns true if option for the given key is present.
60
- def has_key?(key)
61
- @config.has_key? key
62
- end
63
-
64
- private
65
-
66
- def env_options
67
- hash = {
68
- bundle_identifier: ENV['PRODUCE_APP_IDENTIFIER'],
69
- bundle_identifier_suffix: ENV['PRODUCE_APP_IDENTIFIER_SUFFIX'],
70
- app_name: ENV['PRODUCE_APP_NAME'],
71
- version: ENV['PRODUCE_VERSION'],
72
- sku: ENV['PRODUCE_SKU'] || Time.now.to_i.to_s,
73
- skip_itc: is_truthy?(ENV['PRODUCE_SKIP_ITC']),
74
- skip_devcenter: is_truthy?(ENV['PRODUCE_SKIP_DEVCENTER']),
75
- team_id: ENV['PRODUCE_TEAM_ID'],
76
- company_name: ENV['PRODUCE_COMPANY_NAME']
77
- }
78
-
79
- if ENV['PRODUCE_LANGUAGE']
80
- language = valid_language(ENV['PRODUCE_LANGUAGE'])
81
-
82
- if language.nil?
83
- unknown_language = ENV['PRODUCE_LANGUAGE']
84
- Helper.log.error "PRODUCE_LANGUAGE is set to #{unknown_language} but it's not one of available languages. You'll be asked to set language again if needed."
85
- else
86
- hash[:primary_language] = language
87
- end
88
- end
89
-
90
- hash[:bundle_identifier] ||= CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
91
- hash.delete_if { |key, value| value.nil? }
92
- hash
93
- end
94
-
95
-
96
- def is_valid_language?(language)
97
- AvailableDefaultLanguages.all_languages.include? language
98
- end
99
-
100
- def valid_language(language)
101
- AvailableDefaultLanguages.all_languages.each do |l|
102
-
103
- if l.casecmp(language) == 0
104
- return l
105
- end
106
-
107
- end
108
-
109
- return nil
110
- end
111
-
112
- # TODO: this could be moved inside fastlane_core
113
- def is_truthy?(value)
114
- %w( true t 1 yes y ).include? value.to_s.downcase
115
- end
116
-
117
- end
118
- end