motion-steward 1.0.5 → 1.0.6

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: d0dbc9ca712d9e899d89f1ff241fcb35ef4bd2b1
4
- data.tar.gz: 8418e3cfe532ab98023746e477c819028630b11e
3
+ metadata.gz: eb5bc27589ffd13eea7732f52af4cf1a8a0748c3
4
+ data.tar.gz: 9130e707b8f8c1382d05eb9eb73c952b26ac917e
5
5
  SHA512:
6
- metadata.gz: fe5dc828732885901d30b617d253e5bdc985756111f4e62830147cde58dd326758598c0e91734a4d513859766ae14c92543058abceff942ed9c182c7c733b1d6
7
- data.tar.gz: 342fdbc2759dc8b6fe3b3a24648a9d17a250551d81c5cad5356f770a97a9906ca96503b953ce78cb3d1208f9d6230962c76387d3fc24905cb82ceba8dbde351a
6
+ metadata.gz: 8fbde285fa569729b045e2b647e5112545d46a1b639bb58262e07f2e20255f905f9f844279343b66cda36a189482159804a8565e3475caaf23c34d7e69707114
7
+ data.tar.gz: a7b6b0396357db88fc1624e5f18c62c1ad4768940a86366a4e2260de237c7db51e3ae09b3c3229ee882c17942cbf43a983baf7f6d155b75e05a3c67d9bf7ea34
data/bin/motion-steward CHANGED
@@ -25,18 +25,30 @@ def options
25
25
  },
26
26
  {
27
27
  number: 4,
28
+ name: "Create Distribution Profile",
29
+ method: :create_distribution_profile,
30
+ description: "Creates a development profile for an App."
31
+ },
32
+ {
33
+ number: 5,
28
34
  name: "Add Device",
29
35
  method: :add_device_to_profile,
30
36
  description: "Adds the currently connected iDevice to a development profile (so you can deploy to the device instead of having to use the simulator)."
31
37
  },
32
38
  {
33
- number: 5,
39
+ number: 6,
34
40
  name: "Download Dev Profile",
35
41
  method: :download_dev_profile,
36
42
  description: "Downloads the most recent version of a development profile."
37
43
  },
38
44
  {
39
- number: 6,
45
+ number: 7,
46
+ name: "Download Distribution Profile",
47
+ method: :download_distribution_profile,
48
+ description: "Downloads the most recent version of a production profile."
49
+ },
50
+ {
51
+ number: 8,
40
52
  name: "Exit",
41
53
  method: :exit_steward,
42
54
  description: "Exits Steward."
@@ -69,9 +81,25 @@ def prompt_for_response message
69
81
  gets
70
82
  end
71
83
 
84
+ def download_distribution_profile
85
+ login_if_needed
86
+ puts "Here are the apps I've found with valid distribution profiles:\n\n"
87
+
88
+ MotionSteward.distribution_profiles.each do |p|
89
+ puts "- #{p.app.name}: #{p.app.bundle_id}"
90
+ end
91
+
92
+ selected_app = prompt_for_response "\nWhich app do you want to download the profile for?"
93
+ to_path = 'distribution.mobileprovision'
94
+
95
+ MotionSteward.download_distribution_profile selected_app, to_path
96
+ puts "Distribution profile for #{selected_app} has been downloaded to #{to_path}.\n"
97
+ audit
98
+ end
99
+
72
100
  def download_dev_profile
73
101
  login_if_needed
74
- puts "Here are the apps I've found without development profiles:\n\n"
102
+ puts "Here are the apps I've found with valid development profiles:\n\n"
75
103
 
76
104
  MotionSteward.development_profiles.each do |p|
77
105
  puts "- #{p.app.name}: #{p.app.bundle_id}"
@@ -97,6 +125,12 @@ def numbered_apps_without_development_profiles
97
125
  end
98
126
  end
99
127
 
128
+ def numbered_apps_without_distribution_profiles
129
+ MotionSteward.apps_without_distribution_profiles.each_with_index.map do |p, i|
130
+ { number: i + 1, app: p }
131
+ end
132
+ end
133
+
100
134
  def create_dev_profile
101
135
  login_if_needed
102
136
  puts "Here are the apps I've found without development profiles:\n\n"
@@ -116,6 +150,25 @@ def create_dev_profile
116
150
  audit
117
151
  end
118
152
 
153
+ def create_distribution_profile
154
+ login_if_needed
155
+ puts "Here are the apps I've found without distribution profiles:\n\n"
156
+
157
+ numbered_apps_without_distribution_profiles.each do |hash|
158
+ puts "#{hash[:number]}. #{hash[:app].name} (#{hash[:app].bundle_id})"
159
+ end
160
+
161
+ number_or_name = prompt_for_response "\nWhich app do you want to create a profile for?"
162
+
163
+ app_name = numbered_apps_without_distribution_profiles.find { |hash| hash[:number] == number_or_name.to_i || Regexp.new(number_or_name) =~ hash[:app].name.downcase }[:app].name
164
+
165
+ MotionSteward.create_distribution_profile app_name
166
+
167
+ puts "\n"
168
+
169
+ audit
170
+ end
171
+
119
172
  def add_device_to_profile
120
173
  login_if_needed
121
174
  puts "Here are the profiles I've found that do not have the currently connected device:\n\n"
@@ -155,7 +208,7 @@ def help_with_certificates
155
208
  development = Spaceship.certificate.all.find_all { |c| c.is_a? Spaceship::Portal::Certificate::Development }.first
156
209
 
157
210
  if production.nil? or development.nil?
158
- puts "You need to create a Production and Development certificate. This script doesn't support that stuff yet."
211
+ puts "You need to create a Distribution and Development certificate. This script doesn't support that stuff yet."
159
212
  system "open https://developer.apple.com/account/ios/certificate/"
160
213
  exit(0)
161
214
  end
@@ -23,6 +23,14 @@ class MotionSteward
23
23
  result.split("\n").first.chomp
24
24
  end
25
25
 
26
+ def self.xcode_versions
27
+ # /Contents/Developer/usr/bin/xcodebuild -version
28
+ end
29
+
30
+ def self.current_xcode_version
31
+ system "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version"
32
+ end
33
+
26
34
  def self.invalidate_cache
27
35
  @apps = nil
28
36
  @profiles = nil
@@ -57,6 +65,18 @@ class MotionSteward
57
65
  end.map { |a| a[:app] }
58
66
  end
59
67
 
68
+ def self.apps_without_distribution_profiles
69
+ apps.map do |a|
70
+ {
71
+ app: a,
72
+ development_profile: development_profiles.find_all { |d| d.app.app_id == a.app_id },
73
+ distribution_profile: distribution_profiles.find_all { |d| d.app.app_id == a.app_id }
74
+ }
75
+ end.find_all do |a|
76
+ a[:distribution_profile].count.zero?
77
+ end.map { |a| a[:app] }
78
+ end
79
+
60
80
  def self.development_profiles_without_device udid
61
81
  development_profiles.find_all { |p| p.devices.none? { |d| d.udid == udid } }
62
82
  end
@@ -97,12 +117,38 @@ class MotionSteward
97
117
  invalidate_cache
98
118
  end
99
119
 
120
+ def self.create_distribution_profile app_name_or_bundle_id
121
+ app = apps.find { |a| a.name == app_name_or_bundle_id || a.bundle_id == app_name_or_bundle_id }
122
+
123
+ unless app
124
+ puts "App/Bundle Id #{app_name_or_bundle_id} not found."
125
+ return
126
+ end
127
+
128
+ Spaceship::Portal::ProvisioningProfile::AppStore.create!(
129
+ name: "Distribution: #{app.name}",
130
+ bundle_id: app.bundle_id,
131
+ certificate: production_certificates.first,
132
+ devices: [],
133
+ mac: false,
134
+ sub_platform: nil
135
+ )
136
+
137
+ invalidate_cache
138
+ end
139
+
100
140
  def self.download_development_profile app_name_or_bundle_id, to
101
141
  profile = development_profiles.find { |p| p.app.name == app_name_or_bundle_id }
102
142
  File.write(to, profile.download)
103
143
  invalidate_cache
104
144
  end
105
145
 
146
+ def self.download_distribution_profile app_name_or_bundle_id, to
147
+ profile = distribution_profiles.find { |p| p.app.name == app_name_or_bundle_id }
148
+ File.write(to, profile.download)
149
+ invalidate_cache
150
+ end
151
+
106
152
  def self.add_device_to_app app_name_or_bundle_id, udid
107
153
  profile = development_profiles_without_device(udid).find { |p| p.app.name == app_name_or_bundle_id }
108
154
  profile.devices << devices.find { |d| d.udid == udid }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-steward
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amir Rajan