cert 0.1.0 → 0.1.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: 6144b46854a7c5b8125135062907eca353cef490
4
- data.tar.gz: d107c1c5f6ad757c4b8cbf3340cdd306a34a6fe4
3
+ metadata.gz: e27598992c352ec26e99815898586e1ba85c6d1e
4
+ data.tar.gz: a4415ab01ec9879ee2be155717c1f75f1d02d5bc
5
5
  SHA512:
6
- metadata.gz: c084c2f0985bae99f5c43d79a3ac4388262351a13843f34472461658e884f92c401c36b25d5ee60670696cb594432a2bd7abcc28e459432cb3f8a9108ebde5c9
7
- data.tar.gz: 7698d2b47357a8c504f2e10e579f92ad3ad532b258d805befc99a0efa82fb61655eedd275f6629d8e4eeed7db5c24715c8b7ced9d16b4ed100870dc5780d9db1
6
+ metadata.gz: 87ad0f5a9e10c8e150b974ec3c5442ec480a4ea26790dc6f510e193b3bdfe6f5caef09fcd648afe995f7e498870857822120ecfe03fa3e385cd1894f7ddfc5b6
7
+ data.tar.gz: e469f9b484544a7b49a96223cb82fb94bce02c0b17f145a5d3fdf31e6d3ac53f20ee81d8ca55a8c170b4831ba19a2ecbd7d81aa8a70990220d6ea35d4be301af
data/README.md CHANGED
@@ -12,7 +12,8 @@
12
12
  <a href="https://github.com/KrauseFx/pem">PEM</a> &bull;
13
13
  <a href="https://github.com/KrauseFx/sigh">sigh</a> &bull;
14
14
  <a href="https://github.com/KrauseFx/produce">produce</a> &bull;
15
- <b>cert</b>
15
+ <b>cert</b> &bull;
16
+ <a href="https://github.com/KrauseFx/codes">codes</a>
16
17
  </p>
17
18
  -------
18
19
 
@@ -20,7 +21,7 @@
20
21
  <img src="assets/cert.png">
21
22
  </p>
22
23
 
23
- cert - Create new iOS signing certificates
24
+ cert
24
25
  ============
25
26
 
26
27
  [![Twitter: @KauseFx](https://img.shields.io/badge/contact-@KrauseFx-blue.svg?style=flat)](https://twitter.com/KrauseFx)
@@ -45,7 +46,7 @@ Get in contact with the developer on Twitter: [@KrauseFx](https://twitter.com/Kr
45
46
 
46
47
  -------
47
48
 
48
- <h5 align="center"><code>cert</code> is part of <a href="http://fastlane.tools">fastlane</a>: connect all deployment tools into one streamlined workflow.</h5>
49
+ <h5 align="center"><code>cert</code> is part of <a href="https://fastlane.tools">fastlane</a>: connect all deployment tools into one streamlined workflow.</h5>
49
50
 
50
51
 
51
52
 
@@ -58,19 +59,21 @@ Make sure, you have the latest version of the Xcode command line tools installed
58
59
 
59
60
  # Why?
60
61
 
61
- Please check out [this guide](https://github.com/KrauseFx/cert/blob/master/ManualSteps.md) to get started with a signing certificate and a provisioning profile.
62
+ Please check out [this guide](https://github.com/KrauseFx/cert/blob/master/ManualSteps.md) which shows how to manually create an iOS code signing profile and a provisioning profile using the Apple Developer Portal.
62
63
 
63
- **After** checking out the [guide](https://github.com/KrauseFx/cert/blob/master/ManualSteps.md), take a look at this lovely gif:
64
+ **After** checking out the [guide](https://github.com/KrauseFx/cert/blob/master/ManualSteps.md), take a look how `cert` and [`sigh`](https://github.com/KrauseFx/sigh) do all that for you.
64
65
 
65
66
  ![assets/cert.gif](assets/cert.gif)
66
67
 
67
68
  In the gif I used `cert && sigh`, which will first create an iOS code signing certificate and then a provisioning profile for your app if `cert` succeeded.
68
69
 
70
+ ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
71
+
69
72
  # Usage
70
73
 
71
74
  cert
72
75
 
73
- This will check if any of the available signing certificates is installed.
76
+ This will check if any of the available signing certificates is installed on your local machine.
74
77
 
75
78
  Only if a new certificate needs to be created, `cert` will
76
79
 
@@ -123,21 +126,21 @@ This will result in `sigh` always using the correct signing certificate, which i
123
126
 
124
127
  # Tips
125
128
 
126
- ## [`fastlane`](http://fastlane.tools) Toolchain
129
+ ## [`fastlane`](https://fastlane.tools) Toolchain
127
130
 
128
- - [`fastlane`](http://fastlane.tools): Connect all deployment tools into one streamlined workflow
131
+ - [`fastlane`](https://fastlane.tools): Connect all deployment tools into one streamlined workflow
129
132
  - [`deliver`](https://github.com/KrauseFx/deliver): Upload screenshots, metadata and your app to the App Store using a single command
130
133
  - [`snapshot`](https://github.com/KrauseFx/snapshot): Automate taking localized screenshots of your iOS app on every device
131
134
  - [`frameit`](https://github.com/KrauseFx/frameit): Quickly put your screenshots into the right device frames
132
135
  - [`PEM`](https://github.com/KrauseFx/pem): Automatically generate and renew your push notification profiles
133
136
  - [`sigh`](https://github.com/KrauseFx/sigh): Because you would rather spend your time building stuff than fighting provisioning
134
137
  - [`produce`](https://github.com/KrauseFx/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
138
+ - [`codes`](https://github.com/KrauseFx/codes): Create promo codes for iOS Apps using the command line
135
139
 
136
- ## Use the 'Provisioning Quicklook plugin'
137
- Download and install the [Provisioning Plugin](https://github.com/chockenberry/Provisioning).
138
-
139
- ![assets/QuickLookScreenshot.png](assets/QuickLookScreenshot.png)
140
+ ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
140
141
 
142
+ ## Use the 'Provisioning Quicklook plugin'
143
+ Download and install the [Provisioning Plugin](https://github.com/chockenberry/Provisioning) to easily preview provisioning profile files and certificates.
141
144
 
142
145
  # Need help?
143
146
  - If there is a technical problem with ```cert```, submit an issue.
data/bin/cert CHANGED
@@ -16,13 +16,14 @@ class CertApplication
16
16
  program :version, Cert::VERSION
17
17
  program :description, 'CLI for \'cert\' - Create new iOS code signing certificates'
18
18
  program :help, 'Author', 'Felix Krause <cert@krausefx.com>'
19
- program :help, 'Website', 'http://fastlane.tools'
19
+ program :help, 'Website', 'https://fastlane.tools'
20
20
  program :help, 'GitHub', 'https://github.com/krausefx/cert'
21
21
  program :help_formatter, :compact
22
22
 
23
23
  always_trace!
24
24
 
25
25
  global_option '-u', '--username STRING', 'Your Apple ID username'
26
+ global_option '--development', 'Create a development certificate instead of a distribution one.'
26
27
 
27
28
  command :create do |c|
28
29
  c.syntax = 'cert create'
@@ -31,7 +32,10 @@ class CertApplication
31
32
  c.action do |args, options|
32
33
  username(options)
33
34
 
34
- Cert::CertRunner.run
35
+ type = Cert::DeveloperCenter::DISTRIBUTION
36
+ type = Cert::DeveloperCenter::DEVELOPMENT if options.development
37
+
38
+ Cert::CertRunner.run(type)
35
39
 
36
40
  installed = Cert::CertChecker.is_installed?ENV["CER_FILE_PATH"]
37
41
  raise "Could not find the newly generated certificate installed" unless installed
@@ -1,7 +1,7 @@
1
1
  module Cert
2
2
  class CertRunner
3
- def self.run
4
- FastlaneCore::DeveloperCenter.new.run
3
+ def self.run(type)
4
+ Cert::DeveloperCenter.new.run(type)
5
5
  end
6
6
  end
7
7
  end
@@ -1,29 +1,37 @@
1
1
  require 'fastlane_core/developer_center/developer_center'
2
2
 
3
- module FastlaneCore
4
- class DeveloperCenter
5
- CERTS_URL = "https://developer.apple.com/account/ios/certificate/certificateList.action"
3
+ module Cert
4
+ class DeveloperCenter < FastlaneCore::DeveloperCenter
5
+ DISTRIBUTION = "Distribution"
6
+ DEVELOPMENT = "Development"
7
+
8
+ CERTS_URL = "https://developer.apple.com/account/ios/certificate/certificateList.action?type=distribution"
9
+ CERTS_URL_DEV = "https://developer.apple.com/account/ios/certificate/certificateList.action?type=development"
6
10
  CREATE_CERT_URL = "https://developer.apple.com/account/ios/certificate/certificateCreate.action"
7
11
 
8
12
  # This will check if there is at least one of the certificates already installed on the local machine
9
13
  # This will store the resulting file name in ENV 'CER_FILE_PATH' and the Cert ID in 'CER_CERTIFICATE_ID'
10
- def run
11
- file = find_existing_cert
14
+ def run(type)
15
+ file = find_existing_cert(type)
12
16
  if file
13
17
  # We don't need to do anything :)
14
18
  ENV["CER_FILE_PATH"] = file
15
19
  else
16
- create_certificate
20
+ create_certificate(type)
17
21
  end
18
22
  rescue => ex
19
23
  error_occured(ex)
20
24
  end
21
25
 
22
- def find_existing_cert
23
- visit "#{CERTS_URL}?type=distribution"
26
+ def find_existing_cert(type)
27
+ if type == DEVELOPMENT
28
+ visit CERTS_URL_DEV
29
+ else
30
+ visit CERTS_URL
31
+ end
24
32
 
25
33
  # Download all available certs to check if they are installed using the SHA1 hash
26
- certs = code_signing_certificate
34
+ certs = code_signing_certificate(type)
27
35
  certs.each do |current|
28
36
  display_id = current['certificateId']
29
37
  type_id = current['certificateTypeDisplayId']
@@ -46,14 +54,16 @@ module FastlaneCore
46
54
  end
47
55
 
48
56
  # This will actually create a new certificate
49
- def create_certificate
57
+ def create_certificate(type)
50
58
  visit CREATE_CERT_URL
51
59
  wait_for_elements("form[name='certificateSave']")
52
60
 
53
61
  Helper.log.info "Creating a new code signing certificate"
54
62
 
55
63
  # select certificate type
56
- app_store_toggle = first("input#type-iosNoOCSP")
64
+ toggle_value = 'type-iosNoOCSP'
65
+ toggle_value = 'type-development' if type == DEVELOPMENT
66
+ app_store_toggle = first("input##{toggle_value}")
57
67
  if !!app_store_toggle['disabled']
58
68
  # Limit of certificates already reached
59
69
  raise "Could not create another certificate, reached the maximum number of available certificates.".red
@@ -67,7 +77,6 @@ module FastlaneCore
67
77
 
68
78
  cert_signing_request = Cert::SigningRequest.get_path
69
79
  Helper.log.info "Uploading the cert signing request '#{cert_signing_request}'"
70
-
71
80
 
72
81
  wait_for_elements("input[name='upload']").first.set cert_signing_request # upload the cert signing request
73
82
  sleep 1
@@ -86,12 +95,12 @@ module FastlaneCore
86
95
  # Now download the certificate
87
96
  download_button = wait_for_elements(".button.small.blue").first
88
97
  url = download_button['href']
89
-
98
+
90
99
  path = File.join(TMP_FOLDER, "certificate.cer")
91
100
  download_url(url, path)
92
-
101
+
93
102
  certificate_id = url.match(/.*displayId=(.*)&type.*/)[1]
94
-
103
+
95
104
  ENV["CER_FILE_PATH"] = path
96
105
  ENV["CER_CERTIFICATE_ID"] = certificate_id
97
106
  Helper.log.info "Successfully downloaded latest .cer file to '#{path}' (#{certificate_id})".green
@@ -117,7 +126,7 @@ module FastlaneCore
117
126
  raise "Something went wrong when downloading the certificate" unless data
118
127
 
119
128
  dataWritten = File.write(output_path, data)
120
-
129
+
121
130
  if dataWritten == 0
122
131
  raise "Can't write to #{output_path}"
123
132
  end
@@ -141,9 +150,12 @@ module FastlaneCore
141
150
  # "certificateTypeDisplayId"=>"...",
142
151
  # "serialNum"=>"....",
143
152
  # "typeString"=>"iOS Distribution"},
144
- def code_signing_certificate
145
- certs_url = "https://developer.apple.com/account/ios/certificate/certificateList.action?type=distribution"
146
- visit certs_url
153
+ def code_signing_certificate(type)
154
+ if type == DEVELOPMENT
155
+ visit CERTS_URL_DEV
156
+ else
157
+ visit CERTS_URL
158
+ end
147
159
 
148
160
  certificateDataURL = wait_for_variable('certificateDataURL')
149
161
  certificateRequestTypes = wait_for_variable('certificateRequestTypes')
@@ -155,16 +167,18 @@ module FastlaneCore
155
167
 
156
168
  available = []
157
169
 
170
+ certTypeName = 'iOS Distribution'
171
+ certTypeName = 'iOS Development' if type == DEVELOPMENT
158
172
  certs = post_ajax(url)['certRequests']
159
173
  certs.each do |current_cert|
160
- if current_cert['typeString'] == 'iOS Distribution'
174
+ if current_cert['typeString'] == certTypeName
161
175
  # The other profiles are push profiles
162
176
  # We only care about the distribution profile
163
177
  available << current_cert # mostly we only care about the 'certificateId'
164
178
  end
165
179
  end
166
180
 
167
- return available
181
+ return available
168
182
  end
169
183
 
170
184
  def click_next
@@ -1,3 +1,5 @@
1
+ require 'openssl'
2
+
1
3
  module Cert
2
4
  class SigningRequest
3
5
  def self.get_path
data/lib/cert/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cert
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -141,7 +141,7 @@ files:
141
141
  - lib/cert/keychain_importer.rb
142
142
  - lib/cert/signing_request.rb
143
143
  - lib/cert/version.rb
144
- homepage: http://fastlane.tools
144
+ homepage: https://fastlane.tools
145
145
  licenses:
146
146
  - MIT
147
147
  metadata: {}