cupertino 0.8.0 → 0.8.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb126a731dcababd39c34124ed4b45c17a997083
4
- data.tar.gz: 58b36f572201660c304b410205f2d6246fba3c01
3
+ metadata.gz: 0f34dafa2ee7735e8e2cfbbf1c288646d89d2630
4
+ data.tar.gz: 6cfae45ba3385252735c66ead7b958e48c8b2ebd
5
5
  SHA512:
6
- metadata.gz: 6284590a5d7ac5264dedfc1e504ea8c2fe1084b2386e1f9e5fc13a9fb592597a9f3004c81e4b425f54e56ea55b5ef3c3fdf0c58a682be9c67897d09725cee03b
7
- data.tar.gz: 895b0ea5f3c2ab46661bbdb18b5e6a27b5be1ad8365bb33f3c47b6d4be3d87528bcb15949a0f366d857d1ceb6350142b8a665f12bce8c381a81e623d7443e646
6
+ metadata.gz: ce67fee76f47e88958ad9be8e82cfc35032153ab25e30f98ce93d162d3c300a91d6c0b5bc9e56885fbd588845725a61f6a1eedd1823be9be9e5902b002b90a58
7
+ data.tar.gz: fe06155709eeda1854b2c490ad0c644d506b04958f8b8ef09e573753c651e486e6c4fb1663417c5892148b0bc24adba8b9d2af713661577827c021459e9e61b2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cupertino (0.8.0)
4
+ cupertino (0.8.1)
5
5
  certified (>= 0.1.0)
6
6
  commander (~> 4.1.2)
7
7
  mechanize (~> 2.5.1)
data/README.md CHANGED
@@ -55,6 +55,15 @@ _Opens an editor with a list of devices, each of which can be commented / uncomm
55
55
  Johnny Appleseed iPad 0123456789012345678901234567890123abcdef
56
56
  # Johnny Appleseed iPhone abcdef0123456789012345678901234567890123
57
57
 
58
+
59
+ $ ios profiles:devices:add MyApp_Development_Profile "Johnny Appleseed iPad"=0123456789012345678901234567890123abcdef "Johnny Appleseed iPhone"=abcdef0123456789012345678901234567890123
60
+
61
+ _Adds (without an editor) a list of devices to a provisioning profile_
62
+
63
+ $ ios profiles:devices:remove MyApp_Development_Profile "Johnny Old iPad"=0123456789012345678901234567890123abcdef "Johnny Old iPhone"=abcdef0123456789012345678901234567890123
64
+
65
+ _Removes (without an editor) a list of devices from a provisioning profile_
66
+
58
67
  ### App IDs
59
68
 
60
69
  $ ios app_ids:list
@@ -88,6 +97,8 @@ _Opens an editor with a list of devices, each of which can be commented / uncomm
88
97
  - `devices:list`
89
98
  - `profiles:list`
90
99
  - `profiles:manage:devices`
100
+ - `profiles:manage:devices:add`
101
+ - `profiles:manage:devices:remove`
91
102
  - `profiles:download`
92
103
  - `certificates:list [development|distribution]`
93
104
  - `certificates:download`
data/lib/cupertino.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cupertino
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.1'
3
3
  end
@@ -14,7 +14,7 @@ module Cupertino
14
14
  end
15
15
  end
16
16
 
17
- class Certificate < Struct.new(:name, :type, :expiration_date, :status, :download_url) #:provisioning_profiles,
17
+ class Certificate < Struct.new(:name, :type, :expiration_date, :status, :download_url)
18
18
  def to_s
19
19
  "#{self.name}"
20
20
  end
@@ -30,6 +30,26 @@ end
30
30
 
31
31
  alias_command :profiles, :'profiles:list'
32
32
 
33
+ command :'profiles:download' do |c|
34
+ c.syntax = 'ios profiles:download'
35
+ c.summary = 'Downloads the Provisioning Profiles'
36
+ c.description = ''
37
+
38
+ c.action do |args, options|
39
+ type = args.first.downcase.to_sym rescue nil
40
+ profiles = try{agent.list_profiles(type ||= :development)}
41
+ profiles = profiles.find_all{|profile| profile.status == 'Active'}
42
+
43
+ say_warning "No active #{type} profiles found." and abort if profiles.empty?
44
+ profile = choose "Select a profile to download:", *profiles
45
+ if filename = agent.download_profile(profile)
46
+ say_ok "Successfully downloaded: '#{filename}'"
47
+ else
48
+ say_error "Could not download profile"
49
+ end
50
+ end
51
+ end
52
+
33
53
  command :'profiles:manage:devices' do |c|
34
54
  c.syntax = 'ios profiles:manage:devices'
35
55
  c.summary = 'Manage active devices for a development provisioning profile'
@@ -66,24 +86,64 @@ command :'profiles:manage:devices' do |c|
66
86
  end
67
87
  end
68
88
 
69
- alias_command :'profiles:manage', :'profiles:manage:devices'
89
+ alias_command :'profiles:devices', :'profiles:manage:devices'
70
90
 
71
- command :'profiles:download' do |c|
72
- c.syntax = 'ios profiles:download'
73
- c.summary = 'Downloads the Provisioning Profiles'
91
+ command :'profiles:manage:devices:add' do |c|
92
+ c.syntax = 'ios profiles:manage:devices:add PROFILE_NAME DEVICE_NAME=DEVICE_ID [...]'
93
+ c.summary = 'Add active devices to a Provisioning Profile'
74
94
  c.description = ''
75
95
 
76
96
  c.action do |args, options|
77
- type = args.first.downcase.to_sym rescue nil
78
- profiles = try{agent.list_profiles(type ||= :development)}
79
- profiles = profiles.find_all{|profile| profile.status == 'Active'}
97
+ profiles = try{agent.list_profiles(:development) + agent.list_profiles(:distribution)}
98
+ profile = profiles.find {|profile| profile.name == args.first }
99
+
100
+ say_warning "No provisioning profiles named #{args.first} were found." and abort unless profile
101
+
102
+ devices = []
103
+ args[1..-1].each do |arg|
104
+ components = arg.strip.gsub(/\"/, '').split(/\=/)
105
+ device = Device.new
106
+ device.name = components.first
107
+ device.udid = components.last
108
+ devices << device
109
+ end
80
110
 
81
- say_warning "No active #{type} profiles found." and abort if profiles.empty?
82
- profile = choose "Select a profile to download:", *profiles
83
- if filename = agent.download_profile(profile)
84
- say_ok "Successfully downloaded: '#{filename}'"
85
- else
86
- say_error "Could not download profile"
111
+ agent.manage_devices_for_profile(profile) do |on, off|
112
+ on + devices
113
+ end
114
+
115
+ say_ok "Successfully added devices to #{args.first}."
116
+ end
117
+ end
118
+
119
+ alias_command :'profiles:devices:add', :'profiles:manage:devices:add'
120
+
121
+ command :'profiles:manage:devices:remove' do |c|
122
+ c.syntax = 'ios profiles:manage:devices:remove PROFILE_NAME DEVICE_NAME=DEVICE_ID [...]'
123
+ c.summary = 'Remove active devices from a Provisioning Profile.'
124
+ c.description = ''
125
+
126
+ c.action do |args, options|
127
+ profiles = try{agent.list_profiles(:development) + agent.list_profiles(:distribution)}
128
+ profile = profiles.find {|profile| profile.name == args.first }
129
+
130
+ say_warning "No provisioning profiles named #{args.first} were found." and abort unless profile
131
+
132
+ devices = []
133
+ args[1..-1].each do |arg|
134
+ components = arg.strip.gsub(/\"/, '').split(/\=/)
135
+ device = Device.new
136
+ device.name = components.first
137
+ device.udid = components.last
138
+ devices << device
139
+ end
140
+
141
+ agent.manage_devices_for_profile(profile) do |on, off|
142
+ on.delete_if {|active| devices.any? {|inactive| inactive.udid == active.udid }}
87
143
  end
144
+
145
+ say_ok "Successfully removed devices from #{args.first}."
88
146
  end
89
147
  end
148
+
149
+ alias_command :'profiles:devices:remove', :'profiles:manage:devices:remove'
@@ -24,17 +24,14 @@ module Cupertino
24
24
  end
25
25
 
26
26
  def team
27
- # we're working with radio buttons instead of a drop down menu
28
- teams = page.form_with(:name => 'saveTeamSelection').radiobuttons
29
- # create a dictionary of team.value -> team name
30
- formatted_teams = {}
31
- teams.each do |team|
32
- # we can't use team.label as this only returns the last label
33
- # Apple use two labels with the same for="", we want the first
34
- formatted_teams[team.value] = page.search("label[for=\"#{team.dom_id}\"]").first.text.strip
27
+ teams_by_name = {}
28
+ page.form_with(:name => 'saveTeamSelection').radiobuttons.each do |radio|
29
+ name = page.search("label[for=\"#{radio.dom_id}\"]").first.text.strip
30
+ teams_by_name[name] = radio.value
35
31
  end
36
- teamname = choose "Select a team:", *formatted_teams.values
37
- @team ||= formatted_teams.key(teamname)
32
+
33
+ name = choose "Select a team:", *teams_by_name.keys
34
+ @team ||= teams_by_name[name]
38
35
  end
39
36
  end
40
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cupertino
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattt Thompson