cupertino 0.9.2 → 0.9.3

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: 6903973b7fe02987d18a630dd223186b6fef294b
4
- data.tar.gz: a743291023cc6ac965b2af41fd772fd8d02194c8
3
+ metadata.gz: a835eac9b4d42e3d9ebaae1b702d614842f63650
4
+ data.tar.gz: 8c2f2b34bec8fa87532955dda13c3022d0e32d0a
5
5
  SHA512:
6
- metadata.gz: 050ee070538cf2f88da389ca4c707c9de9907998700cbebe42cc0eea88c70db64f7f5e6cfada588196c0d0397624c31ec20d8d0c30b04635ceb1f7390f13a948
7
- data.tar.gz: 6f1dfeb02514479210bb421338127cf2f0a3b4d383a990cbe2e2dadd73c4b23d913cd60ea8e9bdfd1487494d457f01053151ab1faf64d1c17886e5dfc8251e93
6
+ metadata.gz: 61f5fc469464d8fe208d00e5ed38fadc4e8dfd12ea672de9a71b16c3e601ecc7be85082460184196d97a0851a0d17301b1a79765f624fbb4aed7f11264eec225
7
+ data.tar.gz: 93cba167d779afab989a6ae8bfdaadbcc0f054d7b106f422b07021c41f8bb02691592232ea4489bb8678bc04dcb81c46723bf551f46eccce40c775e7ebf66525
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cupertino (0.9.2)
4
+ cupertino (0.9.3)
5
5
  certified (>= 0.1.0)
6
6
  commander (~> 4.1.2)
7
7
  mechanize (~> 2.5.1)
@@ -7,17 +7,13 @@ require 'logger'
7
7
  module Cupertino
8
8
  module ProvisioningPortal
9
9
  class Agent < ::Mechanize
10
- attr_accessor :username, :password, :team_id
11
-
12
- # Maintain backward compatibility
13
- alias_method :team, :team_id
14
- alias_method :team=, :team_id=
10
+ attr_accessor :username, :password, :team
15
11
 
16
12
  def initialize
17
13
  super
18
14
 
19
15
  self.user_agent_alias = 'Mac Safari'
20
-
16
+
21
17
  self.log ||= Logger.new(STDOUT)
22
18
  self.log.level = Logger::ERROR
23
19
 
@@ -119,8 +115,8 @@ module Cupertino
119
115
  parsed_device_data['devices'].each do |row|
120
116
  device = Device.new
121
117
  device.name = row['name']
122
- device.udid = row['deviceNumber'] # Apple doesn't provide the UDID on this page anymore
123
118
  device.enabled = (row['status'] == 'c' ? 'Y' : 'N')
119
+ device.device_id = row['deviceId']
124
120
  devices << device
125
121
  end
126
122
 
@@ -202,6 +198,7 @@ module Cupertino
202
198
  profile.edit_url = "https://developer.apple.com/account/ios/profile/profileEdit.action?provisioningProfileId=#{row['provisioningProfileId']}"
203
199
  profiles << profile
204
200
  end
201
+
205
202
  profiles
206
203
  end
207
204
 
@@ -217,17 +214,18 @@ module Cupertino
217
214
  def manage_devices_for_profile(profile)
218
215
  raise ArgumentError unless block_given?
219
216
 
220
- list_profiles(profile.type)
217
+ devices = list_devices
221
218
 
222
- get(profile.edit_url)
219
+ begin
220
+ get(profile.edit_url)
221
+ rescue Mechanize::ResponseCodeError
222
+ say_error "Cannot manage devices for #{profile}" and abort
223
+ end
223
224
 
224
225
  on, off = [], []
225
226
  page.search('dd.selectDevices div.rows div').each do |row|
226
227
  checkbox = row.search('input[type="checkbox"]').first
227
-
228
- device = Device.new
229
- device.name = row.search('span.title').text rescue nil
230
- device.udid = checkbox['value'] rescue nil
228
+ device = devices.detect{|device| device.device_id == checkbox['value']}
231
229
 
232
230
  if checkbox['checked']
233
231
  on << device
@@ -240,14 +238,16 @@ module Cupertino
240
238
 
241
239
  form = page.form_with(:name => 'profileEdit') or raise UnexpectedContentError
242
240
  form.checkboxes_with(:name => 'deviceIds').each do |checkbox|
243
- checkbox.check
244
- if devices.detect{|device| device.udid == checkbox['value']}
241
+ if devices.detect{|device| device.device_id == checkbox['value']}
245
242
  checkbox.check
246
243
  else
247
244
  checkbox.uncheck
248
245
  end
249
246
  end
250
247
 
248
+ adssuv = cookies.find{|cookie| cookie.name == 'adssuv'}
249
+ form.add_field!('adssuv-value', Mechanize::Util::uri_unescape(adssuv.value))
250
+
251
251
  form.method = 'POST'
252
252
  form.submit
253
253
  end
@@ -101,8 +101,8 @@ command :'profiles:manage:devices' do |c|
101
101
 
102
102
  agent.manage_devices_for_profile(profile) do |on, off|
103
103
  lines = ["# Comment / Uncomment Devices to Turn Off / On for Provisioning Profile"]
104
- lines += on.collect{|device| "#{device}"}
105
- lines += off.collect{|device| "# #{device}"}
104
+ lines += on.collect{|device| "#{device.name} #{device.device_id}"}
105
+ lines += off.collect{|device| "# #{device.name} #{device.device_id}"}
106
106
  (result = ask_editor lines.join("\n")) or abort("EDITOR undefined. Try run 'export EDITOR=vi'")
107
107
 
108
108
  devices = []
@@ -110,7 +110,7 @@ command :'profiles:manage:devices' do |c|
110
110
  next if /^#/ === line
111
111
  components = line.split(/\s+/)
112
112
  device = Device.new
113
- device.udid = components.pop
113
+ device.device_id = components.pop
114
114
  device.name = components.join(" ")
115
115
  devices << device
116
116
  end
@@ -5,7 +5,7 @@ include Cupertino::ProvisioningPortal::Helpers
5
5
 
6
6
  global_option('-u', '--username USER', 'Username') { |arg| agent.username = arg unless arg.nil? }
7
7
  global_option('-p', '--password PASSWORD', 'Password') { |arg| agent.password = arg unless arg.nil? }
8
- global_option('--team TEAM', 'Team') { |arg| agent.team = arg unless arg.nil? }
8
+ global_option('--team TEAM', 'Team') { |arg| agent.team = arg if arg }
9
9
  global_option('--info', 'Set log level to INFO') { agent.log.level = Logger::INFO }
10
10
  global_option('--debug', 'Set log level to DEBUG') { agent.log.level = Logger::DEBUG }
11
11
 
@@ -24,29 +24,23 @@ module Cupertino
24
24
  end
25
25
 
26
26
  def team_id
27
- teams = []
27
+ unless @team_id
28
+ teams = []
29
+ page.form_with(:name => 'saveTeamSelection').radiobuttons.each do |radio|
30
+ name = page.search(".label-primary[for=\"#{radio.dom_id}\"]").first.text.strip
31
+ programs = page.search(".label-secondary[for=\"#{radio.dom_id}\"]").first.text.strip.split(/\,\s+/)
32
+ team_id = radio.value
33
+ teams << Team.new(name, programs, radio.value)
34
+ end
28
35
 
29
- page.form_with(:name => 'saveTeamSelection').radiobuttons.each do |radio|
30
- primary = page.search(".label-primary[for=\"#{radio.dom_id}\"]").first.text.strip
31
- secondary = page.search(".label-secondary[for=\"#{radio.dom_id}\"]").first.text.strip
32
- team_id = radio.value
33
- name = "#{primary}, #{secondary} (#{team_id})"
34
- teams << [name, radio.value]
35
- end
36
-
37
- team_names = teams.collect(&:first)
38
- team_ids = teams.collect(&:last)
36
+ unless team = teams.detect{|t| t.name == @team || t.identifier == @team}
37
+ team = choose "Select a team:", *teams
38
+ end
39
39
 
40
- if @team.nil?
41
- selected_team_name = choose "Select a team:", *team_names
42
- teams.detect { |t| t.first == selected_team_name }.last
43
- elsif team_ids.member? @team
44
- @team
45
- elsif team = teams.detect { |t| t.first.start_with?(@team) }
46
- team.last
47
- else
48
- say_error "Team should be a name or identifier" and abort
40
+ @team_id = team.identifier
49
41
  end
42
+
43
+ @team_id
50
44
  end
51
45
  end
52
46
  end
@@ -8,7 +8,7 @@ module Cupertino
8
8
  class UnsuccessfulAuthenticationError < RuntimeError; end
9
9
  class UnexpectedContentError < RuntimeError; end
10
10
 
11
- class Device < Struct.new(:name, :udid, :enabled)
11
+ class Device < Struct.new(:name, :udid, :enabled, :device_id)
12
12
  def to_s
13
13
  "#{self.name} #{self.udid} #{self.enabled}"
14
14
  end
@@ -43,7 +43,13 @@ module Cupertino
43
43
  "#{self.certificate_id}"
44
44
  end
45
45
  end
46
+
47
+ class Team < Struct.new(:name, :programs, :identifier)
48
+ def to_s
49
+ "#{self.name} (#{self.identifier})" + (" [#{self.programs.join(', ')}]" unless self.programs.empty?).to_s
50
+ end
51
+ end
46
52
  end
47
53
  end
48
54
 
49
- require 'cupertino/provisioning_portal/agent'
55
+ require 'cupertino/provisioning_portal/agent'
@@ -1,3 +1,3 @@
1
1
  module Cupertino
2
- VERSION = '0.9.2'
2
+ VERSION = '0.9.3'
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: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattt Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-17 00:00:00.000000000 Z
11
+ date: 2013-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -157,7 +157,6 @@ executables:
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - ./cupertino-0.9.1.gem
161
160
  - ./cupertino.gemspec
162
161
  - ./Gemfile
163
162
  - ./Gemfile.lock
data/cupertino-0.9.1.gem DELETED
Binary file