sigh 1.4.0 → 1.4.1

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: e49ced620631a80f353f66ce2aaec2eb7623fe89
4
- data.tar.gz: 44753e2b434bf48330d3222265371d999b527535
3
+ metadata.gz: 63a5bb24c8badd1785e7c1c9ad7a7b1ec75b8afb
4
+ data.tar.gz: 5483452777078315cf20bca6204bf82f65db39a5
5
5
  SHA512:
6
- metadata.gz: ce2f1fecf07da5caa9b196081bd5a9363b87d6b69c3bd614dd9a8526584b38dfa8b518f6e5ecaf7b33eef2526ebd04ae6a6e07334b348aa702e7d420779b1248
7
- data.tar.gz: b9a69234e758c2128ca442cc117f5259c6a7cd544bc3d937da5f73ef2ffc134b6f52a4f2e2425e925a2c9fdd5a768579de7127e02a5c52f5f14549173e2c42ec
6
+ metadata.gz: 1a73a95c3a208e70bd5df6bc032a650a79b9587b6287dc9de07ee896be51a35bf7da301fa8f5e69fdae516e932e2b27e7aba69a1a9772b0703584082f0b6c43f
7
+ data.tar.gz: 32e970b5abb7eeaf379d2e3b67d8ada1e4985613f3845c34b4e4d66e0f497745824758edbc685b081b19c327ac7960b9025076d452d2822cb3467c0468b9c1c9
data/README.md CHANGED
@@ -1,24 +1,24 @@
1
1
  <h3 align="center">
2
- <a href="https://github.com/fastlane/fastlane">
3
- <img src="assets/fastlane.png" width="150" />
2
+ <a href="https://github.com/fastlane/fastlane/tree/master/fastlane">
3
+ <img src="../fastlane/assets/fastlane.png" width="150" />
4
4
  <br />
5
5
  fastlane
6
6
  </a>
7
7
  </h3>
8
8
  <p align="center">
9
- <a href="https://github.com/fastlane/deliver">deliver</a> &bull;
10
- <a href="https://github.com/fastlane/snapshot">snapshot</a> &bull;
11
- <a href="https://github.com/fastlane/frameit">frameit</a> &bull;
12
- <a href="https://github.com/fastlane/pem">pem</a> &bull;
13
- <b>sigh</b> &bull;
14
- <a href="https://github.com/fastlane/produce">produce</a> &bull;
15
- <a href="https://github.com/fastlane/cert">cert</a> &bull;
16
- <a href="https://github.com/fastlane/spaceship">spaceship</a> &bull;
17
- <a href="https://github.com/fastlane/pilot">pilot</a> &bull;
9
+ <a href="https://github.com/fastlane/fastlane/tree/master/deliver">deliver</a> &bull;
10
+ <a href="https://github.com/fastlane/fastlane/tree/master/snapshot">snapshot</a> &bull;
11
+ <a href="https://github.com/fastlane/fastlane/tree/master/frameit">frameit</a> &bull;
12
+ <a href="https://github.com/fastlane/fastlane/tree/master/pem">pem</a> &bull;
13
+ <b>sigh</b> &bull;
14
+ <a href="https://github.com/fastlane/fastlane/tree/master/produce">produce</a> &bull;
15
+ <a href="https://github.com/fastlane/fastlane/tree/master/cert">cert</a> &bull;
16
+ <a href="https://github.com/fastlane/fastlane/tree/master/spaceship">spaceship</a> &bull;
17
+ <a href="https://github.com/fastlane/fastlane/tree/master/pilot">pilot</a> &bull;
18
18
  <a href="https://github.com/fastlane/boarding">boarding</a> &bull;
19
- <a href="https://github.com/fastlane/gym">gym</a> &bull;
20
- <a href="https://github.com/fastlane/scan">scan</a> &bull;
21
- <a href="https://github.com/fastlane/match">match</a>
19
+ <a href="https://github.com/fastlane/fastlane/tree/master/gym">gym</a> &bull;
20
+ <a href="https://github.com/fastlane/fastlane/tree/master/scan">scan</a> &bull;
21
+ <a href="https://github.com/fastlane/fastlane/tree/master/match">match</a>
22
22
  </p>
23
23
  -------
24
24
 
@@ -30,9 +30,9 @@ sigh
30
30
  ============
31
31
 
32
32
  [![Twitter: @FastlaneTools](https://img.shields.io/badge/contact-@FastlaneTools-blue.svg?style=flat)](https://twitter.com/FastlaneTools)
33
- [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/fastlane/sigh/blob/master/LICENSE)
33
+ [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/fastlane/fastlane/blob/master/sigh/LICENSE)
34
34
  [![Gem](https://img.shields.io/gem/v/sigh.svg?style=flat)](http://rubygems.org/gems/sigh)
35
- [![Build Status](https://img.shields.io/travis/fastlane/sigh/master.svg?style=flat)](https://travis-ci.org/fastlane/sigh)
35
+ [![Build Status](https://img.shields.io/circleci/project/fastlane/fastlane/master.svg?style=flat)](https://circleci.com/gh/fastlane/fastlane)
36
36
 
37
37
  ###### Because you would rather spend your time building stuff than fighting provisioning
38
38
 
@@ -42,12 +42,12 @@ Get in contact with the developer on Twitter: [@FastlaneTools](https://twitter.c
42
42
 
43
43
  -------
44
44
  <p align="center">
45
- <a href="#features">Features</a> &bull;
46
- <a href="#installation">Installation</a> &bull;
47
- <a href="#usage">Usage</a> &bull;
48
- <a href="#resign">Resign</a> &bull;
49
- <a href="#how-does-it-work">How does it work?</a> &bull;
50
- <a href="#tips">Tips</a> &bull;
45
+ <a href="#features">Features</a> &bull;
46
+ <a href="#installation">Installation</a> &bull;
47
+ <a href="#usage">Usage</a> &bull;
48
+ <a href="#resign">Resign</a> &bull;
49
+ <a href="#how-does-it-work">How does it work?</a> &bull;
50
+ <a href="#tips">Tips</a> &bull;
51
51
  <a href="#need-help">Need help?</a>
52
52
  </p>
53
53
 
@@ -66,7 +66,7 @@ Get in contact with the developer on Twitter: [@FastlaneTools](https://twitter.c
66
66
  - Support for **multiple Teams**
67
67
  - Support for **Enterprise Profiles**
68
68
 
69
- To automate iOS Push profiles you can use [PEM](https://github.com/fastlane/PEM).
69
+ To automate iOS Push profiles you can use [pem](https://github.com/fastlane/fastlane/tree/master/pem).
70
70
 
71
71
  ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
72
72
 
@@ -83,7 +83,7 @@ See ```sigh``` in action:
83
83
 
84
84
  # Installation
85
85
 
86
- **Note**: It is recommended to use [match](https://github.com/fastlane/match) according to the [codesigning.guide](https://codesigning.guide) for generating and maintaining your provisioning profiles. Use `sigh` directly only if you want full control over what's going on and know more about codesigning.
86
+ **Note**: It is recommended to use [match](https://github.com/fastlane/fastlane/tree/master/match) according to the [codesigning.guide](https://codesigning.guide) for generating and maintaining your provisioning profiles. Use `sigh` directly only if you want full control over what's going on and know more about codesigning.
87
87
 
88
88
  sudo gem install sigh
89
89
 
@@ -96,7 +96,7 @@ Make sure, you have the latest version of the Xcode command line tools installed
96
96
  sigh
97
97
  Yes, that's the whole command!
98
98
 
99
- ```sigh``` will create, repair and download profiles for the App Store by default.
99
+ ```sigh``` will create, repair and download profiles for the App Store by default.
100
100
 
101
101
  You can pass your bundle identifier and username like this:
102
102
 
@@ -105,12 +105,12 @@ You can pass your bundle identifier and username like this:
105
105
  If you want to generate an **Ad Hoc** profile instead of an App Store profile:
106
106
 
107
107
  sigh --adhoc
108
-
108
+
109
109
  If you want to generate a **Development** profile:
110
110
 
111
111
  sigh --development
112
112
 
113
- To generate the profile in a specific directory:
113
+ To generate the profile in a specific directory:
114
114
 
115
115
  sigh -o "~/Certificates/"
116
116
 
@@ -121,13 +121,13 @@ To download all your provisioning profiles use
121
121
  For a list of available parameters and commands run
122
122
 
123
123
  sigh --help
124
-
124
+
125
125
  ### Advanced
126
126
 
127
127
  By default, ```sigh``` will install the downloaded profile on your machine. If you just want to generate the profile and skip the installation, use the following flag:
128
128
 
129
129
  sigh --skip_install
130
-
130
+
131
131
  To save the provisioning profile under a specific name, use the -q option:
132
132
 
133
133
  sigh -a com.krausefx.app -u username -q "myProfile.mobileprovision"
@@ -149,9 +149,9 @@ For a list of available parameters and commands run
149
149
  sigh --help
150
150
 
151
151
 
152
- ### Use with [`fastlane`](https://github.com/fastlane/fastlane)
152
+ ### Use with [`fastlane`](https://github.com/fastlane/fastlane/tree/master/fastlane)
153
153
 
154
- `sigh` becomes really interesting when used in [`fastlane`](https://github.com/fastlane/fastlane) in combination with [`cert`](https://github.com/fastlane/cert).
154
+ `sigh` becomes really interesting when used in [`fastlane`](https://github.com/fastlane/fastlane/tree/master/fastlane) in combination with [`cert`](https://github.com/fastlane/fastlane/tree/master/cert).
155
155
 
156
156
  Update your `Fastfile` to contain the following code:
157
157
 
@@ -204,7 +204,7 @@ Or delete all `iOS Team Provisioning Profile` by using a regular expression
204
204
 
205
205
  Run `sigh --help` to get a list of all available environment variables.
206
206
 
207
- If you're using [cert](https://github.com/fastlane/cert) in combination with [fastlane](https://github.com/fastlane/fastlane) the signing certificate will automatically be selected for you. (make sure to run `cert` before `sigh`)
207
+ If you're using [cert](https://github.com/fastlane/fastlane/tree/master/cert) in combination with [fastlane](https://github.com/fastlane/fastlane/tree/master/fastlane) the signing certificate will automatically be selected for you. (make sure to run `cert` before `sigh`)
208
208
 
209
209
  # How does it work?
210
210
 
@@ -212,36 +212,36 @@ If you're using [cert](https://github.com/fastlane/cert) in combination with [fa
212
212
 
213
213
 
214
214
  ## How is my password stored?
215
- `sigh` uses the [CredentialsManager](https://github.com/fastlane/credentials_manager) from `fastlane`.
215
+ `sigh` uses the [CredentialsManager](https://github.com/fastlane/fastlane/tree/master/credentials_manager) from `fastlane`.
216
216
 
217
217
  # Tips
218
218
  ## [`fastlane`](https://fastlane.tools) Toolchain
219
219
 
220
220
  - [`fastlane`](https://fastlane.tools): Connect all deployment tools into one streamlined workflow
221
- - [`deliver`](https://github.com/fastlane/deliver): Upload screenshots, metadata and your app to the App Store
222
- - [`snapshot`](https://github.com/fastlane/snapshot): Automate taking localized screenshots of your iOS app on every device
223
- - [`frameit`](https://github.com/fastlane/frameit): Quickly put your screenshots into the right device frames
224
- - [`pem`](https://github.com/fastlane/pem): Automatically generate and renew your push notification profiles
225
- - [`produce`](https://github.com/fastlane/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
226
- - [`cert`](https://github.com/fastlane/cert): Automatically create and maintain iOS code signing certificates
227
- - [`spaceship`](https://github.com/fastlane/spaceship): Ruby library to access the Apple Dev Center and iTunes Connect
228
- - [`pilot`](https://github.com/fastlane/pilot): The best way to manage your TestFlight testers and builds from your terminal
229
- - [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
230
- - [`gym`](https://github.com/fastlane/gym): Building your iOS apps has never been easier
231
- - [`scan`](https://github.com/fastlane/scan): The easiest way to run tests of your iOS and Mac app
232
- - [`match`](https://github.com/fastlane/match): Easily sync your certificates and profiles across your team using git
221
+ - [`deliver`](https://github.com/fastlane/fastlane/tree/master/deliver): Upload screenshots, metadata and your app to the App Store
222
+ - [`snapshot`](https://github.com/fastlane/fastlane/tree/master/snapshot): Automate taking localized screenshots of your iOS app on every device
223
+ - [`frameit`](https://github.com/fastlane/fastlane/tree/master/frameit): Quickly put your screenshots into the right device frames
224
+ - [`pem`](https://github.com/fastlane/fastlane/tree/master/pem): Automatically generate and renew your push notification profiles
225
+ - [`produce`](https://github.com/fastlane/fastlane/tree/master/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
226
+ - [`cert`](https://github.com/fastlane/fastlane/tree/master/cert): Automatically create and maintain iOS code signing certificates
227
+ - [`spaceship`](https://github.com/fastlane/fastlane/tree/master/spaceship): Ruby library to access the Apple Dev Center and iTunes Connect
228
+ - [`pilot`](https://github.com/fastlane/fastlane/tree/master/pilot): The best way to manage your TestFlight testers and builds from your terminal
229
+ - [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
230
+ - [`gym`](https://github.com/fastlane/fastlane/tree/master/gym): Building your iOS apps has never been easier
231
+ - [`scan`](https://github.com/fastlane/fastlane/tree/master/scan): The easiest way to run tests of your iOS and Mac app
232
+ - [`match`](https://github.com/fastlane/fastlane/tree/master/match): Easily sync your certificates and profiles across your team using git
233
233
 
234
234
  ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
235
235
 
236
236
  ## Use the 'Provisioning Quicklook plugin'
237
237
  Download and install the [Provisioning Plugin](https://github.com/chockenberry/Provisioning).
238
238
 
239
- It will show you the `mobileprovision` files like this:
239
+ It will show you the `mobileprovision` files like this:
240
240
  ![assets/QuickLookScreenshot.png](assets/QuickLookScreenshot.png)
241
241
 
242
242
  ## App Identifier couldn't be found
243
243
 
244
- 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.
244
+ If you also want to create a new App Identifier on the Apple Developer Portal, check out [produce](https://github.com/fastlane/fastlane/tree/master/produce), which does exactly that.
245
245
 
246
246
  ## What happens to my Xcode managed profiles?
247
247
 
@@ -251,7 +251,7 @@ If you also want to create a new App Identifier on the Apple Developer Portal, c
251
251
  Please submit an issue on GitHub and provide information about your setup
252
252
 
253
253
  # Code of Conduct
254
- Help us keep `sigh` open and inclusive. Please read and follow our [Code of Conduct](https://github.com/fastlane/code-of-conduct).
254
+ Help us keep `sigh` open and inclusive. Please read and follow our [Code of Conduct](https://github.com/fastlane/fastlane/blob/master/CODE_OF_CONDUCT.md).
255
255
 
256
256
  # License
257
257
  This project is licensed under the terms of the MIT license. See the LICENSE file.
data/bin/sigh CHANGED
@@ -76,6 +76,7 @@ class SighApplication
76
76
  c.syntax = 'sigh manage'
77
77
  c.description = 'Manage installed provisioning profiles on your system.'
78
78
 
79
+ c.option '-f', '--force', 'Force remove all expired provisioning profiles. Required on CI.'
79
80
  c.option '-e', '--clean_expired', 'Remove all expired provisioning profiles.'
80
81
 
81
82
  c.option '-p', '--clean_pattern STRING', String, 'Remove any provisioning profiles that matches the regular expression.'
@@ -60,13 +60,28 @@
60
60
  # 5. copy the entitlements as archived-expanded-entitlements.xcent inside the app bundle (because Xcode does too)
61
61
  #
62
62
 
63
+ # Logging functions
64
+
65
+ log() {
66
+ # Make sure it returns 0 code even when verose mode is off (test 1)
67
+ # To use like [[ condition ]] && log "x" && something
68
+ [[ -n "$VERBOSE" ]] && echo -e "$@" || test 1
69
+ }
70
+
71
+ error() {
72
+ echo "$@" >&2
73
+ exit 1
74
+ }
75
+
76
+ warning() {
77
+ echo "$@" >&2
78
+ }
63
79
 
64
80
  function checkStatus {
65
81
 
66
82
  if [ $? -ne 0 ];
67
83
  then
68
- echo "Encountered an error, aborting!" >&2
69
- exit 1
84
+ error "Encountered an error, aborting!"
70
85
  fi
71
86
  }
72
87
 
@@ -92,65 +107,68 @@ NESTED_APP_REFERENCE_KEYS=(":WKCompanionAppBundleIdentifier" ":NSExtension:NSExt
92
107
 
93
108
  # options start index
94
109
  OPTIND=3
95
- while getopts p:d:e:k:b:n: opt; do
110
+ while getopts p:d:e:k:b:n:v opt; do
96
111
  case $opt in
97
112
  p)
98
113
  RAW_PROVISIONS+=("$OPTARG")
99
- if [[ "$OPTARG" =~ .+=.+ ]]; then
100
- echo "Specified provisioning profile: '${OPTARG#*=}' for bundle identifier: '${OPTARG%%=*}'" >&2
101
- else
102
- echo "Specified provisioning profile: '$OPTARG'" >&2
103
- fi
104
114
  ;;
105
115
  d)
106
116
  DISPLAY_NAME="$OPTARG"
107
- echo "Specified display name: '$DISPLAY_NAME'" >&2
108
117
  ;;
109
118
  e)
110
119
  ENTITLEMENTS="$OPTARG"
111
- echo "Specified signing entitlements: '$ENTITLEMENTS'" >&2
112
120
  ;;
113
121
  b)
114
122
  BUNDLE_IDENTIFIER="$OPTARG"
115
- echo "Specified bundle identifier: '$BUNDLE_IDENTIFIER'" >&2
116
123
  ;;
117
124
  k)
118
125
  KEYCHAIN="$OPTARG"
119
- echo "Specified Keychain to use: '$KEYCHAIN'" >&2
120
126
  ;;
121
127
  n)
122
128
  VERSION_NUMBER="$OPTARG"
123
- echo "Specified version to use: '$VERSION_NUMBER'" >&2
129
+ ;;
130
+ v)
131
+ VERBOSE="--verbose"
124
132
  ;;
125
133
  \?)
126
- echo "Invalid option: -$OPTARG" >&2
127
- exit 1
134
+ error "Invalid option: -$OPTARG"
128
135
  ;;
129
136
  :)
130
- echo "Option -$OPTARG requires an argument." >&2
131
- exit 1
137
+ error "Option -$OPTARG requires an argument."
132
138
  ;;
133
139
  esac
134
140
  done
135
141
 
142
+ # Log the options
143
+ for provision in ${RAW_PROVISIONS[@]}; do
144
+ if [[ "$provision" =~ .+=.+ ]]; then
145
+ log "Specified provisioning profile: '${provision#*=}' for bundle identifier: '${provision%%=*}'"
146
+ else
147
+ log "Specified provisioning profile: '$provision'"
148
+ fi
149
+ done
150
+ [[ -n "${DISPLAY_NAME}" ]] && log "Specified display name: '$DISPLAY_NAME'"
151
+ [[ -n "${ENTITLEMENTS}" ]] && log "Specified signing entitlements: '$ENTITLEMENTS'"
152
+ [[ -n "${BUNDLE_IDENTIFIER}" ]] && log "Specified bundle identifier: '$BUNDLE_IDENTIFIER'"
153
+ [[ -n "${KEYCHAIN}" ]] && log "Specified Keychain to use: '$KEYCHAIN'"
154
+ [[ -n "${VERSION_NUMBER}" ]] && log "Specified version to use: '$VERSION_NUMBER'"
155
+
136
156
  shift $((OPTIND-1))
137
157
 
138
158
  NEW_FILE="$1"
139
159
  if [ -z "$NEW_FILE" ];
140
160
  then
141
- echo "Output file name required" >&2
142
- exit 1
161
+ error "Output file name required"
143
162
  fi
144
163
 
145
164
  if [[ "${#RAW_PROVISIONS[*]}" == "0" ]]; then
146
- echo "-p 'xxxx.mobileprovision' argument is required" >&2
147
- exit 1;
165
+ error "-p 'xxxx.mobileprovision' argument is required"
148
166
  fi
149
167
 
150
168
  # Check for and remove the temporary directory if it already exists
151
169
  if [ -d "$TEMP_DIR" ];
152
170
  then
153
- echo "Removing previous temporary directory: '$TEMP_DIR'" >&2
171
+ log "Removing previous temporary directory: '$TEMP_DIR'"
154
172
  rm -Rf "$TEMP_DIR"
155
173
  fi
156
174
 
@@ -171,8 +189,7 @@ then
171
189
  cp -Rf "${ORIGINAL_FILE}" "$TEMP_DIR/Payload/${filename}.app"
172
190
  checkStatus
173
191
  else
174
- echo "Error: Only can resign .app files and .ipa files." >&2
175
- exit
192
+ error "Error: Only can resign .app files and .ipa files."
176
193
  fi
177
194
 
178
195
  # check the keychain
@@ -235,8 +252,7 @@ function add_provision_for_bundle_id {
235
252
  local CURRENT_PROVISION=`provision_for_bundle_id "$BUNDLE_ID" STRICT`
236
253
 
237
254
  if [[ "$CURRENT_PROVISION" != "" && "$CURRENT_PROVISION" != "$PROVISION" ]]; then
238
- echo "Conflicting provisioning profiles '$PROVISION' and '$CURRENT_PROVISION' for bundle identifier '$BUNDLE_ID'." >&2
239
- exit 1
255
+ error "Conflicting provisioning profiles '$PROVISION' and '$CURRENT_PROVISION' for bundle identifier '$BUNDLE_ID'."
240
256
  fi
241
257
 
242
258
  PROVISIONS_BY_ID+=("$BUNDLE_ID=$PROVISION")
@@ -255,8 +271,7 @@ function add_provision {
255
271
  fi
256
272
 
257
273
  if [[ ! -e "$PROVISION" ]]; then
258
- echo "Provisioning profile '$PROVISION' file does not exist" >&2
259
- exit 1;
274
+ error "Provisioning profile '$PROVISION' file does not exist"
260
275
  fi
261
276
 
262
277
  local BUNDLE_ID=`bundle_id_for_provison "$PROVISION"`
@@ -286,8 +301,7 @@ function resign {
286
301
  # Make sure that the Info.plist file is where we expect it
287
302
  if [ ! -e "$APP_PATH/Info.plist" ];
288
303
  then
289
- echo "Expected file does not exist: '$APP_PATH/Info.plist'" >&2
290
- exit 1;
304
+ error "Expected file does not exist: '$APP_PATH/Info.plist'"
291
305
  fi
292
306
 
293
307
  # Read in current values from the app
@@ -301,12 +315,11 @@ function resign {
301
315
 
302
316
  if [[ "$NEW_PROVISION" == "" ]]; then
303
317
  if [[ "$NESTED" == NESTED ]]; then
304
- echo "No provisioning profile for nested application: '$APP_PATH' with bundle identifier '${BUNDLE_IDENTIFIER:-$CURRENT_BUNDLE_IDENTIFIER}'" >&2
318
+ warning "No provisioning profile for nested application: '$APP_PATH' with bundle identifier '${BUNDLE_IDENTIFIER:-$CURRENT_BUNDLE_IDENTIFIER}'"
305
319
  else
306
- echo "No provisioning profile for application: '$APP_PATH' with bundle identifier '${BUNDLE_IDENTIFIER:-$CURRENT_BUNDLE_IDENTIFIER}'" >&2
320
+ warning "No provisioning profile for application: '$APP_PATH' with bundle identifier '${BUNDLE_IDENTIFIER:-$CURRENT_BUNDLE_IDENTIFIER}'"
307
321
  fi
308
- echo "Use the -p option (example: -p com.example.app=xxxx.mobileprovision)" >&2
309
- exit 1;
322
+ error "Use the -p option (example: -p com.example.app=xxxx.mobileprovision)"
310
323
  fi
311
324
 
312
325
  local PROVISION_BUNDLE_IDENTIFIER=`bundle_id_for_provison "$NEW_PROVISION"`
@@ -314,7 +327,7 @@ function resign {
314
327
  # Use provisioning profile's bundle identifier
315
328
  if [ "$BUNDLE_IDENTIFIER" == "" ]; then
316
329
  if [[ "$PROVISION_BUNDLE_IDENTIFIER" =~ \* ]]; then
317
- echo "Bundle Identifier contains a *, using the current bundle identifier" >&2
330
+ log "Bundle Identifier contains a *, using the current bundle identifier"
318
331
  BUNDLE_IDENTIFIER="$CURRENT_BUNDLE_IDENTIFIER"
319
332
  else
320
333
  BUNDLE_IDENTIFIER="$PROVISION_BUNDLE_IDENTIFIER"
@@ -322,25 +335,24 @@ function resign {
322
335
  fi
323
336
 
324
337
  if ! does_bundle_id_match "$PROVISION_BUNDLE_IDENTIFIER" "$BUNDLE_IDENTIFIER"; then
325
- echo "Bundle Identifier '$PROVISION_BUNDLE_IDENTIFIER' in provisioning profile '$NEW_PROVISION' does not match the Bundle Identifier '$BUNDLE_IDENTIFIER' for application '$APP_PATH'." >&2
326
- exit 1
338
+ error "Bundle Identifier '$PROVISION_BUNDLE_IDENTIFIER' in provisioning profile '$NEW_PROVISION' does not match the Bundle Identifier '$BUNDLE_IDENTIFIER' for application '$APP_PATH'."
327
339
  fi
328
340
 
329
- echo "Current bundle identifier is: '$CURRENT_BUNDLE_IDENTIFIER'" >&2
330
- echo "New bundle identifier will be: '$BUNDLE_IDENTIFIER'" >&2
341
+ log "Current bundle identifier is: '$CURRENT_BUNDLE_IDENTIFIER'"
342
+ log "New bundle identifier will be: '$BUNDLE_IDENTIFIER'"
331
343
 
332
344
  # Update the CFBundleDisplayName property in the Info.plist if a new name has been provided
333
345
  if [ "${DISPLAY_NAME}" != "" ];
334
346
  then
335
347
  if [ "${DISPLAY_NAME}" != "${CURRENT_NAME}" ];
336
348
  then
337
- echo "Changing display name from '$CURRENT_NAME' to '$DISPLAY_NAME'" >&2
349
+ log "Changing display name from '$CURRENT_NAME' to '$DISPLAY_NAME'"
338
350
  `PlistBuddy -c "Set :CFBundleDisplayName $DISPLAY_NAME" "$APP_PATH/Info.plist"`
339
351
  fi
340
352
  fi
341
353
 
342
354
  # Replace the embedded mobile provisioning profile
343
- echo "Validating the new provisioning profile: $NEW_PROVISION" >&2
355
+ log "Validating the new provisioning profile: $NEW_PROVISION"
344
356
  security cms -D -i "$NEW_PROVISION" > "$TEMP_DIR/profile.plist"
345
357
  checkStatus
346
358
 
@@ -350,13 +362,12 @@ function resign {
350
362
  APP_IDENTIFER_PREFIX=`PlistBuddy -c "Print :ApplicationIdentifierPrefix:0" "$TEMP_DIR/profile.plist"`
351
363
  if [ "$APP_IDENTIFER_PREFIX" == "" ];
352
364
  then
353
- echo "Failed to extract any app identifier prefix from '$NEW_PROVISION'" >&2
354
- exit 1;
365
+ error "Failed to extract any app identifier prefix from '$NEW_PROVISION'"
355
366
  else
356
- echo "WARNING: extracted an app identifier prefix '$APP_IDENTIFER_PREFIX' from '$NEW_PROVISION', but it was not found in the profile's entitlements" >&2
367
+ warning "WARNING: extracted an app identifier prefix '$APP_IDENTIFER_PREFIX' from '$NEW_PROVISION', but it was not found in the profile's entitlements"
357
368
  fi
358
369
  else
359
- echo "Profile app identifier prefix is '$APP_IDENTIFER_PREFIX'" >&2
370
+ log "Profile app identifier prefix is '$APP_IDENTIFER_PREFIX'"
360
371
  fi
361
372
 
362
373
  TEAM_IDENTIFIER=`PlistBuddy -c "Print :Entitlements:com.apple.developer.team-identifier" "$TEMP_DIR/profile.plist" | tr -d '\n'`
@@ -365,12 +376,12 @@ function resign {
365
376
  TEAM_IDENTIFIER=`PlistBuddy -c "Print :TeamIdentifier:0" "$TEMP_DIR/profile.plist"`
366
377
  if [ "$TEAM_IDENTIFIER" == "" ];
367
378
  then
368
- echo "Failed to extract team identifier from '$NEW_PROVISION', resigned ipa may fail on iOS 8 and higher" >&2
379
+ warning "Failed to extract team identifier from '$NEW_PROVISION', resigned ipa may fail on iOS 8 and higher"
369
380
  else
370
- echo "WARNING: extracted a team identifier '$TEAM_IDENTIFIER' from '$NEW_PROVISION', but it was not found in the profile's entitlements, resigned ipa may fail on iOS 8 and higher" >&2
381
+ warning "WARNING: extracted a team identifier '$TEAM_IDENTIFIER' from '$NEW_PROVISION', but it was not found in the profile's entitlements, resigned ipa may fail on iOS 8 and higher"
371
382
  fi
372
383
  else
373
- echo "Profile team identifier is '$TEAM_IDENTIFIER'" >&2
384
+ log "Profile team identifier is '$TEAM_IDENTIFIER'"
374
385
  fi
375
386
 
376
387
  cp "$NEW_PROVISION" "$APP_PATH/embedded.mobileprovision"
@@ -379,7 +390,7 @@ function resign {
379
390
  #if the current bundle identifier is different from the new one in the provisioning profile, then change it.
380
391
  if [ "$CURRENT_BUNDLE_IDENTIFIER" != "$BUNDLE_IDENTIFIER" ];
381
392
  then
382
- echo "Updating the bundle identifier from '$CURRENT_BUNDLE_IDENTIFIER' to '$BUNDLE_IDENTIFIER'" >&2
393
+ log "Updating the bundle identifier from '$CURRENT_BUNDLE_IDENTIFIER' to '$BUNDLE_IDENTIFIER'"
383
394
  `PlistBuddy -c "Set :CFBundleIdentifier $BUNDLE_IDENTIFIER" "$APP_PATH/Info.plist"`
384
395
  checkStatus
385
396
  fi
@@ -390,7 +401,7 @@ function resign {
390
401
  CURRENT_VERSION_NUMBER=`PlistBuddy -c "Print :CFBundleVersion" "$APP_PATH/Info.plist"`
391
402
  if [ "$VERSION_NUMBER" != "$CURRENT_VERSION_NUMBER" ];
392
403
  then
393
- echo "Updating the version from '$CURRENT_VERSION_NUMBER' to '$VERSION_NUMBER'" >&2
404
+ log "Updating the version from '$CURRENT_VERSION_NUMBER' to '$VERSION_NUMBER'"
394
405
  `PlistBuddy -c "Set :CFBundleVersion $VERSION_NUMBER" "$APP_PATH/Info.plist"`
395
406
  `PlistBuddy -c "Set :CFBundleShortVersionString $VERSION_NUMBER" "$APP_PATH/Info.plist"`
396
407
  fi
@@ -402,25 +413,24 @@ function resign {
402
413
  then
403
414
  if [ "$TEAM_IDENTIFIER" == "" ];
404
415
  then
405
- echo "ERROR: embedded frameworks detected, re-signing iOS 8 (or higher) applications wihout a team identifier in the certificate/profile does not work" >&2
406
- exit 1;
416
+ error "ERROR: embedded frameworks detected, re-signing iOS 8 (or higher) applications wihout a team identifier in the certificate/profile does not work"
407
417
  fi
408
418
 
409
- echo "Resigning embedded frameworks using certificate: '$CERTIFICATE'" >&2
419
+ log "Resigning embedded frameworks using certificate: '$CERTIFICATE'"
410
420
  for framework in "$FRAMEWORKS_DIR"/*
411
421
  do
412
422
  if [[ "$framework" == *.framework || "$framework" == *.dylib ]]
413
423
  then
414
- /usr/bin/codesign -f -s "$CERTIFICATE" "$framework"
424
+ /usr/bin/codesign ${VERBOSE} -f -s "$CERTIFICATE" "$framework"
415
425
  checkStatus
416
426
  else
417
- echo "Ignoring non-framework: $framework" >&2
427
+ log "Ignoring non-framework: $framework"
418
428
  fi
419
429
  done
420
430
  fi
421
431
 
422
432
  # Check for and update bundle identifiers for extensions and associated nested apps
423
- echo "Fixing nested app and extension references"
433
+ log "Fixing nested app and extension references"
424
434
  for key in ${NESTED_APP_REFERENCE_KEYS[@]}; do
425
435
  # Check if Info.plist has a reference to another app or extension
426
436
  REF_BUNDLE_ID=`PlistBuddy -c "Print ${key}" "$APP_PATH/Info.plist" 2>/dev/null`
@@ -433,7 +443,7 @@ function resign {
433
443
  # Change if not the same
434
444
  if [ "$REF_BUNDLE_ID" != "$NEW_REF_BUNDLE_ID" ];
435
445
  then
436
- echo "Updating nested app or extension reference for ${key} key from ${REF_BUNDLE_ID} to ${NEW_REF_BUNDLE_ID}" >&2
446
+ log "Updating nested app or extension reference for ${key} key from ${REF_BUNDLE_ID} to ${NEW_REF_BUNDLE_ID}"
437
447
  `PlistBuddy -c "Set ${key} $NEW_REF_BUNDLE_ID" "$APP_PATH/Info.plist"`
438
448
  fi
439
449
  fi
@@ -447,12 +457,10 @@ function resign {
447
457
  ENTITLEMENTS_APP_ID_PREFIX=`PlistBuddy -c "Print :application-identifier" "$ENTITLEMENTS" | grep -E '^[A-Z0-9]*' -o | tr -d '\n'`
448
458
  if [ "$ENTITLEMENTS_APP_ID_PREFIX" == "" ];
449
459
  then
450
- echo "Provided entitlements file is missing a value for the required 'application-identifier' key" >&2
451
- exit 1;
460
+ error "Provided entitlements file is missing a value for the required 'application-identifier' key"
452
461
  elif [ "$ENTITLEMENTS_APP_ID_PREFIX" != "$APP_IDENTIFER_PREFIX" ];
453
462
  then
454
- echo "Provided entitlements file's app identifier prefix value '$ENTITLEMENTS_APP_ID_PREFIX' does not match the provided provisioning profile's value '$APP_IDENTIFER_PREFIX'" >&2
455
- exit 1;
463
+ error "Provided entitlements file's app identifier prefix value '$ENTITLEMENTS_APP_ID_PREFIX' does not match the provided provisioning profile's value '$APP_IDENTIFER_PREFIX'"
456
464
  fi
457
465
  fi
458
466
 
@@ -462,41 +470,38 @@ function resign {
462
470
  ENTITLEMENTS_TEAM_IDENTIFIER=`PlistBuddy -c "Print :com.apple.developer.team-identifier" "$ENTITLEMENTS" | tr -d '\n'`
463
471
  if [ "$ENTITLEMENTS_TEAM_IDENTIFIER" == "" ];
464
472
  then
465
- echo "Provided entitlements file is missing a value for the required 'com.apple.developer.team-identifier' key" >&2
466
- exit 1;
473
+ error "Provided entitlements file is missing a value for the required 'com.apple.developer.team-identifier' key"
467
474
  elif [ "$ENTITLEMENTS_TEAM_IDENTIFIER" != "$TEAM_IDENTIFIER" ];
468
475
  then
469
- echo "Provided entitlements file's 'com.apple.developer.team-identifier' '$ENTITLEMENTS_TEAM_IDENTIFIER' does not match the provided provisioning profile's value '$TEAM_IDENTIFIER'" >&2
470
- exit 1;
476
+ error "Provided entitlements file's 'com.apple.developer.team-identifier' '$ENTITLEMENTS_TEAM_IDENTIFIER' does not match the provided provisioning profile's value '$TEAM_IDENTIFIER'"
471
477
  fi
472
478
  fi
473
479
 
474
- echo "Resigning application using certificate: '$CERTIFICATE'" >&2
475
- echo "and entitlements: $ENTITLEMENTS" >&2
480
+ log "Resigning application using certificate: '$CERTIFICATE'"
481
+ log "and entitlements: $ENTITLEMENTS"
476
482
  cp -- "$ENTITLEMENTS" "$APP_PATH/archived-expanded-entitlements.xcent"
477
- /usr/bin/codesign -f -s "$CERTIFICATE" --entitlements="$ENTITLEMENTS" "$APP_PATH"
483
+ /usr/bin/codesign ${VERBOSE} -f -s "$CERTIFICATE" --entitlements="$ENTITLEMENTS" "$APP_PATH"
478
484
  checkStatus
479
485
  else
480
- echo "Extracting entitlements from provisioning profile" >&2
486
+ log "Extracting entitlements from provisioning profile"
481
487
  PlistBuddy -x -c "Print Entitlements" "$TEMP_DIR/profile.plist" > "$TEMP_DIR/newEntitlements"
482
488
  checkStatus
483
- echo "Resigning application using certificate: '$CERTIFICATE'" >&2
484
- echo "and entitlements from provisioning profile: $NEW_PROVISION" >&2
489
+ log "Resigning application using certificate: '$CERTIFICATE'"
490
+ log "and entitlements from provisioning profile: $NEW_PROVISION"
485
491
  cp -- "$TEMP_DIR/newEntitlements" "$APP_PATH/archived-expanded-entitlements.xcent"
486
- /usr/bin/codesign -f -s "$CERTIFICATE" --entitlements="$TEMP_DIR/newEntitlements" "$APP_PATH"
492
+ /usr/bin/codesign ${VERBOSE} -f -s "$CERTIFICATE" --entitlements="$TEMP_DIR/newEntitlements" "$APP_PATH"
487
493
  checkStatus
488
494
  fi
489
495
 
490
496
  # Remove the temporary files if they were created before generating ipa
491
497
  rm -f "$TEMP_DIR/newEntitlements"
492
498
  rm -f "$TEMP_DIR/profile.plist"
493
-
494
499
  }
495
500
 
496
501
  # Sign nested applications and app extensions
497
502
  while IFS= read -d '' -r app;
498
503
  do
499
- echo "Resigning nested application: '$app'" >&2
504
+ log "Resigning nested application: '$app'"
500
505
  resign "$app" NESTED
501
506
  done < <(find "$TEMP_DIR/Payload/$APP_NAME" -d -mindepth 1 \( -name "*.app" -or -name "*.appex" \) -print0)
502
507
 
@@ -504,7 +509,7 @@ done < <(find "$TEMP_DIR/Payload/$APP_NAME" -d -mindepth 1 \( -name "*.app" -or
504
509
  resign "$TEMP_DIR/Payload/$APP_NAME"
505
510
 
506
511
  # Repackage quietly
507
- echo "Repackaging as $NEW_FILE" >&2
512
+ log "Repackaging as $NEW_FILE"
508
513
 
509
514
  # Zip up the contents of the "$TEMP_DIR" folder
510
515
  # Navigate to the temporary directory (sending the output to null)
@@ -520,4 +525,4 @@ mv "$TEMP_DIR.ipa" "$NEW_FILE"
520
525
  # Remove the temp directory
521
526
  rm -rf "$TEMP_DIR"
522
527
 
523
- echo "Process complete" >&2
528
+ log "Process complete"
@@ -4,11 +4,11 @@ module Sigh
4
4
  CLEANUP = "cleanup"
5
5
 
6
6
  def self.start(options, args)
7
- command, clean_expired, clean_pattern = get_inputs(options, args)
7
+ command, clean_expired, clean_pattern, force = get_inputs(options, args)
8
8
  if command == LIST
9
9
  list_profiles
10
10
  elsif command == CLEANUP
11
- cleanup_profiles(clean_expired, clean_pattern)
11
+ cleanup_profiles(clean_expired, clean_pattern, force)
12
12
  end
13
13
  end
14
14
 
@@ -36,8 +36,9 @@ module Sigh
36
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
+ force = options.force
39
40
  command = (!clean_expired.nil? || !clean_pattern.nil?) ? CLEANUP : LIST
40
- return command, clean_expired, clean_pattern
41
+ return command, clean_expired, clean_pattern, force
41
42
  end
42
43
 
43
44
  def self.list_profiles
@@ -51,16 +52,16 @@ module Sigh
51
52
  UI.message "Provisioning profiles installed"
52
53
  UI.message "Valid:"
53
54
  profiles_valid.each do |profile|
54
- UI.message profile["Name"].green
55
+ UI.message profile_info(profile).green
55
56
  end
56
57
  end
57
58
 
58
59
  profiles_soon = profiles.select { |profile| profile["ExpirationDate"] > now && profile["ExpirationDate"] < soon }
59
60
  if profiles_soon.count > 0
60
61
  UI.message ""
61
- UI.message "Expiring within 30 day:"
62
+ UI.message "Expiring within 30 days:"
62
63
  profiles_soon.each do |profile|
63
- UI.message profile["Name"].yellow
64
+ UI.message profile_info(profile).yellow
64
65
  end
65
66
  end
66
67
 
@@ -69,7 +70,7 @@ module Sigh
69
70
  UI.message ""
70
71
  UI.message "Expired:"
71
72
  profiles_expired.each do |profile|
72
- UI.message profile["Name"].red
73
+ UI.message profile_info(profile).red
73
74
  end
74
75
  end
75
76
 
@@ -83,7 +84,15 @@ module Sigh
83
84
  UI.message "You can remove all expired profiles using `sigh manage -e`" if profiles_expired.count > 0
84
85
  end
85
86
 
86
- def self.cleanup_profiles(expired = false, pattern = nil)
87
+ def self.profile_info(profile)
88
+ if $verbose
89
+ "#{profile['Name']} - #{File.basename profile['Path']}"
90
+ else
91
+ profile['Name']
92
+ end
93
+ end
94
+
95
+ def self.cleanup_profiles(expired = false, pattern = nil, force = nil)
87
96
  now = DateTime.now
88
97
 
89
98
  profiles = load_profiles.select { |profile| (expired && profile["ExpirationDate"] < now) || (!pattern.nil? && profile["Name"] =~ pattern) }
@@ -93,7 +102,16 @@ module Sigh
93
102
  UI.message profile["Name"].red
94
103
  end
95
104
 
96
- if agree("Delete these provisioning profiles #{profiles.length}? (y/n) ", true)
105
+ delete = force
106
+ unless delete
107
+ if Helper.ci?
108
+ UI.user_error! "On a CI server, cleanup cannot be used without the --force option"
109
+ else
110
+ delete = agree("Delete these provisioning profiles #{profiles.length}? (y/n) ", true)
111
+ end
112
+ end
113
+
114
+ if delete
97
115
  profiles.each do |profile|
98
116
  File.delete profile["Path"]
99
117
  end
@@ -150,7 +150,7 @@ module Sigh
150
150
  filters << "Owner Name: '#{Sigh.config[:cert_owner_name]}' " if Sigh.config[:cert_owner_name]
151
151
  filters << "Certificate ID: '#{Sigh.config[:cert_id]}' " if Sigh.config[:cert_id]
152
152
  UI.important "No certificates for filter: #{filters}" if filters.length > 0
153
- UI.user_error!("Could not find a matching code signing identity for #{profile_type}. You can use cert to generate one (https://github.com/fastlane/cert)")
153
+ UI.user_error!("Could not find a matching code signing identity for #{profile_type}. You can use cert to generate one (https://github.com/fastlane/fastlane/tree/master/cert)")
154
154
  end
155
155
 
156
156
  return certificates if Sigh.config[:development] # development profiles support multiple certificates
@@ -1,3 +1,3 @@
1
1
  module Sigh
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.1"
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.4.0
4
+ version: 1.4.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: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  requirements: []
234
234
  rubyforge_project:
235
- rubygems_version: 2.4.5.1
235
+ rubygems_version: 2.2.2
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: Because you would rather spend your time building stuff than fighting provisioning