fastlane_core 0.3.2 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40900d753085a834c2cfa5937013d4029d75dc98
4
- data.tar.gz: e612c02ad9fbbe28acb37d82e8ea0df371a01bb8
3
+ metadata.gz: 9ccf4f08791291dd023f402206d695a174c6b873
4
+ data.tar.gz: 5a569465403901927d8c5e272cb91ef90ec472de
5
5
  SHA512:
6
- metadata.gz: 2100653426c806d2679c4dfbeb452464a4b32fc13567f13d3faf211feb76f87dde1c840b34a14258f92faadcc46a95e4eed09bcaf729bc831530d492e23d5991
7
- data.tar.gz: a0fdc3f491176ca96abf207e3ffa40d8f0e3d7277526e5bbbd32f5be62d9c8490cfcf6653c195bd4c7b65f973951ae80f7aa5c8ba7e13fbcd1eaec0c6fd6a3c8
6
+ metadata.gz: 40f82c13159a33eba36923b21745a62ca225f4e071e42ce28dcd1693344be5c2ac47e205503f9018744606cc0f0886fb1d17186494ebf906095f15c874928f01
7
+ data.tar.gz: d801fbfa0ce0128ef1bd3a8c693032c78047910ddcc400c3e101222c01826901aeb70a9fdf0d206551de7f74eb4bdcf4bed57ae800e4dd03a97f8ca610cdaa41
@@ -51,134 +51,5 @@ module FastlaneCore
51
51
 
52
52
  self.login
53
53
  end
54
-
55
- # Loggs in a user with the given login data on the Dev Center Frontend.
56
- # You don't need to pass a username and password. It will
57
- # Automatically be fetched using the {CredentialsManager::PasswordManager}.
58
- # This method will also automatically be called when triggering other
59
- # actions like {#open_app_page}
60
- # @param user (String) (optional) The username/email address
61
- # @param password (String) (optional) The password
62
- # @return (bool) true if everything worked fine
63
- # @raise [DeveloperCenterGeneralError] General error while executing
64
- # this action
65
- # @raise [DeveloperCenterLoginError] Login data is wrong
66
- def login(user = nil, password = nil)
67
- begin
68
- Helper.log.info "Login into iOS Developer Center"
69
-
70
- user ||= CredentialsManager::PasswordManager.shared_manager.username
71
- password ||= CredentialsManager::PasswordManager.shared_manager.password
72
-
73
- result = visit PROFILES_URL
74
- raise "Could not open Developer Center" unless result['status'] == 'success'
75
-
76
- # Already logged in
77
- select_team if current_url.include?"selectTeam.action"
78
- return true if (page.has_content? "Member Center" and not current_url.include?"selectTeam.action")
79
-
80
- (wait_for_elements(".button.blue").first.click rescue nil) # maybe already logged in
81
-
82
- (wait_for_elements('#accountpassword') rescue nil) # when the user is already logged in, this will raise an exception
83
-
84
- # Already logged in
85
- select_team if current_url.include?"selectTeam.action"
86
- return true if (page.has_content? "Member Center" and not current_url.include?"selectTeam.action")
87
-
88
- fill_in "accountname", with: user
89
- fill_in "accountpassword", with: password
90
-
91
- all(".button.large.blue.signin-button").first.click
92
-
93
- begin
94
- # If the user is not on multiple teams
95
- select_team if current_url.include?"selectTeam.action"
96
- rescue => ex
97
- Helper.log.debug ex
98
- raise DeveloperCenterLoginError.new("Error loggin in user #{user}. User is on multiple teams and we were unable to correctly retrieve them.")
99
- end
100
-
101
- begin
102
- wait_for_elements('.ios.profiles.gridList')
103
- visit PROFILES_URL # again, since after the login, the dev center loses the production GET value
104
- rescue => ex
105
- Helper.log.debug ex
106
- if page.has_content?"Getting Started"
107
- raise "There was no valid signing certificate found. Please log in and follow the 'Getting Started guide' on '#{current_url}'".red
108
- else
109
- raise DeveloperCenterLoginError.new("Error logging in user #{user} with the given password. Make sure you entered them correctly.")
110
- end
111
- end
112
-
113
- Helper.log.info "Login successful"
114
-
115
- true
116
- rescue => ex
117
- error_occured(ex)
118
- end
119
- end
120
-
121
-
122
- def select_team
123
- team_id = ENV["FASTLANE_TEAM_ID"] || CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
124
-
125
- team_name = ENV["FASTLANE_TEAM_NAME"] || CredentialsManager::AppfileConfig.try_fetch_value(:team_name)
126
-
127
- if team_id == nil and team_name == nil
128
- Helper.log.info "You can store you preferred team using the environment variable `FASTLANE_TEAM_ID` or `FASTLANE_TEAM_NAME`".green
129
- Helper.log.info "or in your `Appfile` using `team_id 'Q2CBPJ58CA'` or `team_name 'Felix Krause'`".green # TODO
130
- Helper.log.info "Your ID belongs to the following teams:".green
131
- end
132
-
133
- available_options = []
134
-
135
- teams = find("div.input").all('.team-value') # Grab all the teams data
136
- teams.each_with_index do |val, index|
137
- current_team_id = '"' + val.find("input").value + '"'
138
- team_text = val.find(".label-primary").text
139
- description_text = val.find(".label-secondary").text
140
- description_text = "(#{description_text})" unless description_text.empty? # Include the team description if any
141
- index_text = (index + 1).to_s + "."
142
-
143
- available_options << [index_text, current_team_id, team_text, description_text].join(" ")
144
- end
145
-
146
- if team_name
147
- # Search for name
148
- found_it = false
149
- all("label.label-primary").each do |current|
150
- if current.text.downcase.gsub(/\s+/, "") == team_name.downcase.gsub(/\s+/, "")
151
- current.click # select the team by name
152
- found_it = true
153
- end
154
- end
155
-
156
- unless found_it
157
- available_teams = all("label.label-primary").collect { |a| a.text }
158
- raise DeveloperCenterLoginError.new("Could not find Team with name '#{team_name}'. Available Teams: #{available_teams}".red)
159
- end
160
- else
161
- # Search by ID/Index
162
- unless team_id
163
- puts available_options.join("\n").green
164
- team_index = ask("Please select the team number you would like to access: ".green)
165
- team_id = teams[team_index.to_i - 1].find(".radio").value
166
- end
167
-
168
- team_button = first(:xpath, "//input[@type='radio' and @value='#{team_id}']") # Select the desired team
169
- if team_button
170
- team_button.click
171
- else
172
- Helper.log.fatal "Could not find given Team. Available options: ".red
173
- puts available_options.join("\n").yellow
174
- raise DeveloperCenterLoginError.new("Error finding given team #{team_id}.".red)
175
- end
176
- end
177
-
178
- all(".button.large.blue.submit").first.click
179
-
180
- result = visit PROFILES_URL
181
- raise "Could not open Developer Center" unless result['status'] == 'success'
182
- end
183
54
  end
184
55
  end
@@ -8,13 +8,13 @@ module FastlaneCore
8
8
  host = Capybara.current_session.current_host
9
9
  url = [host, url].join('')
10
10
 
11
- cookieString = ""
11
+ cookie_string = ""
12
12
 
13
13
  page.driver.cookies.each do |key, cookie|
14
- cookieString << "#{cookie.name}=#{cookie.value};" # append all known cookies
14
+ cookie_string << "#{cookie.name}=#{cookie.value};" # append all known cookies
15
15
  end
16
16
 
17
- data = open(url, {'Cookie' => cookieString}).read
17
+ data = open(url, {'Cookie' => cookie_string}).read
18
18
 
19
19
  raise "Something went wrong when downloading the file from the Dev Center" unless data
20
20
  Helper.log.info "Successfully downloaded provisioning profile"
@@ -1,5 +1,132 @@
1
1
  module FastlaneCore
2
2
  class DeveloperCenter
3
+ # Log in a user with the given login data on the Dev Center Frontend.
4
+ # You don't need to pass a username and password. It will
5
+ # Automatically be fetched using the {CredentialsManager::PasswordManager}.
6
+ # This method will also automatically be called when triggering other
7
+ # actions like {#open_app_page}
8
+ # @param user (String) (optional) The username/email address
9
+ # @param password (String) (optional) The password
10
+ # @return (bool) true if everything worked fine
11
+ # @raise [DeveloperCenterGeneralError] General error while executing
12
+ # this action
13
+ # @raise [DeveloperCenterLoginError] Login data is wrong
14
+ def login(user = nil, password = nil)
15
+ begin
16
+ Helper.log.info "Login into iOS Developer Center"
3
17
 
18
+ user ||= CredentialsManager::PasswordManager.shared_manager.username
19
+ password ||= CredentialsManager::PasswordManager.shared_manager.password
20
+
21
+ result = visit PROFILES_URL
22
+ raise "Could not open Developer Center" unless result['status'] == 'success'
23
+
24
+ # Already logged in
25
+ select_team if current_url.include?"selectTeam.action"
26
+ return true if (page.has_content? "Member Center" and not current_url.include?"selectTeam.action")
27
+
28
+ (wait_for_elements(".button.blue").first.click rescue nil) # maybe already logged in
29
+
30
+ (wait_for_elements('#accountpassword') rescue nil) # when the user is already logged in, this will raise an exception
31
+
32
+ # Already logged in
33
+ select_team if current_url.include?"selectTeam.action"
34
+ return true if (page.has_content? "Member Center" and not current_url.include?"selectTeam.action")
35
+
36
+ fill_in "accountname", with: user
37
+ fill_in "accountpassword", with: password
38
+
39
+ all(".button.large.blue.signin-button").first.click
40
+
41
+ begin
42
+ # If the user is not on multiple teams
43
+ select_team if current_url.include?"selectTeam.action"
44
+ rescue => ex
45
+ Helper.log.debug ex
46
+ raise DeveloperCenterLoginError.new("Error loggin in user #{user}. User is on multiple teams and we were unable to correctly retrieve them.")
47
+ end
48
+
49
+ begin
50
+ wait_for_elements('.ios.profiles.gridList')
51
+ visit PROFILES_URL # again, since after the login, the dev center loses the production GET value
52
+ rescue => ex
53
+ Helper.log.debug ex
54
+ if page.has_content?"Getting Started"
55
+ raise "There was no valid signing certificate found. Please log in and follow the 'Getting Started guide' on '#{current_url}'".red
56
+ else
57
+ raise DeveloperCenterLoginError.new("Error logging in user #{user} with the given password. Make sure you entered them correctly.")
58
+ end
59
+ end
60
+
61
+ Helper.log.info "Login successful"
62
+
63
+ true
64
+ rescue => ex
65
+ error_occured(ex)
66
+ end
67
+ end
68
+
69
+
70
+ def select_team
71
+ team_id = ENV["FASTLANE_TEAM_ID"] || CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
72
+
73
+ team_name = ENV["FASTLANE_TEAM_NAME"] || CredentialsManager::AppfileConfig.try_fetch_value(:team_name)
74
+
75
+ if team_id == nil and team_name == nil
76
+ Helper.log.info "You can store you preferred team using the environment variable `FASTLANE_TEAM_ID` or `FASTLANE_TEAM_NAME`".green
77
+ Helper.log.info "or in your `Appfile` using `team_id 'Q2CBPJ58CA'` or `team_name 'Felix Krause'`".green # TODO
78
+ Helper.log.info "Your ID belongs to the following teams:".green
79
+ end
80
+
81
+ available_options = []
82
+
83
+ teams = find("div.input").all('.team-value') # Grab all the teams data
84
+ teams.each_with_index do |val, index|
85
+ current_team_id = '"' + val.find("input").value + '"'
86
+ team_text = val.find(".label-primary").text
87
+ description_text = val.find(".label-secondary").text
88
+ description_text = "(#{description_text})" unless description_text.empty? # Include the team description if any
89
+ index_text = (index + 1).to_s + "."
90
+
91
+ available_options << [index_text, current_team_id, team_text, description_text].join(" ")
92
+ end
93
+
94
+ if team_name
95
+ # Search for name
96
+ found_it = false
97
+ all("label.label-primary").each do |current|
98
+ if current.text.downcase.gsub(/\s+/, "") == team_name.downcase.gsub(/\s+/, "")
99
+ current.click # select the team by name
100
+ found_it = true
101
+ end
102
+ end
103
+
104
+ unless found_it
105
+ available_teams = all("label.label-primary").collect { |a| a.text }
106
+ raise DeveloperCenterLoginError.new("Could not find Team with name '#{team_name}'. Available Teams: #{available_teams}".red)
107
+ end
108
+ else
109
+ # Search by ID/Index
110
+ unless team_id
111
+ puts available_options.join("\n").green
112
+ team_index = ask("Please select the team number you would like to access: ".green)
113
+ team_id = teams[team_index.to_i - 1].find(".radio").value
114
+ end
115
+
116
+ team_button = first(:xpath, "//input[@type='radio' and @value='#{team_id}']") # Select the desired team
117
+ if team_button
118
+ team_button.click
119
+ else
120
+ Helper.log.fatal "Could not find given Team. Available options: ".red
121
+ puts available_options.join("\n").yellow
122
+ raise DeveloperCenterLoginError.new("Error finding given team #{team_id}.".red)
123
+ end
124
+ end
125
+
126
+ all(".button.large.blue.submit").first.click
127
+
128
+ result = visit PROFILES_URL
129
+ raise "Could not open Developer Center" unless result['status'] == 'success'
130
+ end
4
131
  end
5
132
  end
@@ -3,6 +3,10 @@ require 'open-uri'
3
3
  module FastlaneCore
4
4
  # Verifies, the user runs the latest version of this gem
5
5
  class UpdateChecker
6
+
7
+ # This web service is fully open source: https://github.com/fastlane/refresher
8
+ UPDATE_URL = "https://refresher.fastlane.tools/"
9
+
6
10
  # This method will check if the latest version is installed and show a warning if that's not the case
7
11
  def self.verify_latest_version(gem_name, current_version)
8
12
  return true unless self.update_available?(gem_name, current_version)
@@ -32,7 +36,8 @@ module FastlaneCore
32
36
 
33
37
  private
34
38
  def self.fetch_latest(gem_name)
35
- JSON.parse(open("http://rubygems.org/api/v1/gems/#{gem_name}.json").read)["version"]
39
+ url = UPDATE_URL + gem_name
40
+ JSON.parse(open(url).read)["version"]
36
41
  end
37
42
  end
38
43
  end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
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-03-20 00:00:00.000000000 Z
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json