sigh 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/bin/sigh +58 -50
- data/lib/sigh/developer_center.rb +49 -27
- data/lib/sigh/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 842fa29839a7bef24356403b43a1e71a4e86dca7
|
4
|
+
data.tar.gz: a8c3136908d566be66ed6475caf9930ca040df7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65bc97c43df673d449516cc962085a189bd62a26fa2aa367bf5e29121554ea0f30d5095215bb984db5a7cf7f31f192c9ff87f372942547087272aca4ccc0a320
|
7
|
+
data.tar.gz: fa01ff066816aa5686621374a5aab8ac4e4fb094fef5cd64f2f867f6969851a01da4e0c268acc06605e31b17ebbbf256fb41d9539daa8e41df85540411f5b3a6
|
data/README.md
CHANGED
@@ -121,6 +121,7 @@ In case you prefer environment variables:
|
|
121
121
|
- ```SIGH_USERNAME```
|
122
122
|
- ```SIGH_APP_IDENTIFIER```
|
123
123
|
- ```SIGH_TEAM_ID``` (The Team ID, e.g. `Q2CBPK58CA`)
|
124
|
+
- `SIGH_DISABLE_OPEN_ERROR` - in case of error, `sigh` won't open Preview with a screenshot of the error when this variable is set.
|
124
125
|
|
125
126
|
# How does it work?
|
126
127
|
|
@@ -128,7 +129,7 @@ In case you prefer environment variables:
|
|
128
129
|
|
129
130
|
|
130
131
|
## How is my password stored?
|
131
|
-
```sigh``` uses the password manager
|
132
|
+
```sigh``` 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
133
|
|
133
134
|
# Tips
|
134
135
|
## [`fastlane`](http://fastlane.tools) Toolchain
|
@@ -147,7 +148,7 @@ It will show you the ```mobileprovision``` files like this:
|
|
147
148
|
|
148
149
|
|
149
150
|
# Need help?
|
150
|
-
- If there is a technical problem with ```sigh```, submit an issue.
|
151
|
+
- If there is a technical problem with ```sigh```, submit an issue.
|
151
152
|
- I'm available for contract work - drop me an email: sigh@krausefx.com
|
152
153
|
|
153
154
|
# License
|
data/bin/sigh
CHANGED
@@ -3,71 +3,79 @@
|
|
3
3
|
$:.push File.expand_path("../../lib", __FILE__)
|
4
4
|
|
5
5
|
require 'sigh'
|
6
|
-
require 'commander
|
6
|
+
require 'commander'
|
7
7
|
require 'credentials_manager/password_manager'
|
8
8
|
require 'credentials_manager/appfile_config'
|
9
9
|
|
10
10
|
HighLine.track_eof = false
|
11
11
|
|
12
|
+
class SighApplication
|
13
|
+
include Commander::Methods
|
12
14
|
|
13
|
-
|
14
|
-
program :version, Sigh::VERSION
|
15
|
-
program :description, 'CLI for \'sigh\' - Because you would rather spend your time building stuff than fighting provisioning'
|
16
|
-
program :help, 'Author', 'Felix Krause <sigh@krausefx.com>'
|
17
|
-
program :help, 'Website', 'http://fastlane.tools'
|
18
|
-
program :help, 'GitHub', 'https://github.com/krausefx/sigh'
|
19
|
-
program :help_formatter, :compact
|
15
|
+
def run
|
16
|
+
program :version, Sigh::VERSION
|
17
|
+
program :description, 'CLI for \'sigh\' - Because you would rather spend your time building stuff than fighting provisioning'
|
18
|
+
program :help, 'Author', 'Felix Krause <sigh@krausefx.com>'
|
19
|
+
program :help, 'Website', 'http://fastlane.tools'
|
20
|
+
program :help, 'GitHub', 'https://github.com/krausefx/sigh'
|
21
|
+
program :help_formatter, :compact
|
20
22
|
|
21
|
-
|
23
|
+
always_trace!
|
22
24
|
|
25
|
+
global_option '--adhoc', 'By default, sigh will create and renew App Store profiles. Setting this flag will generate Adhoc profiles instead.'
|
26
|
+
global_option '--skip_install', 'By default, the certificate will be added on your local machine. Setting this flag will skip this action.'
|
27
|
+
global_option '--development', 'Renew the development certificate instead of the production one.'
|
23
28
|
|
24
|
-
|
25
|
-
|
26
|
-
|
29
|
+
global_option '-a', '--identifier STRING', String, 'The bundle identifier of your app.'
|
30
|
+
global_option '-u', '--username STRING', String, 'Your Apple ID username.'
|
31
|
+
global_option '-n', '--cert_name STRING', String, 'The name of the generated certificate file.'
|
32
|
+
global_option '-o', '--output STRING', String, 'The folder in which the file should be generated.'
|
27
33
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
c.option '-o', '--output STRING', String, 'The folder in which the file should be generated.'
|
32
|
-
c.option '--adhoc', 'By default, sigh will create and renew App Store profiles. Setting this flag will generate Adhoc profiles instead.'
|
33
|
-
c.option '--skip_install', 'By default, the certificate will be added on your local machine. Setting this flag will skip this action.'
|
34
|
-
c.option '--development', 'Renew the development certificate instead of the production one'
|
34
|
+
command :renew do |c|
|
35
|
+
c.syntax = 'sigh renew'
|
36
|
+
c.description = 'Renews the certificate (in case it expired) and outputs the path to the generated file'
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
c.action do |args, options|
|
39
|
+
app = app_identifier(options)
|
40
|
+
username(options)
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
42
|
+
type = Sigh::DeveloperCenter::APPSTORE
|
43
|
+
type = Sigh::DeveloperCenter::ADHOC if options.adhoc
|
44
|
+
type = Sigh::DeveloperCenter::DEVELOPMENT if options.development
|
45
|
+
|
46
|
+
path = Sigh::DeveloperCenter.new.run(app, type, options.cert_name)
|
47
|
+
|
48
|
+
if path
|
49
|
+
file_name = File.basename(path)
|
50
|
+
output_path = options.output || '.'
|
51
|
+
output = File.join(output_path.gsub("~", ENV["HOME"]), file_name)
|
52
|
+
FileUtils.mv(path, output)
|
53
|
+
system("open -g '#{output}'") unless options.skip_install
|
54
|
+
puts output.green
|
55
|
+
end
|
56
|
+
end
|
53
57
|
end
|
58
|
+
|
59
|
+
default_command :renew
|
60
|
+
|
61
|
+
run!
|
54
62
|
end
|
55
|
-
end
|
56
63
|
|
57
|
-
|
64
|
+
def username(options)
|
65
|
+
user = options.username
|
66
|
+
user ||= ENV["SIGH_USERNAME"]
|
67
|
+
user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
|
68
|
+
|
69
|
+
CredentialsManager::PasswordManager.shared_manager(user) if user
|
70
|
+
end
|
58
71
|
|
59
|
-
def
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
72
|
+
def app_identifier(options)
|
73
|
+
value = options.identifier
|
74
|
+
value ||= ENV["SIGH_APP_IDENTIFIER"]
|
75
|
+
value ||= CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
|
76
|
+
value ||= ask("App Identifier (Bundle ID, e.g. com.krausefx.app): ")
|
77
|
+
return value
|
78
|
+
end
|
65
79
|
end
|
66
80
|
|
67
|
-
|
68
|
-
value = options.identifier
|
69
|
-
value ||= ENV["SIGH_APP_IDENTIFIER"]
|
70
|
-
value ||= CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
|
71
|
-
value ||= ask("App Identifier (Bundle ID, e.g. com.krausefx.app): ")
|
72
|
-
return value
|
73
|
-
end
|
81
|
+
SighApplication.new.run
|
@@ -95,28 +95,7 @@ module Sigh
|
|
95
95
|
|
96
96
|
begin
|
97
97
|
if page.has_content?"Select Team" # If the user is not on multiple teams
|
98
|
-
|
99
|
-
unless team_id
|
100
|
-
Helper.log.info "You can store you preferred team using the environment variable `SIGH_TEAM_ID`".green
|
101
|
-
Helper.log.info "Your ID belongs to the following teams:".green
|
102
|
-
|
103
|
-
teams = find("div.input").all('.team-value') # Grab all the teams data
|
104
|
-
teams.each_with_index do |val, index|
|
105
|
-
team_text = val.find(".label-primary").text
|
106
|
-
description_text = val.find(".label-secondary").text
|
107
|
-
description_text = " (#{description_text})" unless description_text.empty? # Include the team description if any
|
108
|
-
Helper.log.info "\t#{index + 1}. #{team_text}#{description_text}".green # Print the team index and team name
|
109
|
-
end
|
110
|
-
|
111
|
-
team_index = ask("Please select the team number you would like to access: ".green)
|
112
|
-
team_id = teams[team_index.to_i - 1].find(".radio").value
|
113
|
-
end
|
114
|
-
|
115
|
-
first(:xpath, "//input[@type='radio' and @value='#{team_id}']").click # Select the desired team
|
116
|
-
all(".button.large.blue.submit").first.click
|
117
|
-
|
118
|
-
result = visit PROFILES_URL
|
119
|
-
raise "Could not open Developer Center" unless result['status'] == 'success'
|
98
|
+
select_team
|
120
99
|
end
|
121
100
|
rescue => ex
|
122
101
|
Helper.log.debug ex
|
@@ -144,6 +123,50 @@ module Sigh
|
|
144
123
|
end
|
145
124
|
end
|
146
125
|
|
126
|
+
|
127
|
+
def select_team
|
128
|
+
team_id = ENV["SIGH_TEAM_ID"]
|
129
|
+
team_id = nil if team_id.to_s.length == 0
|
130
|
+
|
131
|
+
unless team_id
|
132
|
+
Helper.log.info "You can store you preferred team using the environment variable `SIGH_TEAM_ID`".green
|
133
|
+
Helper.log.info "Your ID belongs to the following teams:".green
|
134
|
+
end
|
135
|
+
|
136
|
+
available_options = []
|
137
|
+
|
138
|
+
teams = find("div.input").all('.team-value') # Grab all the teams data
|
139
|
+
teams.each_with_index do |val, index|
|
140
|
+
current_team_id = '"' + val.find("input").value + '"'
|
141
|
+
team_text = val.find(".label-primary").text
|
142
|
+
description_text = val.find(".label-secondary").text
|
143
|
+
description_text = "(#{description_text})" unless description_text.empty? # Include the team description if any
|
144
|
+
index_text = (index + 1).to_s + "."
|
145
|
+
|
146
|
+
available_options << [index_text, current_team_id, team_text, description_text].join(" ")
|
147
|
+
end
|
148
|
+
|
149
|
+
unless team_id
|
150
|
+
puts available_options.join("\n").green
|
151
|
+
team_index = ask("Please select the team number you would like to access: ".green)
|
152
|
+
team_id = teams[team_index.to_i - 1].find(".radio").value
|
153
|
+
end
|
154
|
+
|
155
|
+
team_button = first(:xpath, "//input[@type='radio' and @value='#{team_id}']") # Select the desired team
|
156
|
+
if team_button
|
157
|
+
team_button.click
|
158
|
+
else
|
159
|
+
Helper.log.fatal "Could not find given Team. Available options: ".red
|
160
|
+
puts available_options.join("\n").yellow
|
161
|
+
raise DeveloperCenterLoginError.new("Error finding given team #{team_id}.".red)
|
162
|
+
end
|
163
|
+
|
164
|
+
all(".button.large.blue.submit").first.click
|
165
|
+
|
166
|
+
result = visit PROFILES_URL
|
167
|
+
raise "Could not open Developer Center" unless result['status'] == 'success'
|
168
|
+
end
|
169
|
+
|
147
170
|
def run(app_identifier, type, cert_name = nil)
|
148
171
|
cert = maintain_app_certificate(app_identifier, type)
|
149
172
|
|
@@ -248,7 +271,7 @@ module Sigh
|
|
248
271
|
# example: <option value="RGAWZGXSY4">ABP (5A997XSHK2.net.sunapps.34)</option>
|
249
272
|
identifiers = all(:xpath, "//option[contains(text(), '.#{app_identifier})')]")
|
250
273
|
if identifiers.count == 0
|
251
|
-
puts "Couldn't find App ID '#{app_identifier}'\nonly found:".red
|
274
|
+
puts "Couldn't find App ID '#{app_identifier}'\nonly found the following bundle identifiers:".red
|
252
275
|
all(:xpath, "//option").each do |current|
|
253
276
|
puts "\t- #{current.text}".yellow
|
254
277
|
end
|
@@ -419,7 +442,7 @@ module Sigh
|
|
419
442
|
def snap
|
420
443
|
path = "Error#{Time.now.to_i}.png"
|
421
444
|
save_screenshot(path, :full => true)
|
422
|
-
system("open '#{path}'")
|
445
|
+
system("open '#{path}'") unless ENV['SIGH_DISABLE_OPEN_ERROR']
|
423
446
|
end
|
424
447
|
|
425
448
|
def wait_for(method, parameter, success)
|
@@ -428,13 +451,12 @@ module Sigh
|
|
428
451
|
while !success.call(result)
|
429
452
|
sleep 0.2
|
430
453
|
|
431
|
-
|
454
|
+
result = method.call(parameter)
|
432
455
|
|
433
456
|
counter += 1
|
434
457
|
if counter > 100
|
435
|
-
Helper.log.debug page.html
|
436
458
|
Helper.log.debug caller
|
437
|
-
raise DeveloperCenterGeneralError.new("Couldn't find '#{
|
459
|
+
raise DeveloperCenterGeneralError.new("Couldn't find '#{parameter}' after waiting for quite some time")
|
438
460
|
end
|
439
461
|
end
|
440
462
|
return result
|
data/lib/sigh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sigh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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-01-
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|