cupertino 1.0.2 → 1.1.2

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: 32f7d124c3b489a1f344e7b9f55a3ebb402c9f52
4
- data.tar.gz: a3301adfc2687b34c8b7e986a95482f4dc3cfe9e
3
+ metadata.gz: 5ddb87126d4d06a1aa10f8f64f2f9c792df0a6b1
4
+ data.tar.gz: 859843cd43bb74394cbc2bdbc99e71368530d1c9
5
5
  SHA512:
6
- metadata.gz: 188a348aff0d568890d6d653e08e1b129224af2e20e1c014f0feea1d2f288776bb9b170f9e9ab20e71b148bebf7da7923df6772f3d63ab6c7a9de399f4ee9429
7
- data.tar.gz: 725a0d9913edd6ccc26e5ce7c08077292dac89be09de5dd28bd5b9fe8ed53ffff814ba1bf749b120a58fd0f06d86e60e945fbff9def0e703dafbfe8ab7772560
6
+ metadata.gz: 59d1bf441b4130af6142e0cda67e3ea32445649de4289b686f1722e5b0660e810d7b6bde14ab69f20631fa087bc71dfae62e24120b66390ad7a4ef3ebfd7641f
7
+ data.tar.gz: 3559e83308f539c75026cfb99685fbff49740dce9a491e82b0a7f789ab1933d1971e97c1e8ba09031da9d4cbe6e21bfadb5f492d78bb7677ccc73dfe9f5856fe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cupertino (1.0.2)
4
+ cupertino (1.1.2)
5
5
  certified (>= 0.1.0)
6
6
  commander (~> 4.1.2)
7
7
  mechanize (~> 2.5.1)
@@ -14,7 +14,7 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- aws-sdk (1.40.2)
17
+ aws-sdk (1.50.0)
18
18
  json (~> 1.4)
19
19
  nokogiri (>= 1.4.4)
20
20
  certified (0.1.2)
@@ -59,8 +59,8 @@ GEM
59
59
  rspec-expectations (2.14.5)
60
60
  diff-lcs (>= 1.1.3, < 2.0)
61
61
  rspec-mocks (2.14.6)
62
- rubyzip (1.1.3)
63
- security (0.1.2)
62
+ rubyzip (1.1.6)
63
+ security (0.1.3)
64
64
  shenzhen (0.7.0)
65
65
  aws-sdk (~> 1.0)
66
66
  commander (~> 4.1)
data/README.md CHANGED
@@ -9,90 +9,135 @@ Automate administrative tasks that you would normally have to do through the App
9
9
 
10
10
  Cupertino requires the [Xcode Command Line Tools](https://developer.apple.com/xcode/), which can be installed with the following command:
11
11
 
12
- $ xcode-select --install
12
+ ```
13
+ $ xcode-select --install
14
+ ```
13
15
 
14
16
  ## Installation
15
17
 
16
- $ gem install cupertino
18
+ ```
19
+ $ gem install cupertino
20
+ ```
17
21
 
18
22
  ## Usage
19
23
 
20
24
  ### Authentication
21
25
 
22
- $ ios login
23
-
26
+ ```
27
+ $ ios login
28
+ ```
24
29
 
25
30
  _Credentials are saved in the Keychain. You will not be prompted for your username or password by commands while you are logged in. (Mac only)_
26
31
 
27
32
  ### Devices
28
33
 
29
- $ ios devices:list
34
+ ```
35
+ $ ios devices:list
30
36
 
31
- +------------------------------+---------------------------------------+
32
- | Listing 2 devices. You can register 98 additional devices. |
33
- +---------------------------+------------------------------------------+
34
- | Device Name | Device Identifier |
35
- +---------------------------+------------------------------------------+
36
- | Johnny Appleseed iPad | 0123456789012345678901234567890123abcdef |
37
- | Johnny Appleseed iPhone | abcdef0123456789012345678901234567890123 |
38
- +---------------------------+------------------------------------------+
37
+ +------------------------------+---------------------------------------+
38
+ | Listing 2 devices. You can register 98 additional devices. |
39
+ +---------------------------+------------------------------------------+
40
+ | Device Name | Device Identifier |
41
+ +---------------------------+------------------------------------------+
42
+ | Johnny Appleseed iPad | 0123456789012345678901234567890123abcdef |
43
+ | Johnny Appleseed iPhone | abcdef0123456789012345678901234567890123 |
44
+ +---------------------------+------------------------------------------+
39
45
 
40
- $ ios devices:add "iPad 1"=abc123
41
- $ ios devices:add "iPad 2"=def456 "iPad 3"=ghi789 ...
46
+ $ ios devices:add "iPad 1"=abc123
47
+ $ ios devices:add "iPad 2"=def456 "iPad 3"=ghi789 ...
48
+ ```
42
49
 
43
50
  ### Provisioning Profiles
44
51
 
45
- $ ios profiles:list
52
+ ```
53
+ $ ios profiles:list
46
54
 
47
- +----------------------------------+--------------+---------+
48
- | Profile | App ID | Status |
49
- +----------------------------------+--------------+---------+
50
- | iOS Team Provisioning Profile: * | ABCDEFG123.* | Valid |
51
- +----------------------------------+--------------+---------+
55
+ +----------------------------------+--------------+---------+
56
+ | Profile | App ID | Status |
57
+ +----------------------------------+--------------+---------+
58
+ | iOS Team Provisioning Profile: * | ABCDEFG123.* | Valid |
59
+ +----------------------------------+--------------+---------+
60
+ ```
52
61
 
53
62
  ---
54
63
 
55
- $ ios profiles:manage:devices
64
+ ```
65
+ $ ios profiles:manage:devices
66
+ ```
56
67
 
57
68
  _Opens an editor with a list of devices, each of which can be commented / uncommented to turn them off / on for that provisioning profile._
58
69
 
59
- # Comment / Uncomment Devices to Turn Off / On for Provisioning Profile
60
- Johnny Appleseed iPad 0123456789012345678901234567890123abcdef
61
- # Johnny Appleseed iPhone abcdef0123456789012345678901234567890123
62
-
70
+ ```
71
+ # Comment / Uncomment Devices to Turn Off / On for Provisioning Profile
72
+ Johnny Appleseed iPad 0123456789012345678901234567890123abcdef
73
+ # Johnny Appleseed iPhone abcdef0123456789012345678901234567890123
74
+ ```
63
75
 
64
- $ ios profiles:devices:add MyApp_Development_Profile "Johnny Appleseed iPad"=0123456789012345678901234567890123abcdef "Johnny Appleseed iPhone"=abcdef0123456789012345678901234567890123
76
+ ```
77
+ $ ios profiles:devices:add MyApp_Development_Profile "Johnny Appleseed iPad"=0123456789012345678901234567890123abcdef "Johnny Appleseed iPhone"=abcdef0123456789012345678901234567890123
78
+ ```
65
79
 
66
80
  _Adds (without an editor) a list of devices to a provisioning profile_
67
81
 
68
- $ ios profiles:devices:remove MyApp_Development_Profile "Johnny Old iPad"=0123456789012345678901234567890123abcdef "Johnny Old iPhone"=abcdef0123456789012345678901234567890123
82
+ ```
83
+ $ ios profiles:devices:remove MyApp_Development_Profile "Johnny Old iPad"=0123456789012345678901234567890123abcdef "Johnny Old iPhone"=abcdef0123456789012345678901234567890123
84
+ ```
69
85
 
70
86
  _Removes (without an editor) a list of devices from a provisioning profile_
71
87
 
72
- ### App IDs
88
+ ---
89
+
90
+ ```
91
+ $ ios profiles:devices:list MyApp_Development_Profile
73
92
 
74
- $ ios app_ids:list
93
+ +--------------------------+------------------------------------------+--------+
94
+ | Listing devices for provisioning profile MyApp_Development_Profile |
95
+ +--------------------------+------------------------------------------+--------+
96
+ | Device Name | Device Identifier | Active |
97
+ +--------------------------+------------------------------------------+--------+
98
+ | Person's iPhone 5 | 888888883e48a3e0458aab2691d565a8a63f7888 | Y |
99
+ +--------------------------+------------------------------------------+--------+
75
100
 
76
- +-----------------------------+------------------------+-------------------+-------------------+
77
- | Bundle Seed ID | Description | Development | Distribution |
78
- +-----------------------------+------------------------+-------------------+-------------------+
79
- | 123ABCDEFG.com.mattt.bundle | App Bundle Description | Passes | Passes |
80
- | | | Data Protection | Data Protection |
81
- | | | iCloud | iCloud |
82
- | | | In-App Purchase | In-App Purchase |
83
- | | | Game Center | Game Center |
84
- | | | Push Notification | Push Notification |
85
- +-----------------------------+------------------------+-------------------+-------------------+
101
+ ```
102
+
103
+ ### App IDs
104
+
105
+ ```
106
+ $ ios app_ids:list
107
+
108
+ +-----------------------------+------------------------+-------------------+-------------------+
109
+ | Bundle Seed ID | Description | Development | Distribution |
110
+ +-----------------------------+------------------------+-------------------+-------------------+
111
+ | 123ABCDEFG.com.mattt.bundle | App Bundle Description | Passes | Passes |
112
+ | | | Data Protection | Data Protection |
113
+ | | | iCloud | iCloud |
114
+ | | | In-App Purchase | In-App Purchase |
115
+ | | | Game Center | Game Center |
116
+ | | | Push Notification | Push Notification |
117
+ +-----------------------------+------------------------+-------------------+-------------------+
118
+ ```
119
+
120
+ ```
121
+ $ ios app_ids:add "App Bundle Description"=123ABCDEFG.com.mattt.bundle
122
+ ```
86
123
 
87
124
  ### Certificates
88
125
 
89
- $ ios certificates:list
126
+ ```
127
+ $ ios certificates:list
128
+
129
+ +------------------+----------------------------------+-----------------+--------+
130
+ | Name | Provisioning Profiles | Expiration Date | Status |
131
+ +------------------+----------------------------------+-----------------+--------+
132
+ | Johnny Appleseed | iOS Team Provisioning Profile: * | Dec 23, 2012 | Issued |
133
+ +------------------+----------------------------------+-----------------+--------+
134
+ ```
90
135
 
91
- +------------------+----------------------------------+-----------------+--------+
92
- | Name | Provisioning Profiles | Expiration Date | Status |
93
- +------------------+----------------------------------+-----------------+--------+
94
- | Johnny Appleseed | iOS Team Provisioning Profile: * | Dec 23, 2012 | Issued |
95
- +------------------+----------------------------------+-----------------+--------+
136
+ ```
137
+ $ ios certificates:download
138
+ $ ios certificates:download --type distribution
139
+ $ ios certificates:download NAME
140
+ ```
96
141
 
97
142
  ## Commands
98
143
 
@@ -106,6 +151,7 @@ _Removes (without an editor) a list of devices from a provisioning profile_
106
151
  - `profiles:manage:devices:remove`
107
152
  - `profiles:download`
108
153
  - `profiles:download:all`
154
+ - `profiles:devices:list`
109
155
  - `certificates:list`
110
156
  - `certificates:download`
111
157
  - `app_ids:list`
data/bin/ios CHANGED
@@ -19,4 +19,4 @@ program :help_formatter, :compact
19
19
  default_command :help
20
20
 
21
21
  require 'cupertino/provisioning_portal'
22
- require 'cupertino/provisioning_portal/commands'
22
+ require 'cupertino/provisioning_portal/commands'
Binary file
Binary file
@@ -30,10 +30,10 @@ module Cupertino
30
30
  end
31
31
 
32
32
  def username=(value)
33
- @username = value
34
-
35
- pw = Security::InternetPassword.find(:a => self.username, :server => Cupertino::ProvisioningPortal::HOST)
36
- @password = pw.password if pw
33
+ @username = value
34
+
35
+ pw = Security::InternetPassword.find(:a => self.username, :server => Cupertino::ProvisioningPortal::HOST)
36
+ @password = pw.password if pw
37
37
  end
38
38
 
39
39
  def get(uri, parameters = [], referer = nil, headers = {})
@@ -59,13 +59,13 @@ module Cupertino
59
59
 
60
60
  def list_certificates(type = :development)
61
61
  url = case type
62
- when :development
63
- "https://developer.apple.com/account/ios/certificate/certificateList.action?type=development"
64
- when :distribution
65
- "https://developer.apple.com/account/ios/certificate/certificateList.action?type=distribution"
66
- else
67
- raise ArgumentError, "Certificate type must be :development or :distribution"
68
- end
62
+ when :development
63
+ "https://developer.apple.com/account/ios/certificate/certificateList.action?type=development"
64
+ when :distribution
65
+ "https://developer.apple.com/account/ios/certificate/certificateList.action?type=distribution"
66
+ else
67
+ raise ArgumentError, "Certificate type must be :development or :distribution"
68
+ end
69
69
 
70
70
  get(url)
71
71
 
@@ -231,7 +231,7 @@ module Cupertino
231
231
  on, off = [], []
232
232
  page.search('dd.selectDevices div.rows div').each do |row|
233
233
  checkbox = row.search('input[type="checkbox"]').first
234
- device = devices.detect{|device| device.device_id == checkbox['value']}
234
+ device = devices.detect{|d| d.device_id == checkbox['value']}
235
235
 
236
236
  if checkbox['checked']
237
237
  on << device
@@ -258,6 +258,67 @@ module Cupertino
258
258
  form.submit
259
259
  end
260
260
 
261
+ def list_devices_for_profile(profile)
262
+ devices = list_devices
263
+
264
+ begin
265
+ get(profile.edit_url)
266
+ rescue Mechanize::ResponseCodeError
267
+ say_error "Cannot manage devices for #{profile}" and abort
268
+ end
269
+
270
+ on, off = [], []
271
+ page.search('dd.selectDevices div.rows div').each do |row|
272
+ checkbox = row.search('input[type="checkbox"]').first
273
+ device = devices.detect{|d| d.device_id == checkbox['value']}
274
+
275
+ if checkbox['checked']
276
+ on << device
277
+ else
278
+ off << device
279
+ end
280
+ end
281
+
282
+ { :on => on, :off => off }
283
+ end
284
+
285
+ def add_app_id(app_id)
286
+ get("https://developer.apple.com/account/ios/identifiers/bundle/bundleCreate.action")
287
+
288
+ form = page.form_with(:name => 'bundleSave') or raise UnexpectedContentError
289
+ form.method = 'POST'
290
+ form.action = "https://developer.apple.com/account/ios/identifiers/bundle/bundleConfirm.action"
291
+ form.field_with(:name => "appIdName").value = app_id.description
292
+ form.field_with(:name => "explicitIdentifier").value = app_id.bundle_seed_id
293
+ form.checkbox_with(:name => "push").check()
294
+ form.add_field!("appIdentifierString", app_id.bundle_seed_id)
295
+ form.add_field!("formID", "#{rand(10000000)}")
296
+ form.add_field!("clientToken", "undefined")
297
+ form.submit
298
+
299
+ if form = page.form_with(:name => 'bundleSubmit')
300
+ form.method = 'POST'
301
+
302
+ adssuv = cookies.find{|cookie| cookie.name == 'adssuv'}
303
+ form.add_field!("adssuv-value", Mechanize::Util::uri_unescape(adssuv.value))
304
+
305
+ form.add_field!("inAppPurchase", "on")
306
+ form.add_field!("gameCenter", "on")
307
+ form.add_field!("push", "on")
308
+
309
+ form.add_field!("explicitIdentifier", app_id.bundle_seed_id)
310
+ form.add_field!("appIdentifierString", app_id.bundle_seed_id)
311
+ form.add_field!("appIdName", app_id.description)
312
+ form.add_field!("type", "explicit")
313
+
314
+ form.submit
315
+ elsif form = page.form_with(:name => 'bundleSave')
316
+ form.submit
317
+ else
318
+ raise UnexpectedContentError
319
+ end
320
+ end
321
+
261
322
  def list_app_ids
262
323
  get('https://developer.apple.com/account/ios/identifiers/bundle/bundleList.action')
263
324
 
@@ -7,7 +7,6 @@ COLORS_BY_PROPERTY_VALUES = {
7
7
  command :'app_ids:list' do |c|
8
8
  c.syntax = 'ios app_ids:list'
9
9
  c.summary = 'Lists the App IDs'
10
- c.description = ''
11
10
 
12
11
  c.action do |args, options|
13
12
  app_ids = try{agent.list_app_ids}
@@ -36,3 +35,22 @@ command :'app_ids:list' do |c|
36
35
  end
37
36
 
38
37
  alias_command :app_ids, :'app_ids:list'
38
+
39
+ command :'app_ids:add' do |c|
40
+ c.syntax = 'ios aps_ids:add NAME=BUNDLE_ID'
41
+ c.summary = 'Adds the app to the Provisioning Portal'
42
+
43
+ c.action do |args, options|
44
+ say_error "Missing arguments, expected NAME=BUNDLE_ID" and abort if args.nil? or args.empty?
45
+
46
+ args.each do |arg|
47
+ components = arg.gsub(/"/, '').split(/\=/)
48
+ say_warning "Invalid argument #{arg}, must be in form NAME=BUNDLE_ID" and next unless components.length == 2
49
+ app_id = AppID.new
50
+ app_id.description = components.first
51
+ app_id.bundle_seed_id = components.last
52
+ agent.add_app_id(app_id)
53
+ say_ok "Successfully added App ID #{app_id.bundle_seed_id}"
54
+ end
55
+ end
56
+ end
@@ -1,7 +1,6 @@
1
1
  command :'certificates:list' do |c|
2
2
  c.syntax = 'ios certificates:list [development|distribution]'
3
3
  c.summary = 'Lists the Certificates'
4
- c.description = ''
5
4
 
6
5
  c.action do |args, options|
7
6
  type = args.first.downcase.to_sym rescue nil
@@ -31,17 +30,18 @@ end
31
30
  alias_command :certificates, :'certificates:list'
32
31
 
33
32
  command :'certificates:download' do |c|
34
- c.syntax = 'ios certificates:download [development|distribution]'
33
+ c.syntax = 'ios certificates:download [NAME]'
35
34
  c.summary = 'Downloads the Certificates'
36
- c.description = ''
35
+
36
+ c.option '--type [TYPE]', [:development, :distribution], "Type of profile (development or distribution; defaults to development)"
37
37
 
38
38
  c.action do |args, options|
39
- type = args.first.downcase.to_sym rescue nil
40
- certificates = try{agent.list_certificates(type ||= :development)}
39
+ type = (options.type.downcase.to_sym if options.type) || :development
40
+ certificates = try{agent.list_certificates(type)}
41
41
 
42
42
  say_warning "No #{type} certificates found." and abort if certificates.empty?
43
43
 
44
- certificate = choose "Select a certificate to download:", *certificates
44
+ certificate = (certificates.detect{|cert| cert.name == args.first} unless args.empty?) || choose("Select a certificate to download:", *certificates)
45
45
  if filename = agent.download_certificate(certificate)
46
46
  say_ok "Successfully downloaded: '#{filename}'"
47
47
  else
@@ -1,7 +1,6 @@
1
1
  command :'devices:list' do |c|
2
2
  c.syntax = 'ios devices:list'
3
3
  c.summary = 'Lists the Name and ID of Devices in the Provisioning Portal'
4
- c.description = ''
5
4
 
6
5
  c.action do |args, options|
7
6
  devices = try{agent.list_devices}
@@ -31,14 +30,13 @@ alias_command :devices, :'devices:list'
31
30
  command :'devices:add' do |c|
32
31
  c.syntax = 'ios devices:add DEVICE_NAME=DEVICE_ID [...]'
33
32
  c.summary = 'Adds a device to the Provisioning Portal'
34
- c.description = ''
35
33
 
36
34
  c.action do |args, options|
37
35
  say_error "Missing arguments, expected DEVICE_NAME=DEVICE_ID" and abort if args.nil? or args.empty?
38
36
 
39
37
  devices = []
40
38
  args.each do |arg|
41
- components = arg.strip.gsub(/"/, '').split(/\=/)
39
+ components = arg.gsub(/"/, '').split(/\=/)
42
40
  device = Device.new
43
41
  device.name = components.first
44
42
  device.udid = components.last
@@ -1,7 +1,6 @@
1
1
  command :login do |c|
2
2
  c.syntax = 'ios login'
3
3
  c.summary = 'Save account credentials'
4
- c.description = ''
5
4
 
6
5
  c.action do |args, options|
7
6
  say_warning "You are already authenticated" if Security::InternetPassword.find(:server => Cupertino::ProvisioningPortal::HOST)
@@ -1,7 +1,6 @@
1
1
  command :logout do |c|
2
2
  c.syntax = 'ios logout'
3
3
  c.summary = 'Remove account credentials'
4
- c.description = ''
5
4
 
6
5
  c.action do |args, options|
7
6
  say_error "You are not authenticated" and abort unless Security::InternetPassword.find(:server => Cupertino::ProvisioningPortal::HOST)
@@ -1,7 +1,6 @@
1
1
  command :'profiles:list' do |c|
2
2
  c.syntax = 'ios profiles:list'
3
3
  c.summary = 'Lists the Provisioning Profiles'
4
- c.description = ''
5
4
 
6
5
  c.option '--type [TYPE]', [:development, :distribution], "Type of profile (development or distribution; defaults to development)"
7
6
 
@@ -35,7 +34,6 @@ alias_command :profiles, :'profiles:list'
35
34
  command :'profiles:download' do |c|
36
35
  c.syntax = 'ios profiles:download [PROFILE_NAME]'
37
36
  c.summary = 'Downloads the Provisioning Profiles'
38
- c.description = ''
39
37
 
40
38
  c.option '--type [TYPE]', [:development, :distribution], "Type of profile (development or distribution; defaults to development)"
41
39
 
@@ -59,14 +57,12 @@ end
59
57
  command :'profiles:download:all' do |c|
60
58
  c.syntax = 'ios profiles:download:all'
61
59
  c.summary = 'Downloads all the active Provisioning Profiles'
62
- c.description = ''
63
60
 
64
61
  c.option '--type [TYPE]', [:development, :distribution], "Type of profile (development or distribution; defaults to development)"
65
62
 
66
63
  c.action do |args, options|
67
64
  type = (options.type.downcase.to_sym if options.type) || :development
68
- profiles = try{agent.list_profiles(type)}
69
- profiles = profiles.select{|profile| profile.status == 'Active'}
65
+ profiles = try{agent.list_profiles(type)}.select{|profile| profile.status == 'Active'}
70
66
 
71
67
  say_warning "No active #{type} profiles found." and abort if profiles.empty?
72
68
  profiles.each do |profile|
@@ -82,7 +78,6 @@ end
82
78
  command :'profiles:manage:devices' do |c|
83
79
  c.syntax = 'ios profiles:manage:devices [PROFILE_NAME]'
84
80
  c.summary = 'Manage active devices for a development provisioning profile'
85
- c.description = ''
86
81
 
87
82
  c.option '--type [TYPE]', [:development, :distribution], "Type of profile (development or distribution; defaults to development)"
88
83
 
@@ -123,7 +118,6 @@ alias_command :'profiles:devices', :'profiles:manage:devices'
123
118
  command :'profiles:manage:devices:add' do |c|
124
119
  c.syntax = 'ios profiles:manage:devices:add [PROFILE_NAME] DEVICE_NAME=DEVICE_ID [...]'
125
120
  c.summary = 'Add active devices to a Provisioning Profile'
126
- c.description = ''
127
121
 
128
122
  c.action do |args, options|
129
123
  profiles = try{agent.list_profiles(:development) + agent.list_profiles(:distribution)}
@@ -158,7 +152,6 @@ alias_command :'profiles:devices:add', :'profiles:manage:devices:add'
158
152
  command :'profiles:manage:devices:remove' do |c|
159
153
  c.syntax = 'ios profiles:manage:devices:remove PROFILE_NAME DEVICE_NAME=DEVICE_ID [...]'
160
154
  c.summary = 'Remove active devices from a Provisioning Profile.'
161
- c.description = ''
162
155
 
163
156
  c.action do |args, options|
164
157
  profiles = try{agent.list_profiles(:development) + agent.list_profiles(:distribution)}
@@ -168,18 +161,58 @@ command :'profiles:manage:devices:remove' do |c|
168
161
 
169
162
  names = args.collect{|arg| arg.gsub(/\=.*/, '')}
170
163
 
171
- devices = []
164
+ removed = []
165
+
172
166
  agent.manage_devices_for_profile(profile) do |on, off|
173
- devices = on.delete_if{|device| names.include?(device.name)}
167
+ removed = on.select{|device| names.include?(device.name)}
168
+ on - removed
174
169
  end
175
170
 
176
- case devices.length
171
+ case removed.length
177
172
  when 0
178
173
  say_warning "No devices were removed"
179
174
  else
180
- say_ok "Successfully removed #{pluralize(devices.length, 'device', 'devices')} from #{profile}."
175
+ say_ok "Successfully removed #{pluralize(removed.length, 'device', 'devices')} from #{profile}."
181
176
  end
182
177
  end
183
178
  end
184
179
 
185
180
  alias_command :'profiles:devices:remove', :'profiles:manage:devices:remove'
181
+
182
+ command :'profiles:devices:list' do |c|
183
+ c.syntax = 'ios profiles:devices:list [NAME]'
184
+ c.summary = 'List devices for a development provisioning profile'
185
+
186
+ c.option '--type [TYPE]', [:development, :distribution], "Type of profile (development or distribution; defaults to development)"
187
+
188
+ c.action do |args, options|
189
+ type = (options.type.downcase.to_sym if options.type) || :development
190
+ profiles = try{agent.list_profiles(type)}
191
+ profiles.delete_if{|profile| profile.status == "Invalid"}
192
+
193
+ say_warning "No valid #{type} provisioning profiles found." and abort if profiles.empty?
194
+
195
+ profile = profiles.find{|p| p.name == args.first} || choose("Select a profile:", *profiles)
196
+
197
+ list = agent.list_devices_for_profile(profile)
198
+
199
+ title = "Listing devices for provisioning profile #{profile.name}"
200
+
201
+ table = Terminal::Table.new :title => title do |t|
202
+ t << ["Device Name", "Device Identifier", "Active"]
203
+ t.add_separator
204
+ list[:on].each do |device|
205
+ t << [device.name, device.udid, "Y"]
206
+ end
207
+ list[:off].each do |device|
208
+ t << [device.name, device.udid, "N"]
209
+ end
210
+ end
211
+
212
+ table.align_column 2, :center
213
+
214
+ puts table
215
+ end
216
+ end
217
+
218
+ alias_command :'profiles:devices:list', :'profiles:manage:devices:list'
@@ -29,12 +29,11 @@ module Cupertino
29
29
  page.form_with(:name => 'saveTeamSelection').radiobuttons.each do |radio|
30
30
  name = page.search(".label-primary[for=\"#{radio.dom_id}\"]").first.text.strip
31
31
  programs = page.search(".label-secondary[for=\"#{radio.dom_id}\"]").first.text.strip.split(/\,\s+/)
32
- team_id = radio.value
33
32
  teams << Team.new(name, programs, radio.value)
34
33
  end
35
34
 
36
35
  unless team = teams.detect{|t| t.name == @team || t.identifier == @team}
37
- team = choose "Select a team:", *teams
36
+ team = choose("Select a team:", *teams)
38
37
  end
39
38
 
40
39
  @team_id = team.identifier
@@ -1,3 +1,3 @@
1
1
  module Cupertino
2
- VERSION = '1.0.2'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cupertino
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattt Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-18 00:00:00.000000000 Z
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -157,9 +157,8 @@ executables:
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - ./cupertino-0.9.7.gem
161
- - ./cupertino-1.0.0.gem
162
- - ./cupertino-1.0.1.gem
160
+ - ./cupertino-1.1.0.gem
161
+ - ./cupertino-1.1.1.gem
163
162
  - ./cupertino.gemspec
164
163
  - ./Gemfile
165
164
  - ./Gemfile.lock
data/cupertino-0.9.7.gem DELETED
Binary file
data/cupertino-1.0.0.gem DELETED
Binary file
data/cupertino-1.0.1.gem DELETED
Binary file