motion-steward 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/motion-steward +64 -13
  3. data/lib/motion-steward.rb +16 -13
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4baf404a06c1d862ec52721dbe7102d97fff4f1
4
- data.tar.gz: c53cafba15b1bed39052eda9ff5dff5e4ad54840
3
+ metadata.gz: d0dbc9ca712d9e899d89f1ff241fcb35ef4bd2b1
4
+ data.tar.gz: 8418e3cfe532ab98023746e477c819028630b11e
5
5
  SHA512:
6
- metadata.gz: baa98c59d8fe8246e6de1df050199e7f460432d1efde54c862380a9532d37906c98af0d3b8687bb580df8c1b0233b84a86c3ea8a28947a686cca4c84d041c743
7
- data.tar.gz: 68b9d95ba8e76bb03388671e610c05c220964763c803ac31de98701d87195e4a5021d7365eb0b93520020d12872775a4317659979b18403d34fc4472fa04793f
6
+ metadata.gz: fe5dc828732885901d30b617d253e5bdc985756111f4e62830147cde58dd326758598c0e91734a4d513859766ae14c92543058abceff942ed9c182c7c733b1d6
7
+ data.tar.gz: 342fdbc2759dc8b6fe3b3a24648a9d17a250551d81c5cad5356f770a97a9906ca96503b953ce78cb3d1208f9d6230962c76387d3fc24905cb82ceba8dbde351a
data/bin/motion-steward CHANGED
@@ -4,7 +4,48 @@ require 'fastlane'
4
4
  require 'motion-steward'
5
5
 
6
6
  def options
7
- [:research, :audit, :create_dev_profile, :add_device_to_profile, :download_dev_profile]
7
+ [
8
+ {
9
+ number: 1,
10
+ name: "Research",
11
+ method: :research,
12
+ description: "Got an App idea? Use this option to if there are any similar apps and how much money they've made."
13
+ },
14
+ {
15
+ number: 2,
16
+ name: "Audit",
17
+ method: :audit,
18
+ description: "Goes through the current apps in your iTunes developer account and figures out all the things that will keep you from distributing your app to the App Store."
19
+ },
20
+ {
21
+ number: 3,
22
+ name: "Create Dev Profile",
23
+ method: :create_dev_profile,
24
+ description: "Creates a development profile for an App."
25
+ },
26
+ {
27
+ number: 4,
28
+ name: "Add Device",
29
+ method: :add_device_to_profile,
30
+ 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
+ },
32
+ {
33
+ number: 5,
34
+ name: "Download Dev Profile",
35
+ method: :download_dev_profile,
36
+ description: "Downloads the most recent version of a development profile."
37
+ },
38
+ {
39
+ number: 6,
40
+ name: "Exit",
41
+ method: :exit_steward,
42
+ description: "Exits Steward."
43
+ }
44
+ ]
45
+ end
46
+
47
+ def exit_steward
48
+ exit(0)
8
49
  end
9
50
 
10
51
  def list_apps
@@ -50,18 +91,28 @@ def research
50
91
  MotionSteward::AppStoreResearch.analyze(term)
51
92
  end
52
93
 
94
+ def numbered_apps_without_development_profiles
95
+ MotionSteward.apps_without_development_profiles.each_with_index.map do |p, i|
96
+ { number: i + 1, app: p }
97
+ end
98
+ end
99
+
53
100
  def create_dev_profile
54
101
  login_if_needed
55
102
  puts "Here are the apps I've found without development profiles:\n\n"
56
103
 
57
- MotionSteward.apps_without_development_profiles.each do |p|
58
- puts "- #{p.name}: #{p.bundle_id}"
104
+ numbered_apps_without_development_profiles.each do |hash|
105
+ puts "#{hash[:number]}. #{hash[:app].name} (#{hash[:app].bundle_id})"
59
106
  end
60
107
 
61
- selected_app = prompt_for_response "\nWhich app do you want to create a profile for?"
108
+ number_or_name = prompt_for_response "\nWhich app do you want to create a profile for?"
109
+
110
+ app_name = numbered_apps_without_development_profiles.find { |hash| hash[:number] == number_or_name.to_i || Regexp.new(number_or_name) =~ hash[:app].name.downcase }[:app].name
111
+
112
+ MotionSteward.create_development_profile app_name
62
113
 
63
- MotionSteward.create_development_profile selected_app
64
114
  puts "\n"
115
+
65
116
  audit
66
117
  end
67
118
 
@@ -156,24 +207,24 @@ end
156
207
 
157
208
  continue = true
158
209
 
210
+ def find_option number_or_name
211
+ options.find { |o| o[:number] == number_or_name.to_i || Regexp.new(number_or_name) =~ o[:name].downcase }
212
+ end
213
+
159
214
  while continue
160
215
  puts ''
161
216
  puts 'Options:'
162
217
  puts ''
163
- options.map { |o| puts "- #{o}" }
164
- puts '- exit'
165
- puts ''
218
+ options.map { |o| puts "#{o[:number]}. #{o[:name]}: #{o[:description]}\n\n" }
166
219
 
167
220
  print 'What would you like to do (choose from the list above): '
168
221
 
169
222
  input = gets
170
223
 
171
- if input == 'exit'
172
- exit(0)
173
- end
224
+ o = (find_option input)
174
225
 
175
- if options.include? input.to_sym
226
+ if o
176
227
  system 'clear'
177
- send(input.to_sym)
228
+ send(o[:method])
178
229
  end
179
230
  end
@@ -4,19 +4,19 @@ require 'fastlane'
4
4
  class MotionSteward
5
5
  def self.udid_of_connected_device
6
6
  script = <<~SCRIPT
7
- i=0
8
- for line in $(system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'); do
9
- UDID=${line}
10
- echo $UDID
11
- udid_array[i]=${line}
12
- i=$(($i+1))
13
- done
14
-
15
- cnt=${#udid_array[@]}
16
- for ((i=0;i<cnt;i++)); do
17
- echo ${udid_array[i]}
18
- done
19
- SCRIPT
7
+ i=0
8
+ for line in $(system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'); do
9
+ UDID=${line}
10
+ echo $UDID
11
+ udid_array[i]=${line}
12
+ i=$(($i+1))
13
+ done
14
+
15
+ cnt=${#udid_array[@]}
16
+ for ((i=0;i<cnt;i++)); do
17
+ echo ${udid_array[i]}
18
+ done
19
+ SCRIPT
20
20
 
21
21
  result = `#{script}`.chomp
22
22
  return nil if result.chomp.length.zero?
@@ -135,6 +135,9 @@ class MotionSteward
135
135
  if a[:development_profile].first.devices.none? { |d| d.udid == currently_connected_device }
136
136
  if currently_connected_device
137
137
  puts ' ✗ Development profile is missing the device that is currently connected.'
138
+ else
139
+ puts " ✗ Development profile exists, but there is no iDevice connected"
140
+ puts " to the Mac (I can't tell if the profile needs to be updated)."
138
141
  end
139
142
  else
140
143
  puts ' ✔ All is good with the development profile.'
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.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amir Rajan
@@ -55,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: '0'
58
+ version: 2.3.1
59
59
  required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="