certstepper 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/certstepper.rb +35 -15
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e609908e4ef8c3cbd7acfa980f0a717c1630011
4
- data.tar.gz: 1fa74cf6a1e1c67ee7a682498cefe8e5d9f453d8
3
+ metadata.gz: a10e16af831fd8f23aad6b7823bca78111800ec8
4
+ data.tar.gz: 262bdc266edd1b8b1e762b9256040b5486742a7e
5
5
  SHA512:
6
- metadata.gz: 832ba2694ec8f7f3bdfb0ce27596b276a6b10f8b37d2b77f7d247cd3c6d2965cfa5384af9bb33fbcef0f9c5bb97b172470b90f5322aa4e979905822eb3d656e0
7
- data.tar.gz: cac9a78a60b85d25efc2e4e36d03331f7301f2724c324896e5805bb67a9f06aafb96620f40d0d67e59715f459152483aa61c2ae577153ca2e3a9fb655af8f509
6
+ metadata.gz: 938e94de0269b821dd132e4cbb6ddaac0b26d9c57886aa1b6d65784f7a8dea1e1f6aa59f89d3004e09fb5b0731afc8669b6d58842023b464c8f25fb82cb29b97
7
+ data.tar.gz: 4956383be018681aef60f91f0d5e2dde3179c043d9ee9be1470dccb40f47a402403166594c724816c7e3d291a91443c498d3e4884838eef507f33fc12a2ba5fd
data/lib/certstepper.rb CHANGED
@@ -79,8 +79,8 @@ module CertStepper
79
79
 
80
80
  opts.on('-t cert_type','--type cert_type','生成证书和配置文件的类型 development adhoc distribution') do |value|
81
81
  if value.start_with? 'ad'
82
- @options[:cert_type] = ""
83
- @options[:profile_type] = "--adhoc"
82
+ @options[:cert_type] = "--adhoc"
83
+ @options[:profile_type] = ""
84
84
  elsif value.start_with? 'dev'
85
85
  @options[:cert_type] = "--development"
86
86
  @options[:profile_type] = "--development"
@@ -143,17 +143,20 @@ module CertStepper
143
143
 
144
144
  createKeychain cert_path
145
145
  system "cert -u #{cert.email} -o #{cert_path} #{@options[:cert_type]}"
146
- dealCert cert_path
146
+ dealCert cert , cert_path
147
147
 
148
148
 
149
149
  system "produce -u #{cert.email} -a #{cert.profile_id} --app_name #{cert.profile_name} --skip_itc"
150
150
  system "sigh -a #{cert.profile_id} -u #{cert.email} -o #{cert_path} #{@options[:profile_type]}"
151
151
  #system "sigh -a #{cert.profile_id} -u #{cert.email} -o #{cert_path} --adhoc"
152
152
 
153
+
153
154
  if !generateCertSuccessfully? cert
154
155
  failed_cert_array << cert.email
155
156
  end
156
157
 
158
+ deleteUnusefulFile cert_path
159
+
157
160
  end
158
161
 
159
162
 
@@ -166,23 +169,38 @@ module CertStepper
166
169
 
167
170
  end
168
171
 
172
+ end
173
+
174
+ def self.deleteUnusefulFile(de_path)
175
+ console_de_path = de_path.gsub /[\s]/ , "\\ "
176
+ Dir.entries(de_path).each do |file_name|
177
+ if file_name.end_with? '.cer'
178
+ file_path = "#{de_path}/#{file_name}"
179
+ system "rm #{console_de_path}/#{file_name}"
180
+ system "rm #{console_de_path}/#{File.basename(file_path,'.*')}.p12"
181
+ system "rm #{console_de_path}/#{File.basename(file_path,'.*')}.certSigningRequest"
182
+ end
183
+ end
169
184
 
170
185
  end
171
186
 
172
187
  def self.generateCertSuccessfully?(cert)
173
188
  cert_path = @@root_path + "/#{cert.profile_name}"
189
+ puts cert_path
174
190
  is_p12_exist = false
175
191
  is_cer_exist = false
176
192
  is_provision_exist = false
177
- Dir.entries(de_path).each do |file_name|
178
- if file_name.end_with? ".p12"
179
- is_p12_exist = true
180
- elsif file_name.end_with? ".cer"
181
- is_cer_exist = true
182
- elsif file_name.end_with? ".mobileprovision"
183
- is_provision_exist = true
193
+ if File.exists? cert_path
194
+ Dir.entries(cert_path).each do |file_name|
195
+ if file_name.end_with? ".p12"
196
+ is_p12_exist = true
197
+ elsif file_name.end_with? ".cer"
198
+ is_cer_exist = true
199
+ elsif file_name.end_with? ".mobileprovision"
200
+ is_provision_exist = true
201
+ end
184
202
  end
185
- end
203
+ end
186
204
 
187
205
  return is_p12_exist && is_cer_exist && is_provision_exist
188
206
  end
@@ -211,7 +229,7 @@ module CertStepper
211
229
  new_cert.password = line_content.strip
212
230
  when 2
213
231
  new_cert.profile_id = line_content.strip
214
- new_cert.profile_name = line_content.strip.scan(/\b\w?\d+\b/).join ""
232
+ new_cert.profile_name = line_content
215
233
  end
216
234
  index+=1
217
235
  end
@@ -246,18 +264,20 @@ module CertStepper
246
264
  system "security create-keychain -p 123456 #{@keychain_path}"
247
265
  end
248
266
 
249
- def self.dealCert(de_path)
267
+ def self.dealCert(cert,de_path)
250
268
  console_de_path = de_path.gsub /[\s]/ , "\\ "
251
269
  Dir.entries(de_path).each do |file_name|
252
270
  if file_name.end_with? '.cer'
253
271
  #system "security add-trusted-cert -r unspecified -k 123456 #{File.expand_path('~')}/Downloads/ios_development.cer"
254
- system "security import #{de_path}/#{file_name} -k #{@keychain_path}"
255
- system "security export -k #{@keychain_path} -t certs -f pkcs12 -P 123 -o #{console_de_path}/cert.p12"
272
+ system "security import #{console_de_path}/#{file_name} -k #{@keychain_path}"
273
+ system "security export -k #{@keychain_path} -t certs -f pkcs12 -P 123 -o #{console_de_path}/#{cert.profile_name}.p12"
256
274
  system "security delete-keychain #{@keychain_path}"
275
+
257
276
  end
258
277
  end
259
278
  end
260
279
 
280
+
261
281
  def self.dealCertByChrome(root_path , profile_name)
262
282
  system "security create-keychain -P 123456"
263
283
  system "security add-trusted-cert -r unspecified -k 123456 #{File.expand_path('~')}/Downloads/ios_development.cer"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: certstepper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - chengkai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-20 00:00:00.000000000 Z
11
+ date: 2016-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cert