sigh 0.10.9 → 1.0.0.beta1

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: a5dc6b164cf1f7c66faf07c4850b4bc81f0008ec
4
- data.tar.gz: 3e61f24ee369c977db38442c3453a32b754705e0
3
+ metadata.gz: 5bd071805139ebac24b44afa6957387eafdc0801
4
+ data.tar.gz: bb57df6ea7f50a5fc228ea1b009172eda00bbef5
5
5
  SHA512:
6
- metadata.gz: f84ddc547cf0b8c2b567e4dbce9e8b129f979e40f86a14e7c3f50990c5cf9c9437ad653ecd369741761ad89461f699069856fc6b848fd764abb9b596bc153554
7
- data.tar.gz: 25571d3e6b5948376913df6a56225fab94a8962dfbbb7d6e38fd8033ddef1c11fe210e9622a39c2d2327a7fe7943e2da37565f8dc364aef3d5334e89a66101f4
6
+ metadata.gz: d179f1f7b811cdbc04a3af74b4f4315ab48da99ee7c0888fc52ffdb20289fbacbfbb59649713f50c2ecb8830447603aeb97fd556e88d8c34a44e22203fc14d70
7
+ data.tar.gz: cb7894b2121b114200a37b11b1c0b0f7aabfbaa7eed56d87cd54947cfaf6b901514894ecd3942ea81374104bb2b855de46d2580250fe72dd9c19147529ab8550
data/README.md CHANGED
@@ -13,12 +13,7 @@
13
13
  <b>sigh</b> &bull;
14
14
  <a href="https://github.com/KrauseFx/produce">produce</a> &bull;
15
15
  <a href="https://github.com/KrauseFx/cert">cert</a> &bull;
16
- <a href="https://github.com/KrauseFx/codes">codes</a> &bull;
17
- <a href="https://github.com/fastlane/spaceship">spaceship</a> &bull;
18
- <a href="https://github.com/fastlane/pilot">pilot</a> &bull;
19
- <a href="https://github.com/fastlane/boarding">boarding</a> &bull;
20
- <a href="https://github.com/fastlane/gym">gym</a>
21
-
16
+ <a href="https://github.com/KrauseFx/codes">codes</a>
22
17
  </p>
23
18
  -------
24
19
 
@@ -56,6 +51,7 @@ Special thanks to [Matthias Tretter](https://twitter.com/myell0w) for coming up
56
51
 
57
52
  <h5 align="center"><code>sigh</code> is part of <a href="https://fastlane.tools">fastlane</a>: connect all deployment tools into one streamlined workflow.</h5>
58
53
 
54
+
59
55
  # Features
60
56
 
61
57
  - **Download** the latest provisioning profile for your app
@@ -112,11 +108,7 @@ To generate the profile in a specific directory:
112
108
 
113
109
  sigh -o "~/Certificates/"
114
110
 
115
- To download all your provisioning profiles use
116
-
117
- sigh download_all
118
-
119
- For a list of available parameters and commands run
111
+ For a list of available commands run
120
112
 
121
113
  sigh --help
122
114
 
@@ -126,30 +118,21 @@ By default, ```sigh``` will install the downloaded profile on your machine. If y
126
118
 
127
119
  sigh --skip_install
128
120
 
129
- To save the provisioning profile under a specific name, use the -q option:
121
+ To save the provisioning profile under a specific name, use the -f option:
130
122
 
131
- sigh -a com.krausefx.app -u username -q "myProfile.mobileprovision"
123
+ sigh -a com.krausefx.app -u username -f "myProfile.mobileprovision"
132
124
 
133
125
  If you need the provisioning profile to be renewed regardless of its state use the `--force` option. This gives you a profile with the maximum lifetime. `--force` will also add all available devices to this profile.
134
126
 
135
127
  sigh --force
136
128
 
137
- By default, `sigh` will include all certificates on development profiles, and first certificate on other types. If you need to specify which certificate to use you can either use the environment variable `SIGH_CERTIFICATE`, or pass the name or expiry date of the certificate as argument:
129
+ By default, ```sigh``` will include all certificates on development profiles, and first certificate on other types. If you need to specify which certificate to use you can either use the environment variable `SIGH_CERTIFICATE`, or pass the name or expiry date of the certificate as argument:
138
130
 
139
131
  sigh -c "SunApps GmbH"
140
132
 
141
- For a list of available parameters and commands run
142
-
143
- sigh --help
144
-
145
- # Repair
146
-
147
- `sigh` can automatically repair all your existing provisioning profiles which are expired or just invalid.
148
-
149
- All you have to do is
150
-
151
- sigh repair
133
+ Or identify be expire date if you're using the same names for multiple certificates
152
134
 
135
+ sigh -d "Nov 11, 2017"
153
136
 
154
137
  # Resign
155
138
 
@@ -190,8 +173,7 @@ Choose signing certificate to use:
190
173
 
191
174
  - `SIGH_CERTIFICATE` (The name of the certificate to use)
192
175
  - `SIGH_CERTIFICATE_ID` (The ID of the certificate)
193
-
194
- As always, run `sigh --help` to get a list of all variables.
176
+ - `SIGH_CERTIFICATE_EXPIRE_DATE` (The expire date of the certificate)
195
177
 
196
178
  If you're using [cert](https://github.com/KrauseFx/cert) in combination with [fastlane](https://github.com/KrauseFx/fastlane) the signing certificate will automatically be selected for you. (make sure to run `cert` before `sigh`)
197
179
 
@@ -199,49 +181,45 @@ If you're using [cert](https://github.com/KrauseFx/cert) in combination with [fa
199
181
 
200
182
  # How does it work?
201
183
 
202
- `sigh` will access the `iOS Dev Center` to download, renew or generate the `.mobileprovision` file. It uses [spaceship](https://spaceship.airforce) to communicate with Apple's web services.
184
+ ```sigh``` will access the ```iOS Dev Center``` to download, renew or generate the ```.mobileprovision``` file. Check out the full source code: [developer_center.rb](https://github.com/KrauseFx/sigh/blob/master/lib/sigh/developer_center.rb).
203
185
 
204
186
 
205
187
  ## How is my password stored?
206
- `sigh` uses the [CredentialsManager](https://github.com/fastlane/CredentialsManager) from `fastlane`.
188
+ ```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.
207
189
 
208
190
  # Tips
209
191
  ## [`fastlane`](https://fastlane.tools) Toolchain
210
192
 
211
193
  - [`fastlane`](https://fastlane.tools): Connect all deployment tools into one streamlined workflow
212
- - [`deliver`](https://github.com/KrauseFx/deliver): Upload screenshots, metadata and your app to the App Store
194
+ - [`deliver`](https://github.com/KrauseFx/deliver): Upload screenshots, metadata and your app to the App Store using a single command
213
195
  - [`snapshot`](https://github.com/KrauseFx/snapshot): Automate taking localized screenshots of your iOS app on every device
214
196
  - [`frameit`](https://github.com/KrauseFx/frameit): Quickly put your screenshots into the right device frames
215
197
  - [`PEM`](https://github.com/KrauseFx/pem): Automatically generate and renew your push notification profiles
216
198
  - [`produce`](https://github.com/KrauseFx/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
217
199
  - [`cert`](https://github.com/KrauseFx/cert): Automatically create and maintain iOS code signing certificates
218
200
  - [`codes`](https://github.com/KrauseFx/codes): Create promo codes for iOS Apps using the command line
219
- - [`spaceship`](https://github.com/fastlane/spaceship): Ruby library to access the Apple Dev Center and iTunes Connect
220
- - [`pilot`](https://github.com/fastlane/pilot): The best way to manage your TestFlight testers and builds from your terminal
221
- - [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
222
- - [`gym`](https://github.com/fastlane/gym): Building your iOS apps has never been easier
223
-
224
201
 
225
202
  ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
226
203
 
227
204
  ## Use the 'Provisioning Quicklook plugin'
228
205
  Download and install the [Provisioning Plugin](https://github.com/chockenberry/Provisioning).
229
206
 
230
- It will show you the `mobileprovision` files like this:
207
+ It will show you the ```mobileprovision``` files like this:
231
208
  ![assets/QuickLookScreenshot.png](assets/QuickLookScreenshot.png)
232
209
 
233
- ## App Identifier couldn't be found
234
-
235
- If you also want to create a new App Identifier on the Apple Developer Portal, check out [produce](https://github.com/fastlane/produce), which does exactly that.
236
-
237
- ## What happens to my Xcode managed profiles?
238
-
239
- `sigh` will never touch or use the profiles which are created and managed by Xcode. Instead `sigh` will manage its own set of provisioning profiles.
240
210
 
241
211
  # Need help?
242
- Please submit an issue on GitHub and provide information about your setup
212
+ - If there is a technical problem with ```sigh```, submit an issue.
213
+ - I'm available for contract work - drop me an email: sigh@krausefx.com
243
214
 
244
215
  # License
245
216
  This project is licensed under the terms of the MIT license. See the LICENSE file.
246
217
 
247
- > This project and all fastlane tools are in no way affiliated with Apple Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs. All fastlane tools run on your own computer or server, so your credentials or other sensitive information will never leave your own computer. You are responsible for how you use fastlane tools.
218
+ # Contributing
219
+
220
+ 1. Create an issue to start a discussion about your idea
221
+ 2. Fork it (https://github.com/KrauseFx/sigh/fork)
222
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
223
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
224
+ 5. Push to the branch (`git push origin my-new-feature`)
225
+ 6. Create a new Pull Request
data/bin/sigh CHANGED
@@ -23,6 +23,8 @@ class SighApplication
23
23
  program :help, 'GitHub', 'https://github.com/krausefx/sigh'
24
24
  program :help_formatter, :compact
25
25
 
26
+ always_trace!
27
+
26
28
  FastlaneCore::CommanderGenerator.new.generate(Sigh::Options.available_options)
27
29
 
28
30
  command :renew do |c|
@@ -35,27 +37,6 @@ class SighApplication
35
37
  end
36
38
  end
37
39
 
38
- command :download_all do |c|
39
- c.syntax = 'sigh download_all'
40
- c.description = 'Downloads all valid provisioning profiles'
41
-
42
- c.action do |args, options|
43
- Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__)
44
- Sigh::Manager.download_all
45
- end
46
- end
47
-
48
- command :repair do |c|
49
- c.syntax = 'sigh repair'
50
- c.description = 'Repairs all expired or invalid provisioning profiles'
51
-
52
- c.action do |args, options|
53
- Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__)
54
- require 'sigh/repair'
55
- Sigh::Repair.new.repair_all
56
- end
57
- end
58
-
59
40
  command :resign do |c|
60
41
  c.syntax = 'sigh resign'
61
42
  c.description = 'Resigns an existing ipa file with the given provisioning profile'
@@ -70,7 +51,7 @@ class SighApplication
70
51
  command :manage do |c|
71
52
  c.syntax = 'sigh manage'
72
53
  c.description = 'Manage installed provisioning profiles on your system.'
73
-
54
+
74
55
  c.option '-e', '--clean_expired', 'Remove all expired provisioning profiles.'
75
56
 
76
57
  c.option '-p', '--clean_pattern STRING', String, 'Remove any provisioning profiles that matches the regular expression.'
@@ -85,6 +66,7 @@ class SighApplication
85
66
 
86
67
  run!
87
68
  end
69
+
88
70
  end
89
71
 
90
72
  begin
data/lib/assets/resign.sh CHANGED
@@ -362,18 +362,13 @@ else
362
362
  # checkStatus -- if this fails it's likely because the keychain-access-groups key does not exist, so we have nothing to update
363
363
  if [[ "$CERTIFICATE" == *Distribution* ]]; then
364
364
  IS_ENTERPRISE_PROFILE=`PlistBuddy -c "Print :ProvisionsAllDevices" "$TEMP_DIR/profile.plist" | tr -d '\n'`
365
- ADHOC_PROVISIONING_DEVICES=`PlistBuddy -c "Print :ProvisionedDevices" "$TEMP_DIR/profile.plist" | tr -d '\n'`
366
365
 
367
366
  echo "Assuming Distribution Identity"
368
367
  if [ "$ADJUST_BETA_REPORTS_ACTIVE_FLAG" == "1" ]; then
369
368
  if [ "$IS_ENTERPRISE_PROFILE" == "true" ]; then
370
369
  echo "Ensuring beta-reports-active is not included for Enterprise environment"
371
- PlistBuddy -c "Delete :beta-reports-active" "$TEMP_DIR/newEntitlements" || true
372
- # checkStatus -- this can fail is beta-reports-active isn't present, which is OK
373
- elif [ -n "$ADHOC_PROVISIONING_DEVICES" ]; then
374
- echo "Ensuring beta-reports-active is not included for Adhoc environment"
375
- PlistBuddy -c "Delete :beta-reports-active" "$TEMP_DIR/newEntitlements" || true
376
- # checkStatus -- this can fail is beta-reports-active isn't present, which is OK
370
+ PlistBuddy -c "Delete :beta-reports-active" "$TEMP_DIR/newEntitlements"
371
+ checkStatus
377
372
  else
378
373
  echo "Ensuring beta-reports-active is present and enabled"
379
374
  # new beta key is only used for Distribution; might not exist yet, if we were building Development
data/lib/sigh.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  require 'sigh/version'
2
2
  require 'sigh/dependency_checker'
3
3
  require 'sigh/resign'
4
- require 'sigh/manager'
5
-
6
4
  require 'fastlane_core'
7
5
 
8
6
  module Sigh
@@ -5,7 +5,7 @@ module Sigh
5
5
  end
6
6
 
7
7
  def self.check_xcode_select
8
- unless `xcode-select -v`.include? "xcode-select version "
8
+ unless `xcode-select -v`.include?"xcode-select version "
9
9
  Helper.log.fatal '#############################################################'
10
10
  Helper.log.fatal "# You have to install the Xcode commdand line tools to use sigh"
11
11
  Helper.log.fatal "# Install the latest version of Xcode from the AppStore"
@@ -15,4 +15,4 @@ module Sigh
15
15
  end
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -26,21 +26,20 @@ module Sigh
26
26
  # copy to Xcode provisioning profile directory
27
27
  FileUtils.copy profile, destination
28
28
 
29
- if File.exist? destination
29
+ if File.exists? destination
30
30
  Helper.log.info "Profile installed at \"#{destination}\""
31
31
  else
32
32
  raise "Failed installation of provisioning profile at location: #{destination}".red
33
33
  end
34
34
  end
35
35
 
36
- def self.get_inputs(options, _args)
36
+ def self.get_inputs(options, args)
37
37
  clean_expired = options.clean_expired
38
38
  clean_pattern = /#{options.clean_pattern}/ if options.clean_pattern
39
- command = (!clean_expired.nil? || !clean_pattern.nil?) ? CLEANUP : LIST
39
+ command = (clean_expired != nil || clean_pattern != nil) ? CLEANUP : LIST
40
40
  return command, clean_expired, clean_pattern
41
41
  end
42
42
 
43
- # rubocop:disable Metrics/AbcSize
44
43
  def self.list_profiles
45
44
  profiles = load_profiles
46
45
 
@@ -64,7 +63,7 @@ module Sigh
64
63
  Helper.log.info profile["Name"].yellow
65
64
  end
66
65
  end
67
-
66
+
68
67
  profiles_expired = profiles.select { |profile| profile["ExpirationDate"] < now }
69
68
  if profiles_expired.count > 0
70
69
  Helper.log.info ""
@@ -73,7 +72,7 @@ module Sigh
73
72
  Helper.log.info profile["Name"].red
74
73
  end
75
74
  end
76
-
75
+
77
76
  Helper.log.info ""
78
77
  Helper.log.info "Summary"
79
78
  Helper.log.info "#{profiles.count} installed profiles"
@@ -83,12 +82,11 @@ module Sigh
83
82
 
84
83
  Helper.log.info "You can remove all expired profiles using `sigh manage -e`" if profiles_expired.count > 0
85
84
  end
86
- # rubocop:enable Metrics/AbcSize
87
85
 
88
86
  def self.cleanup_profiles(expired = false, pattern = nil)
89
87
  now = DateTime.now
90
88
 
91
- profiles = load_profiles.select { |profile| (expired && profile["ExpirationDate"] < now) || (!pattern.nil? && profile["Name"] =~ pattern) }
89
+ profiles = load_profiles.select { |profile| (expired && profile["ExpirationDate"] < now) || (pattern != nil && profile["Name"] =~ pattern) }
92
90
 
93
91
  Helper.log.info "The following provisioning profiles are either expired or matches your pattern:"
94
92
  profiles.each do |profile|
@@ -110,14 +108,14 @@ module Sigh
110
108
 
111
109
  profiles = []
112
110
  profile_paths.each do |profile_path|
113
- profile = Plist.parse_xml(`security cms -D -i '#{profile_path}'`)
111
+ profile = Plist::parse_xml(`security cms -D -i '#{profile_path}'`)
114
112
  profile['Path'] = profile_path
115
113
  profiles << profile
116
114
  end
117
115
 
118
- profiles = profiles.sort_by { |profile| profile["Name"].downcase }
116
+ profiles = profiles.sort_by {|profile| profile["Name"].downcase}
119
117
 
120
118
  return profiles
121
119
  end
122
120
  end
123
- end
121
+ end
data/lib/sigh/manager.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require 'plist'
2
- require 'sigh/runner'
2
+ require 'sigh/spaceship/runner'
3
3
 
4
4
  module Sigh
5
5
  class Manager
6
6
  def self.start
7
+ start = Time.now
7
8
  path = Sigh::Runner.new.run
8
9
 
9
10
  return nil unless path
@@ -14,12 +15,8 @@ module Sigh
14
15
  file_name = File.basename(path)
15
16
  end
16
17
 
17
- output = File.join(File.expand_path(Sigh.config[:output_path]), file_name)
18
- begin
19
- FileUtils.mv(path, output)
20
- rescue
21
- # in case it already exists
22
- end
18
+ output = File.join(Sigh.config[:output_path].gsub("~", ENV["HOME"]), file_name)
19
+ (FileUtils.mv(path, output) rescue nil) # in case it already exists
23
20
 
24
21
  install_profile(output) unless Sigh.config[:skip_install]
25
22
 
@@ -28,16 +25,25 @@ module Sigh
28
25
  return File.expand_path(output)
29
26
  end
30
27
 
31
- def self.download_all
32
- require 'sigh/download_all'
33
- DownloadAll.new.download_all
34
- end
35
-
36
28
  def self.install_profile(profile)
37
- udid = FastlaneCore::ProvisioningProfile.uuid(profile)
38
- ENV["SIGH_UDID"] = udid if udid
29
+ Helper.log.info "Installing provisioning profile..."
30
+ profile_path = File.expand_path("~") + "/Library/MobileDevice/Provisioning Profiles/"
31
+ profile_filename = ENV["SIGH_UDID"] + ".mobileprovision"
32
+ destination = profile_path + profile_filename
33
+
34
+ # If the directory doesn't exist, make it first
35
+ unless File.directory?(profile_path)
36
+ FileUtils.mkdir_p(profile_path)
37
+ end
39
38
 
40
- FastlaneCore::ProvisioningProfile.install(profile)
39
+ # copy to Xcode provisioning profile directory
40
+ (FileUtils.copy profile, destination rescue nil) # if the directory doesn't exist yet
41
+
42
+ if File.exists? destination
43
+ Helper.log.info "Profile successfully installed".green
44
+ else
45
+ raise "Failed installation of provisioning profile at location: #{destination}".red
46
+ end
41
47
  end
42
48
  end
43
49
  end
data/lib/sigh/options.rb CHANGED
@@ -35,24 +35,17 @@ module Sigh
35
35
  short_option: "-u",
36
36
  env_name: "SIGH_USERNAME",
37
37
  description: "Your Apple ID Username",
38
- default_value: CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)),
38
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:apple_id),
39
+ verify_block: Proc.new do |value|
40
+ CredentialsManager::PasswordManager.shared_manager(value)
41
+ end),
39
42
  FastlaneCore::ConfigItem.new(key: :team_id,
40
- short_option: "-b",
43
+ short_option: "-t",
41
44
  env_name: "SIGH_TEAM_ID",
42
45
  description: "The ID of your team if you're in multiple teams",
43
46
  optional: true,
44
- default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id),
45
- verify_block: proc do |value|
46
- ENV["FASTLANE_TEAM_ID"] = value
47
- end),
48
- FastlaneCore::ConfigItem.new(key: :team_name,
49
- short_option: "-l",
50
- env_name: "SIGH_TEAM_NAME",
51
- description: "The name of your team if you're in multiple teams",
52
- optional: true,
53
- default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_name),
54
- verify_block: proc do |value|
55
- ENV["FASTLANE_TEAM_NAME"] = value
47
+ verify_block: Proc.new do |value|
48
+ ENV["FASTLANE_TEAM_ID"] = value
56
49
  end),
57
50
  FastlaneCore::ConfigItem.new(key: :provisioning_name,
58
51
  short_option: "-n",
@@ -64,8 +57,8 @@ module Sigh
64
57
  env_name: "SIGH_OUTPUT_PATH",
65
58
  description: "Directory in which the profile should be stored",
66
59
  default_value: ".",
67
- verify_block: proc do |value|
68
- raise "Could not find output directory '#{value}'".red unless File.exist?(value)
60
+ verify_block: Proc.new do |value|
61
+ raise "Could not find output directory '#{value}'".red unless File.exists?(value)
69
62
  end),
70
63
  FastlaneCore::ConfigItem.new(key: :cert_id,
71
64
  short_option: "-i",
@@ -77,26 +70,19 @@ module Sigh
77
70
  env_name: "SIGH_CERTIFICATE",
78
71
  description: "The certificate name to use for new profiles, or to renew with. (e.g. \"Felix Krause\")",
79
72
  optional: true),
73
+ FastlaneCore::ConfigItem.new(key: :cert_date,
74
+ short_option: "-d",
75
+ env_name: "SIGH_CERTIFICATE_EXPIRE_DATE",
76
+ description: "The certificate with the given expiry date used to renew. (e.g. \"Nov 11, 2017\")",
77
+ optional: true),
80
78
  FastlaneCore::ConfigItem.new(key: :filename,
81
- short_option: "-q",
79
+ short_option: "-f",
82
80
  env_name: "SIGH_PROFILE_FILE_NAME",
83
81
  optional: true,
84
82
  description: "Filename to use for the generated provisioning profile (must include .mobileprovision)",
85
- verify_block: proc do |value|
86
- raise "The output name must end with .mobileprovision".red unless value.end_with? ".mobileprovision"
87
- end),
88
- FastlaneCore::ConfigItem.new(key: :skip_fetch_profiles,
89
- env_name: "SIGH_SKIP_FETCH_PROFILES",
90
- description: "Skips the verification of existing profiles which is useful if you have thousands of profiles",
91
- is_string: false,
92
- default_value: false,
93
- short_option: "-w"),
94
- FastlaneCore::ConfigItem.new(key: :skip_certificate_verification,
95
- short_option: '-z',
96
- env_name: "SIGH_SKIP_CERTIFICATE_VERIFICATION",
97
- description: "Skips the verification of the certificates for every existing profiles. This will make sure the provisioning profile can be used on the local machine",
98
- is_string: false,
99
- default_value: false)
83
+ verify_block: Proc.new do |value|
84
+ raise "The output name must end with .mobileprovision".red unless value.end_with?".mobileprovision"
85
+ end)
100
86
  ]
101
87
  end
102
88
  end
@@ -0,0 +1,15 @@
1
+ require 'plist'
2
+
3
+ module Sigh
4
+ class ProfileAnalyser
5
+ def self.run(path)
6
+ plist = Plist::parse_xml(`security cms -D -i '#{path}'`)
7
+ if plist.count > 10
8
+ Helper.log.info("Provisioning profile of app '#{plist['AppIDName']}' with the name '#{plist['Name']}' successfully analysed.".green)
9
+ return plist["UUID"]
10
+ else
11
+ Helper.log.error("Error parsing provisioning profile at path '#{path}'".red)
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/sigh/resign.rb CHANGED
@@ -33,14 +33,7 @@ module Sigh
33
33
  puts command.magenta
34
34
  output = `#{command}`
35
35
  puts output
36
-
37
- if signing_identity =~ /^iPhone Developer:*/
38
- ptn = 'Assuming Development Identity'
39
- else
40
- ptn = 'Assuming Distribution Identity'
41
- end
42
-
43
- if output.include?(ptn)
36
+ if output.include?('Assuming Distribution Identity')
44
37
  Helper.log.info "Successfully signed #{ipa}!".green
45
38
  true
46
39
  else
@@ -93,7 +86,7 @@ module Sigh
93
86
  end
94
87
 
95
88
  def validate_provisioning_file(provisioning_profile)
96
- raise "Provisioning profile file could not be found or is not a .mobileprovision file (#{provisioning_profile})".red unless File.exist?(provisioning_profile) && provisioning_profile.end_with?('.mobileprovision')
89
+ raise "Provisioning profile file could not be found or is not a .mobileprovision file (#{provisioning_profile})".red unless File.exists?(provisioning_profile) && provisioning_profile.end_with?('.mobileprovision')
97
90
  end
98
91
 
99
92
  def print_available_identities
@@ -110,11 +103,7 @@ module Sigh
110
103
  available = `security find-identity -v -p codesigning`
111
104
  ids = []
112
105
  available.split("\n").each do |current|
113
- begin
114
- (ids << current.match(/.*\"(.*)\"/)[1])
115
- rescue
116
- nil
117
- end # the last line does not match
106
+ (ids << current.match(/.*\"(.*)\"/)[1]) rescue nil # the last line does not match
118
107
  end
119
108
 
120
109
  ids
@@ -7,44 +7,38 @@ module Sigh
7
7
  # Uses the spaceship to create or download a provisioning profile
8
8
  # returns the path the newly created provisioning profile (in /tmp usually)
9
9
  def run
10
- FastlaneCore::PrintTable.print_values(config: Sigh.config, hide_keys: [], title: "Summary")
11
-
12
- Helper.log.info "Starting login with user '#{Sigh.config[:username]}'"
10
+ Helper.log.info "Starting login"
13
11
  Spaceship.login(Sigh.config[:username], nil)
14
12
  Spaceship.select_team
15
13
  Helper.log.info "Successfully logged in"
16
-
17
- profiles = [] if Sigh.config[:skip_fetch_profiles]
18
- profiles ||= fetch_profiles # download the profile if it's there
14
+
15
+ profiles = fetch_profiles # download the profile if it's there
19
16
 
20
17
  if profiles.count > 0
21
18
  Helper.log.info "Found #{profiles.count} matching profile(s)".yellow
22
19
  profile = profiles.first
23
20
 
24
21
  if Sigh.config[:force]
25
- if profile_type == Spaceship.provisioning_profile::AppStore or profile_type == Spaceship.provisioning_profile::InHouse
26
- Helper.log.info "Updating the provisioning profile".yellow
27
- else
22
+ unless profile_type == Spaceship.provisioning_profile::AppStore
28
23
  Helper.log.info "Updating the profile to include all devices".yellow
29
- profile.devices = Spaceship.device.all
24
+ profile.devices = Spaceship.device.all
25
+ else
26
+ Helper.log.info "Updating the provisioning profile".yellow
30
27
  end
31
28
 
32
29
  profile = profile.update! # assign it, as it's a new profile
33
30
  end
34
31
  else
35
- Helper.log.info "No existing profiles, creating a new one for you".yellow
32
+ Helper.log.info "No existing profiles found, creating a new one for you".yellow
36
33
  profile = create_profile!
37
34
  end
38
35
 
39
36
  raise "Something went wrong fetching the latest profile".red unless profile
37
+
38
+ path = download_profile(profile)
39
+ store_provisioning_id_in_environment(path)
40
40
 
41
- if profile_type == Spaceship.provisioning_profile.in_house
42
- ENV["SIGH_PROFILE_ENTERPRISE"] = "1"
43
- else
44
- ENV.delete("SIGH_PROFILE_ENTERPRISE")
45
- end
46
-
47
- return download_profile(profile)
41
+ return path
48
42
  end
49
43
 
50
44
  # The kind of provisioning profile we're interested in
@@ -52,7 +46,6 @@ module Sigh
52
46
  return @profile_type if @profile_type
53
47
 
54
48
  @profile_type = Spaceship.provisioning_profile.app_store
55
- @profile_type = Spaceship.provisioning_profile.in_house if Spaceship.client.in_house?
56
49
  @profile_type = Spaceship.provisioning_profile.ad_hoc if Sigh.config[:adhoc]
57
50
  @profile_type = Spaceship.provisioning_profile.development if Sigh.config[:development]
58
51
 
@@ -61,28 +54,7 @@ module Sigh
61
54
 
62
55
  # Fetches a profile matching the user's search requirements
63
56
  def fetch_profiles
64
- Helper.log.info "Fetching profiles..."
65
- results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier]).find_all(&:valid?)
66
-
67
- # Take the provisioning profile name into account
68
- if Sigh.config[:provisioning_name].to_s.length > 0
69
- filtered = results.select { |p| p.name.strip == Sigh.config[:provisioning_name].strip }
70
- results = filtered if (filtered || []).count > 0
71
- end
72
-
73
- return results if Sigh.config[:skip_certificate_verification]
74
-
75
- return results.find_all do |a|
76
- # Also make sure we have the certificate installed on the local machine
77
- installed = false
78
- a.certificates.each do |cert|
79
- file = Tempfile.new('cert')
80
- file.write(cert.download_raw)
81
- file.close
82
- installed = true if FastlaneCore::CertChecker.installed?(file.path)
83
- end
84
- installed
85
- end
57
+ profile_type.find_by_bundle_id(Sigh.config[:app_identifier])
86
58
  end
87
59
 
88
60
  # Create a new profile and return it
@@ -91,27 +63,23 @@ module Sigh
91
63
  bundle_id = Sigh.config[:app_identifier]
92
64
  name = Sigh.config[:provisioning_name] || [bundle_id, profile_type.pretty_type].join(' ')
93
65
 
94
- unless Sigh.config[:skip_fetch_profiles]
95
- if Spaceship.provisioning_profile.all.find { |p| p.name == name }
96
- Helper.log.error "The name '#{name}' is already taken, using another one."
97
- name += " #{Time.now.to_i}"
98
- end
66
+ if Spaceship.provisioning_profile.all.find { |p| p.name == name }
67
+ Helper.log.error "The name '#{name}' is already taken, using another one."
68
+ name += " #{Time.now.to_i}"
99
69
  end
100
70
 
101
71
  Helper.log.info "Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}'".yellow
102
- profile = profile_type.create!(name: name,
72
+ profile = profile_type.create!(name: name,
103
73
  bundle_id: bundle_id,
104
74
  certificate: cert)
105
75
  profile
106
76
  end
107
77
 
78
+
108
79
  # Certificate to use based on the current distribution mode
109
- # rubocop:disable Metrics/AbcSize
110
80
  def certificate_to_use
111
81
  if profile_type == Spaceship.provisioning_profile.Development
112
82
  certificates = Spaceship.certificate.development.all
113
- elsif profile_type == Spaceship.provisioning_profile.InHouse
114
- certificates = Spaceship.certificate.in_house.all
115
83
  else
116
84
  certificates = Spaceship.certificate.production.all # Ad hoc or App Store
117
85
  end
@@ -129,12 +97,11 @@ module Sigh
129
97
  true
130
98
  end
131
99
 
132
- if certificates.count > 1 and !Sigh.config[:development]
100
+ if certificates.count > 1
133
101
  Helper.log.info "Found more than one code signing identity. Choosing the first one. Check out `sigh --help` to see all available options.".yellow
134
102
  Helper.log.info "Available Code Signing Identities for current filters:".green
135
103
  certificates.each do |c|
136
- str = ["\t- Name:", c.owner_name, "- ID:", c.id + "- Expires", c.expires.strftime("%d/%m/%Y")].join(" ")
137
- Helper.log.info str.green
104
+ Helper.log.info ("\t- Name: " + c.owner_name + " - ID: " + c.id + " - Expires: " + c.expires).green
138
105
  end
139
106
  end
140
107
 
@@ -146,24 +113,29 @@ module Sigh
146
113
  raise "Could not find a matching code signing identity for #{profile_type}. You can use cert to generate one (https://github.com/fastlane/cert)".red
147
114
  end
148
115
 
149
- return certificates if Sigh.config[:development] # development profiles support multiple certificates
150
116
  return certificates.first
151
117
  end
152
- # rubocop:enable Metrics/AbcSize
153
118
 
154
119
  # Downloads and stores the provisioning profile
155
120
  def download_profile(profile)
156
121
  Helper.log.info "Downloading provisioning profile...".yellow
157
122
  profile_name ||= "#{profile.class.pretty_type}_#{Sigh.config[:app_identifier]}.mobileprovision" # default name
158
- profile_name += '.mobileprovision' unless profile_name.include? 'mobileprovision'
123
+ profile_name += '.mobileprovision' unless profile_name.include?'mobileprovision'
159
124
 
160
125
  output_path = File.join('/tmp', profile_name)
161
- File.open(output_path, "wb") do |f|
126
+ dataWritten = File.open(output_path, "wb") do |f|
162
127
  f.write(profile.download)
163
128
  end
164
129
 
165
130
  Helper.log.info "Successfully downloaded provisioning profile...".green
166
131
  return output_path
167
132
  end
133
+
134
+ # Store the profile ID into the environment
135
+ def store_provisioning_id_in_environment(path)
136
+ require 'sigh/profile_analyser'
137
+ udid = Sigh::ProfileAnalyser.run(path)
138
+ ENV["SIGH_UDID"] = udid if udid
139
+ end
168
140
  end
169
- end
141
+ end
data/lib/sigh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sigh
2
- VERSION = "0.10.9"
2
+ VERSION = "1.0.0.beta1"
3
3
  end
metadata CHANGED
@@ -1,159 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sigh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.9
4
+ version: 1.0.0.beta1
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-10-01 00:00:00.000000000 Z
11
+ date: 2015-05-26 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
- version: 0.19.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 1.0.0
19
+ version: 0.7.2
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 0.19.0
30
- - - "<"
24
+ - - '>='
31
25
  - !ruby/object:Gem::Version
32
- version: 1.0.0
26
+ version: 0.7.2
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: plist
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
31
+ - - ~>
38
32
  - !ruby/object:Gem::Version
39
- version: '3.1'
33
+ version: 3.1.0
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
- - - "~>"
38
+ - - ~>
45
39
  - !ruby/object:Gem::Version
46
- version: '3.1'
40
+ version: 3.1.0
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: spaceship
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
- - - ">="
45
+ - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: 0.6.0
47
+ version: 0.0.1
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
- - - ">="
52
+ - - ~>
59
53
  - !ruby/object:Gem::Version
60
- version: 0.6.0
54
+ version: 0.0.1
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: bundler
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
- - - ">="
59
+ - - '>='
66
60
  - !ruby/object:Gem::Version
67
61
  version: '0'
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
- - - ">="
66
+ - - '>='
73
67
  - !ruby/object:Gem::Version
74
68
  version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: rake
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - ">="
73
+ - - '>='
80
74
  - !ruby/object:Gem::Version
81
75
  version: '0'
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
- - - ">="
80
+ - - '>='
87
81
  - !ruby/object:Gem::Version
88
82
  version: '0'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: rspec
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
- - - "~>"
87
+ - - ~>
94
88
  - !ruby/object:Gem::Version
95
89
  version: 3.1.0
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
- - - "~>"
94
+ - - ~>
101
95
  - !ruby/object:Gem::Version
102
96
  version: 3.1.0
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: pry
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
- - - ">="
101
+ - - '>='
108
102
  - !ruby/object:Gem::Version
109
103
  version: '0'
110
104
  type: :development
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
- - - ">="
108
+ - - '>='
115
109
  - !ruby/object:Gem::Version
116
110
  version: '0'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: yard
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
- - - "~>"
115
+ - - ~>
122
116
  - !ruby/object:Gem::Version
123
117
  version: 0.8.7.4
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
- - - "~>"
122
+ - - ~>
129
123
  - !ruby/object:Gem::Version
130
124
  version: 0.8.7.4
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: webmock
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
- - - "~>"
129
+ - - ~>
136
130
  - !ruby/object:Gem::Version
137
131
  version: 1.19.0
138
132
  type: :development
139
133
  prerelease: false
140
134
  version_requirements: !ruby/object:Gem::Requirement
141
135
  requirements:
142
- - - "~>"
136
+ - - ~>
143
137
  - !ruby/object:Gem::Version
144
138
  version: 1.19.0
145
139
  - !ruby/object:Gem::Dependency
146
140
  name: codeclimate-test-reporter
147
141
  requirement: !ruby/object:Gem::Requirement
148
142
  requirements:
149
- - - ">="
143
+ - - '>='
150
144
  - !ruby/object:Gem::Version
151
145
  version: '0'
152
146
  type: :development
153
147
  prerelease: false
154
148
  version_requirements: !ruby/object:Gem::Requirement
155
149
  requirements:
156
- - - ">="
150
+ - - '>='
157
151
  - !ruby/object:Gem::Version
158
152
  version: '0'
159
153
  description: Because you would rather spend your time building stuff than fighting
@@ -171,13 +165,12 @@ files:
171
165
  - lib/assets/resign.sh
172
166
  - lib/sigh.rb
173
167
  - lib/sigh/dependency_checker.rb
174
- - lib/sigh/download_all.rb
175
168
  - lib/sigh/local_manage.rb
176
169
  - lib/sigh/manager.rb
177
170
  - lib/sigh/options.rb
178
- - lib/sigh/repair.rb
171
+ - lib/sigh/profile_analyser.rb
179
172
  - lib/sigh/resign.rb
180
- - lib/sigh/runner.rb
173
+ - lib/sigh/spaceship/runner.rb
181
174
  - lib/sigh/version.rb
182
175
  homepage: https://fastlane.tools
183
176
  licenses:
@@ -189,17 +182,17 @@ require_paths:
189
182
  - lib
190
183
  required_ruby_version: !ruby/object:Gem::Requirement
191
184
  requirements:
192
- - - ">="
185
+ - - '>='
193
186
  - !ruby/object:Gem::Version
194
187
  version: 2.0.0
195
188
  required_rubygems_version: !ruby/object:Gem::Requirement
196
189
  requirements:
197
- - - ">="
190
+ - - '>'
198
191
  - !ruby/object:Gem::Version
199
- version: '0'
192
+ version: 1.3.1
200
193
  requirements: []
201
194
  rubyforge_project:
202
- rubygems_version: 2.4.6
195
+ rubygems_version: 2.4.7
203
196
  signing_key:
204
197
  specification_version: 4
205
198
  summary: Because you would rather spend your time building stuff than fighting provisioning
@@ -1,33 +0,0 @@
1
- module Sigh
2
- class DownloadAll
3
- # Download all valid provisioning profiles
4
- def download_all
5
- Helper.log.info "Starting login with user '#{Sigh.config[:username]}'"
6
- Spaceship.login(Sigh.config[:username], nil)
7
- Spaceship.select_team
8
- Helper.log.info "Successfully logged in"
9
-
10
- Spaceship.provisioning_profile.all.each do |profile|
11
- if profile.valid?
12
- Helper.log.info "Downloading profile '#{profile.name}'...".green
13
- download_profile(profile)
14
- else
15
- Helper.log.info "Skipping invalid/expired profile '#{profile.name}'".yellow
16
- end
17
- end
18
- end
19
-
20
- def download_profile(profile)
21
- output = Sigh.config[:output_path] || "/tmp"
22
-
23
- profile_name = "#{profile.class.pretty_type}_#{profile.app.bundle_id}.mobileprovision" # default name
24
-
25
- output_path = File.join(output, profile_name)
26
- File.open(output_path, "wb") do |f|
27
- f.write(profile.download)
28
- end
29
-
30
- Manager.install_profile(output_path) unless Sigh.config[:skip_install]
31
- end
32
- end
33
- end
data/lib/sigh/repair.rb DELETED
@@ -1,30 +0,0 @@
1
- module Sigh
2
- class Repair
3
- def repair_all
4
- Helper.log.info "Starting login with user '#{Sigh.config[:username]}'"
5
- Spaceship.login(Sigh.config[:username], nil)
6
- Spaceship.select_team
7
- Helper.log.info "Successfully logged in"
8
-
9
- # Select all 'Invalid' or 'Expired' provisioning profiles
10
- broken_profiles = Spaceship.provisioning_profile.all.find_all do |profile|
11
- (profile.status == "Invalid" or profile.status == "Expired")
12
- end
13
-
14
- if broken_profiles.count == 0
15
- Helper.log.info "All provisioning profiles are valid, nothing to do".green
16
- return
17
- end
18
-
19
- Helper.log.info "Going to repair #{broken_profiles.count} provisioning profiles".green
20
-
21
- # Iterate over all broken profiles and repair them
22
- broken_profiles.each do |profile|
23
- Helper.log.info "Repairing profile '#{profile.name}'..."
24
- profile.repair! # yes, that's all you need to repair a profile
25
- end
26
-
27
- Helper.log.info "Successfully repaired #{broken_profiles.count} provisioning profiles".green
28
- end
29
- end
30
- end