sigh 1.8.0 → 1.9.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: 2d5af70020fddc9626153f04cbee13842dfd87ee
4
- data.tar.gz: e06070ef70768fff055194025f35045c3a5f67e3
3
+ metadata.gz: c8c93a0e5c801a079a07a5a326116afaa05ea2bc
4
+ data.tar.gz: 4cfe60d72c538349e7de40cd240250256f662ab3
5
5
  SHA512:
6
- metadata.gz: 7fbe6f5cf2b574e19ced821a6dced4a7d7df48024e3ec244d9c44e57dd1c939b6a29768b46f319fc9b9ef802d0da10e326d9248f3d5855ef270d8f99fda8c422
7
- data.tar.gz: 7618fdc40f2b722f4a2ad1364059ab9f9d8456e5c5c3856d9a6b2b9d66b13eedae3d75b9bdc7a253bd3794263c298a9e996fd0a2a3e95bcda239451a115a22a0
6
+ metadata.gz: 4ba497d825600cb7d09e66035f9174a609982e361eb233eb91b9bc2064b9e72b78510f62bcc90f8c1ce72c4b21518ca00b15d4935d6bd3da31b6aa6830ef0af8
7
+ data.tar.gz: e5dafb86dadf2f85a1eb5ed47b0b82cc50e4985986b79655392c2a428e3fe79baa99b1db91cb95ae4ad51b3297b862597a370d7d8d7b99a38f7d1f21d2687c12
data/README.md CHANGED
@@ -184,7 +184,7 @@ If you generated your `ipa` file but want to apply a different code signing onto
184
184
 
185
185
  You can pass more information using the command line:
186
186
 
187
- sigh resign ./path/app.ipa --signing_identity "iPhone Distribution: Felix Krause" -n "my.mobileprovision"
187
+ sigh resign ./path/app.ipa --signing_identity "iPhone Distribution: Felix Krause" -p "my.mobileprovision"
188
188
 
189
189
  # Manage
190
190
 
data/bin/sigh CHANGED
@@ -1,120 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  $:.push File.expand_path("../../lib", __FILE__)
4
3
 
5
4
  require 'sigh'
6
- require 'commander'
7
- require 'credentials_manager/appfile_config'
8
- require 'sigh/options'
9
- require 'sigh/manager'
10
- require 'sigh/local_manage'
11
-
12
- HighLine.track_eof = false
13
-
14
- class SighApplication
15
- include Commander::Methods
16
-
17
- def run
18
- program :version, Sigh::VERSION
19
- program :description, 'CLI for \'sigh\' - Because you would rather spend your time building stuff than fighting provisioning'
20
- program :help, 'Author', 'Felix Krause <sigh@krausefx.com>'
21
- program :help, 'Website', 'https://fastlane.tools'
22
- program :help, 'GitHub', 'https://github.com/fastlane/sigh'
23
- program :help_formatter, :compact
24
-
25
- global_option('--verbose') { $verbose = true }
26
-
27
- FastlaneCore::CommanderGenerator.new.generate(Sigh::Options.available_options)
28
-
29
- command :renew do |c|
30
- c.syntax = 'sigh renew'
31
- c.description = 'Renews the certificate (in case it expired) and outputs the path to the generated file'
32
-
33
- c.action do |args, options|
34
- Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__)
35
- Sigh::Manager.start
36
- end
37
- end
38
-
39
- command :download_all do |c|
40
- c.syntax = 'sigh download_all'
41
- c.description = 'Downloads all valid provisioning profiles'
42
-
43
- c.action do |args, options|
44
- Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__)
45
- Sigh::Manager.download_all
46
- end
47
- end
48
-
49
- command :repair do |c|
50
- c.syntax = 'sigh repair'
51
- c.description = 'Repairs all expired or invalid provisioning profiles'
52
-
53
- c.action do |args, options|
54
- Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__)
55
- require 'sigh/repair'
56
- Sigh::Repair.new.repair_all
57
- end
58
- end
59
-
60
- command :resign do |c|
61
- c.syntax = 'sigh resign'
62
- c.description = 'Resigns an existing ipa file with the given provisioning profile'
63
- c.option '-i', '--signing_identity STRING', String, 'The signing identity to use. Must match the one defined in the provisioning profile.'
64
- c.option '-x', '--version_number STRING', String, 'Version number to force binary and all nested binaries to use. Changes both CFBundleShortVersionString and CFBundleIdentifier.'
65
- c.option '-p', '--provisioning_profile PATH', String, '(or BUNDLE_ID=PATH) The path to the provisioning profile which should be used. '\
66
- 'Can be provided multiple times if the application contains nested applications and app extensions, which need their own provisioning profile. '\
67
- 'The path may be prefixed with a identifier in order to determine which provisioning profile should be used on which app.',
68
- &multiple_values_option_proc(c, "provisioning_profile", &proc { |value| value.split('=', 2) })
69
- c.option '-d', '--display_name STRING', String, 'Display name to use'
70
- c.option '-e', '--entitlements PATH', String, 'The path to the entitlements file to use.'
71
- c.option '--short-version STRING', String, 'Short version string to force binary to use (CFBundleShortVersionString). '\
72
- '\nCannot be used together with -x|--version_number option.'
73
- c.option '--bundle-version STRING', String, 'Bundle version to force binary and all nested binaries to use (CFBundleIdentifier). '\
74
- 'Cannot be used together with -x|--version_number option.'
75
- c.option '-g', '--new_bundle_id STRING', String, 'New application bundle ID'
76
-
77
- c.action do |args, options|
78
- Sigh::Resign.new.run(options, args)
79
- end
80
- end
81
-
82
- command :manage do |c|
83
- c.syntax = 'sigh manage'
84
- c.description = 'Manage installed provisioning profiles on your system.'
85
-
86
- c.option '-f', '--force', 'Force remove all expired provisioning profiles. Required on CI.'
87
- c.option '-e', '--clean_expired', 'Remove all expired provisioning profiles.'
88
-
89
- c.option '-p', '--clean_pattern STRING', String, 'Remove any provisioning profiles that matches the regular expression.'
90
- c.example 'Remove all "iOS Team Provisioning" provisioning profiles', 'sigh manage -p "iOS\ ?Team Provisioning Profile"'
91
-
92
- c.action do |args, options|
93
- Sigh::LocalManage.start(options, args)
94
- end
95
- end
96
-
97
- default_command :renew
98
-
99
- run!
100
- end
101
-
102
- def multiple_values_option_proc(command, name)
103
- proc do |value|
104
- value = yield(value) if block_given?
105
- option = command.proxy_options.find { |opt| opt[0] == name } || []
106
- values = option[1] || []
107
- values << value
108
-
109
- command.proxy_options.delete option
110
- command.proxy_options << [name, values]
111
- end
112
- end
113
- end
114
-
115
- begin
116
- FastlaneCore::UpdateChecker.start_looking_for_update('sigh')
117
- SighApplication.new.run
118
- ensure
119
- FastlaneCore::UpdateChecker.show_update_status('sigh', Sigh::VERSION)
120
- end
5
+ require 'sigh/commands_generator'
6
+ Sigh::CommandsGenerator.start
data/lib/sigh.rb CHANGED
@@ -1,9 +1,9 @@
1
+ require 'fastlane_core'
1
2
  require 'sigh/version'
2
3
  require 'sigh/resign'
3
4
  require 'sigh/manager'
4
5
  require 'sigh/options'
5
-
6
- require 'fastlane_core'
6
+ require 'sigh/local_manage'
7
7
 
8
8
  module Sigh
9
9
  # Use this to just setup the configuration attribute and set it later somewhere else
@@ -0,0 +1,113 @@
1
+ require 'commander'
2
+
3
+ HighLine.track_eof = false
4
+
5
+ module Sigh
6
+ class CommandsGenerator
7
+ include Commander::Methods
8
+
9
+ def self.start
10
+ FastlaneCore::UpdateChecker.start_looking_for_update('sigh')
11
+ self.new.run
12
+ ensure
13
+ FastlaneCore::UpdateChecker.show_update_status('sigh', Sigh::VERSION)
14
+ end
15
+
16
+ # rubocop:disable Metrics/MethodLength
17
+ def run
18
+ program :version, Sigh::VERSION
19
+ program :description, 'CLI for \'sigh\' - Because you would rather spend your time building stuff than fighting provisioning'
20
+ program :help, 'Author', 'Felix Krause <sigh@krausefx.com>'
21
+ program :help, 'Website', 'https://fastlane.tools'
22
+ program :help, 'GitHub', 'https://github.com/fastlane/sigh'
23
+ program :help_formatter, :compact
24
+
25
+ global_option('--verbose') { $verbose = true }
26
+
27
+ FastlaneCore::CommanderGenerator.new.generate(Sigh::Options.available_options)
28
+
29
+ command :renew do |c|
30
+ c.syntax = 'sigh renew'
31
+ c.description = 'Renews the certificate (in case it expired) and outputs the path to the generated file'
32
+
33
+ c.action do |args, options|
34
+ Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__)
35
+ Sigh::Manager.start
36
+ end
37
+ end
38
+
39
+ command :download_all do |c|
40
+ c.syntax = 'sigh download_all'
41
+ c.description = 'Downloads all valid provisioning profiles'
42
+
43
+ c.action do |args, options|
44
+ Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__)
45
+ Sigh::Manager.download_all
46
+ end
47
+ end
48
+
49
+ command :repair do |c|
50
+ c.syntax = 'sigh repair'
51
+ c.description = 'Repairs all expired or invalid provisioning profiles'
52
+
53
+ c.action do |args, options|
54
+ Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__)
55
+ require 'sigh/repair'
56
+ Sigh::Repair.new.repair_all
57
+ end
58
+ end
59
+
60
+ command :resign do |c|
61
+ c.syntax = 'sigh resign'
62
+ c.description = 'Resigns an existing ipa file with the given provisioning profile'
63
+ c.option '-i', '--signing_identity STRING', String, 'The signing identity to use. Must match the one defined in the provisioning profile.'
64
+ c.option '-x', '--version_number STRING', String, 'Version number to force binary and all nested binaries to use. Changes both CFBundleShortVersionString and CFBundleIdentifier.'
65
+ c.option '-p', '--provisioning_profile PATH', String, '(or BUNDLE_ID=PATH) The path to the provisioning profile which should be used. '\
66
+ 'Can be provided multiple times if the application contains nested applications and app extensions, which need their own provisioning profile. '\
67
+ 'The path may be prefixed with a identifier in order to determine which provisioning profile should be used on which app.',
68
+ &multiple_values_option_proc(c, "provisioning_profile", &proc { |value| value.split('=', 2) })
69
+ c.option '-d', '--display_name STRING', String, 'Display name to use'
70
+ c.option '-e', '--entitlements PATH', String, 'The path to the entitlements file to use.'
71
+ c.option '--short_version STRING', String, 'Short version string to force binary and all nested binaries to use (CFBundleShortVersionString).'
72
+ c.option '--bundle_version STRING', String, 'Bundle version to force binary and all nested binaries to use (CFBundleIdentifier).'
73
+ c.option '-g', '--new_bundle_id STRING', String, 'New application bundle ID'
74
+
75
+ c.action do |args, options|
76
+ Sigh::Resign.new.run(options, args)
77
+ end
78
+ end
79
+
80
+ command :manage do |c|
81
+ c.syntax = 'sigh manage'
82
+ c.description = 'Manage installed provisioning profiles on your system.'
83
+
84
+ c.option '-f', '--force', 'Force remove all expired provisioning profiles. Required on CI.'
85
+ c.option '-e', '--clean_expired', 'Remove all expired provisioning profiles.'
86
+
87
+ c.option '-p', '--clean_pattern STRING', String, 'Remove any provisioning profiles that matches the regular expression.'
88
+ c.example 'Remove all "iOS Team Provisioning" provisioning profiles', 'sigh manage -p "iOS\ ?Team Provisioning Profile"'
89
+
90
+ c.action do |args, options|
91
+ Sigh::LocalManage.start(options, args)
92
+ end
93
+ end
94
+
95
+ default_command :renew
96
+
97
+ run!
98
+ end
99
+ # rubocop:enable Metrics/MethodLength
100
+
101
+ def multiple_values_option_proc(command, name)
102
+ proc do |value|
103
+ value = yield(value) if block_given?
104
+ option = command.proxy_options.find { |opt| opt[0] == name } || []
105
+ values = option[1] || []
106
+ values << value
107
+
108
+ command.proxy_options.delete option
109
+ command.proxy_options << [name, values]
110
+ end
111
+ end
112
+ end
113
+ end
@@ -41,6 +41,7 @@ module Sigh
41
41
  return command, clean_expired, clean_pattern, force
42
42
  end
43
43
 
44
+ # rubocop:disable Metrics/AbcSize
44
45
  def self.list_profiles
45
46
  profiles = load_profiles
46
47
 
@@ -83,6 +84,7 @@ module Sigh
83
84
 
84
85
  UI.message "You can remove all expired profiles using `sigh manage -e`" if profiles_expired.count > 0
85
86
  end
87
+ # rubocop:enable Metrics/AbcSize
86
88
 
87
89
  def self.profile_info(profile)
88
90
  if $verbose
data/lib/sigh/resign.rb CHANGED
@@ -8,7 +8,9 @@ module Sigh
8
8
 
9
9
  ipa, signing_identity, provisioning_profiles, entitlements, version, display_name, short_version, bundle_version, new_bundle_id = get_inputs(options, args)
10
10
  # ... then invoke our programmatic interface with these vars
11
- resign(ipa, signing_identity, provisioning_profiles, entitlements, version, display_name, short_version, bundle_version, new_bundle_id)
11
+ unless resign(ipa, signing_identity, provisioning_profiles, entitlements, version, display_name, short_version, bundle_version, new_bundle_id)
12
+ UI.user_error!("Failed to re-sign .ipa")
13
+ end
12
14
  end
13
15
 
14
16
  def self.resign(ipa, signing_identity, provisioning_profiles, entitlements, version, display_name, short_version, bundle_version, new_bundle_id)
@@ -92,7 +94,7 @@ module Sigh
92
94
  end
93
95
 
94
96
  def find_signing_identity(signing_identity)
95
- until installed_identies.include?(signing_identity)
97
+ until (signing_identity = sha1_for_signing_identity(signing_identity))
96
98
  UI.error "Couldn't find signing identity '#{signing_identity}'."
97
99
  signing_identity = ask_for_signing_identity
98
100
  end
@@ -100,6 +102,12 @@ module Sigh
100
102
  signing_identity
101
103
  end
102
104
 
105
+ def sha1_for_signing_identity(signing_identity)
106
+ identities = installed_identities
107
+ return signing_identity if identities.keys.include?(signing_identity)
108
+ identities.key(signing_identity)
109
+ end
110
+
103
111
  def validate_params(resign_path, ipa, provisioning_profiles)
104
112
  validate_resign_path(resign_path)
105
113
  validate_ipa_file(ipa)
@@ -121,7 +129,7 @@ module Sigh
121
129
  end
122
130
 
123
131
  def print_available_identities
124
- UI.message "Available identities: \n\t#{installed_identies.join("\n\t")}\n"
132
+ UI.message "Available identities: \n\t#{installed_identity_descriptions.join("\n\t")}\n"
125
133
  end
126
134
 
127
135
  def ask_for_signing_identity
@@ -129,13 +137,15 @@ module Sigh
129
137
  ask('Signing Identity: ')
130
138
  end
131
139
 
132
- # Array of available signing identities
133
- def installed_identies
134
- available = `security find-identity -v -p codesigning`
135
- ids = []
140
+ # Hash of available signing identities
141
+ def installed_identities
142
+ available = request_valid_identities
143
+ ids = {}
136
144
  available.split("\n").each do |current|
137
145
  begin
138
- (ids << current.match(/.*\"(.*)\"/)[1])
146
+ sha1 = current.match(/[a-zA-Z0-9]{40}/).to_s
147
+ name = current.match(/.*\"(.*)\"/)[1]
148
+ ids[sha1] = name
139
149
  rescue
140
150
  nil
141
151
  end # the last line does not match
@@ -143,5 +153,21 @@ module Sigh
143
153
 
144
154
  ids
145
155
  end
156
+
157
+ def request_valid_identities
158
+ `security find-identity -v -p codesigning`
159
+ end
160
+
161
+ def installed_identity_descriptions
162
+ descriptions = []
163
+ installed_identities.group_by { |sha1, name| name }.each do |name, identities|
164
+ descriptions << name
165
+ # Show SHA-1 for homonymous identities
166
+ descriptions += identities.map do |sha1, _|
167
+ "\t#{sha1}"
168
+ end
169
+ end
170
+ descriptions
171
+ end
146
172
  end
147
173
  end
data/lib/sigh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sigh
2
- VERSION = "1.8.0"
2
+ VERSION = "1.9.0"
3
3
  end
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: 1.8.0
4
+ version: 1.9.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: 2016-05-05 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 0.22.0
53
+ version: 0.29.1
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
56
  version: 1.0.0
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 0.22.0
63
+ version: 0.29.1
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
66
  version: 1.0.0
@@ -218,6 +218,7 @@ files:
218
218
  - bin/sigh
219
219
  - lib/assets/resign.sh
220
220
  - lib/sigh.rb
221
+ - lib/sigh/commands_generator.rb
221
222
  - lib/sigh/download_all.rb
222
223
  - lib/sigh/local_manage.rb
223
224
  - lib/sigh/manager.rb