iosdeveloper 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/iosdeveloper CHANGED
@@ -65,21 +65,18 @@ command 'add-device' do |c|
65
65
  end
66
66
  end
67
67
 
68
- desc 'Downloads provisioning profile and saves it in current directory'
69
- arg_name 'PROFILE_NAME'
70
- command 'download-profile' do |c|
71
- c.action do |global_options, options, args|
72
- profile_name = args.shift
73
- portal(global_options).download_profile(profile_name)
74
- end
75
- end
76
-
77
68
  desc 'Installs provisioning profile'
78
69
  arg_name 'PROFILE_NAME'
79
70
  command 'install-profile' do |c|
71
+ c.switch [:a, 'all']
80
72
  c.action do |global_options, options, args|
81
- profile_name = args.shift
82
- portal(global_options).install_profile(profile_name)
73
+ portal = portal(global_options)
74
+ if (options[:a])
75
+ portal.install_profile
76
+ else
77
+ profile_name = args.shift
78
+ portal.install_profile(profile_name)
79
+ end
83
80
  end
84
81
  end
85
82
 
@@ -1,4 +1,6 @@
1
1
  require "mechanize"
2
+ require "plist"
3
+ require "fileutils"
2
4
 
3
5
  module IOSDeveloper
4
6
 
@@ -102,17 +104,29 @@ module IOSDeveloper
102
104
  def download_profile(profile_name, location=".")
103
105
  profiles = list_profiles
104
106
  profiles.each do |profile|
105
- if profile.name == profile_name
106
- file_name = "#{location}/#{profile_name}.mobileprovision"
107
- @agent.get(profile.download_url).save(file_name)
108
- puts "Saved #{profile_name} profile in #{file_name}"
109
- return
107
+ if profile_name.nil? || (profile.name == profile_name)
108
+ temporal_file_location = "#{profile.name}.mobileprovision"
109
+ puts "Downloading #{profile.name} ..."
110
+ @agent.get(profile.download_url).save(temporal_file_location)
111
+ uuid = get_uuid(temporal_file_location)
112
+ file_location = "#{location}/#{uuid}.mobileprovision"
113
+ FileUtils.move(temporal_file_location, file_location)
114
+ puts "Saved #{profile.name} profile in #{file_location}"
110
115
  end
111
116
  end
112
- puts "Could not find profile with name: #{profile_name}"
113
117
  end
114
118
 
115
- def install_profile profile_name
119
+ def get_uuid profile_file
120
+ p7 = OpenSSL::PKCS7.new(File.read(profile_file))
121
+ store = OpenSSL::X509::Store.new
122
+ cert = OpenSSL::X509::Certificate.new(File.read("AppleIncRootCertificate.cer"))
123
+ store.add_cert(cert)
124
+ p7.verify([cert], store)
125
+ hash = Plist::parse_xml(p7.data)
126
+ hash["UUID"]
127
+ end
128
+
129
+ def install_profile profile_name=nil
116
130
  download_profile(profile_name, PROVISIONING_PROFILES_LOCATION)
117
131
  end
118
132
 
@@ -1,3 +1,3 @@
1
1
  module IOSDeveloper
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iosdeveloper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
12
+ date: 2013-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70202361110760 !ruby/object:Gem::Requirement
16
+ requirement: &70251413651520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70202361110760
24
+ version_requirements: *70251413651520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &70202361110320 !ruby/object:Gem::Requirement
27
+ requirement: &70251413651080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70202361110320
35
+ version_requirements: *70251413651080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: aruba
38
- requirement: &70202361109900 !ruby/object:Gem::Requirement
38
+ requirement: &70251413650660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70202361109900
46
+ version_requirements: *70251413650660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: gli
49
- requirement: &70202361109380 !ruby/object:Gem::Requirement
49
+ requirement: &70251413650160 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
@@ -54,10 +54,21 @@ dependencies:
54
54
  version: 2.5.3
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70202361109380
57
+ version_requirements: *70251413650160
58
+ - !ruby/object:Gem::Dependency
59
+ name: plist
60
+ requirement: &70251413649660 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - =
64
+ - !ruby/object:Gem::Version
65
+ version: 3.1.0
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70251413649660
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: mechanize
60
- requirement: &70202361108880 !ruby/object:Gem::Requirement
71
+ requirement: &70251413649200 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - =
@@ -65,7 +76,7 @@ dependencies:
65
76
  version: 2.5.1
66
77
  type: :runtime
67
78
  prerelease: false
68
- version_requirements: *70202361108880
79
+ version_requirements: *70251413649200
69
80
  description: Command line tools for accessing iOS Provisioning Portal
70
81
  email: marcin.kwiatkowski@hotmail.com
71
82
  executables: