certstepper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/certstepper +3 -0
  3. data/lib/certstepper.rb +100 -0
  4. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4e5b049aaaf45453551d3c080f36c4e183a7ef15
4
+ data.tar.gz: 8efb873d8e23cf5306ac8037609c9ed9c2425701
5
+ SHA512:
6
+ metadata.gz: 9f5dcce7bf07ac58233d7bc56a75a96a3c497c7ff4fe843fa3d0cec9e52b2b5252c944f4e188bd7dea194b863785797a8ac127a9a2ccc0738df7c0172655ac69
7
+ data.tar.gz: e0359efd5616cbbc2a97a491ccf0f7c1856e2355cd81c453ce8edbf3615f2eba625157b342def258ad95b74e5120b2ae0d2a5b2d830abaa45c5dd66b89a3a869
data/bin/certstepper ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'certstepper'
3
+ CertStepper::startStep
@@ -0,0 +1,100 @@
1
+ require "pathname"
2
+ require "fileutils"
3
+ module CertStepper
4
+
5
+ class Cert
6
+ attr_accessor :email
7
+ attr_accessor :password
8
+ attr_accessor :profile_id
9
+ attr_accessor :profile_name
10
+ end
11
+
12
+ def self.startStep
13
+ # if ARGV.length==0 || ARGV == nil
14
+ # puts "error: Parameter does not match,there is not any parameter"
15
+ # return nil
16
+ # end
17
+
18
+ self.parseData
19
+
20
+ console_root_path = @@root_path.gsub /[\s]/ , "\\ "
21
+ open_dir ="open #{console_root_path}"
22
+ system("open #{console_root_path}")
23
+ puts "Apple Cert Create Stepper\n"
24
+ @@certs.each do |cert|
25
+ puts "----------- begin #{cert.profile_id} Cert ----------- \n"
26
+ self.createDir @@root_path + "/#{cert.profile_name}"
27
+ puts "1. copy profile name. <press enter>"
28
+ self.getUserInput
29
+ self.copyToClipboard cert.profile_name
30
+ puts "name coppied : #{cert.profile_name}\n"
31
+ puts "\n2. copy profile id. <press enter>"
32
+ self.getUserInput
33
+ self.copyToClipboard cert.profile_id
34
+ puts "id coppied : #{cert.profile_id}"
35
+ puts "\n3. move profile to destination from download. <press enter>"
36
+ self.getUserInput
37
+ mobileprovision_name = "#{cert.profile_name}.mobileprovision"
38
+ source_file = "#{File.expand_path('~')}/Downloads/#{mobileprovision_name}"
39
+ dest_file = "#{@@root_path}/#{cert.profile_name}/#{mobileprovision_name}"
40
+ if File.exist? source_file
41
+ FileUtils.mv source_file , dest_file
42
+ puts "#{mobileprovision_name} moved\n\n"
43
+ else
44
+ puts "#{mobileprovision_name} doesn't exist. Please download and move by yourself !\n\n"
45
+ end
46
+
47
+ end
48
+ end
49
+
50
+ def self.parseData
51
+ @@certs = Array.new
52
+ index = 0
53
+ file_name = ARGV[0]
54
+ @@root_path = Pathname.new(file_name).parent.to_s
55
+ @@file_path
56
+ new_cert = nil
57
+ file = File.open(file_name , "r")
58
+ line_array = file.readlines
59
+ file_content= line_array.join
60
+ file_content = file_content.gsub /[\r]/,"\n"
61
+ file_content.each_line do |line|
62
+
63
+ cert_prop_index = index%3
64
+ line_content = line.gsub! /[\s\n\t\r]/ ,""
65
+ if !line_content.empty?
66
+ case cert_prop_index
67
+ when 0
68
+ new_cert = Cert.new
69
+ @@certs << new_cert
70
+ new_cert.email = line_content.strip
71
+ when 1
72
+ new_cert.password = line_content.strip
73
+ when 2
74
+ new_cert.profile_id = line_content.strip
75
+ new_cert.profile_name = line_content.strip.split(".")[1]
76
+ end
77
+ index+=1
78
+ end
79
+ end
80
+ file.close
81
+
82
+ end
83
+
84
+ def self.copyToClipboard(content)
85
+ system ("echo #{content} | pbcopy")
86
+ end
87
+
88
+ def self.createDir(filePath)
89
+ Dir.mkdir filePath if !Dir.exist? filePath
90
+ end
91
+
92
+ def self.getUserInput
93
+ begin
94
+ $stdin.gets
95
+ rescue => e
96
+
97
+ end
98
+ end
99
+
100
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: certstepper
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - chengkai
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: fetch apple app
14
+ email: chengkai@1853.com
15
+ executables:
16
+ - certstepper
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/certstepper.rb
21
+ - bin/certstepper
22
+ homepage: http://rubygems.org/gems/certstepper
23
+ licenses: []
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.0.14
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: fetch app
45
+ test_files: []