yuyi 1.0.6 → 1.0.7

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: 03214f6bdbf18149f894b6b5f29d386a153e8081
4
- data.tar.gz: 087592fd6363457661449f21ac82cf2077c85104
3
+ metadata.gz: 4cdc21ccb1c1827519985b27b4e273ae0a093602
4
+ data.tar.gz: 015d034b735328c1789cf17e4772e58d2c63884f
5
5
  SHA512:
6
- metadata.gz: f0eb908f6eaf1d23019462265a9e69dcc9debd65269d45e5f84a9a91c13e5f14bc21c332dcf4c75c39096aa21821466ba11d8b2c6cf40a3ae46590fd76046f44
7
- data.tar.gz: f16348e2be96f5d0001dc665f21b51bba5e635ad1eca8d416573c3faf014055e8458e725f94733e3b675b2b43ea8fb293b4f6350823ee72104f4c6249f3048b6
6
+ metadata.gz: b8a41477a856a6695051b5a3c14aa639aa1e3d36bd0af84656c06345f4800a39c82114d5b656a3b6df2777bf647605224658509d4a2262924ae32d682b367233
7
+ data.tar.gz: c2b5e9e6550b51190e73ad6e9edd167c8fb87f5aa24d1c8137f13b69e83bf1f3268badbf3e5fa7aa4040a886a0269e98982319a632bd6d193a58b15fc6ee5e91
data/.new CHANGED
@@ -16,4 +16,4 @@ tasks:
16
16
  - spec/**/*.rb
17
17
  project_name: Yuyi
18
18
  type: ruby
19
- version: 1.0.6
19
+ version: 1.0.7
data/lib/yuyi/cli.rb CHANGED
@@ -172,204 +172,206 @@ module Yuyi::Cli
172
172
  run('/usr/bin/sw_vers -productVersion').chomp[/10\.\d+/].to_f
173
173
  end
174
174
 
175
+ def verbose?; @verbose; end
176
+
175
177
  private
176
178
 
177
- def start
178
- header
179
- get_menu
180
- confirm_upgrade
181
- confirm_options
182
- authenticate
183
- Yuyi::Menu.instance.order_rolls
184
- end
179
+ def start
180
+ header
181
+ get_menu
182
+ confirm_upgrade
183
+ confirm_options
184
+ authenticate
185
+ Yuyi::Menu.instance.order_rolls
186
+ end
185
187
 
186
- def header
187
- line_length = 50
188
- say
189
- say '-' * line_length, :color => 4
190
- say
191
- say '____ ____ __ __ ____ ____ __ ', :color => 31, :justify => :center, :padding => line_length
192
- say '\ \ / / | | | | \ \ / / | | ', :color => 32, :justify => :center, :padding => line_length
193
- say ' \ \/ / | | | | \ \/ / | | ', :color => 33, :justify => :center, :padding => line_length
194
- say ' \_ _/ | | | | \_ _/ | | ', :color => 34, :justify => :center, :padding => line_length
195
- say ' | | | `--\' | | | | | ', :color => 35, :justify => :center, :padding => line_length
196
- say ' |__| \______/ |__| |__| ', :color => 36, :justify => :center, :padding => line_length
197
- say
198
- say "VERSION #{Yuyi::VERSION}", :justify => :center, :padding => line_length
199
- say
200
- say '-' * line_length, :color => 4
201
- say
202
- end
188
+ def header
189
+ line_length = 50
190
+ say
191
+ say '-' * line_length, :color => 4
192
+ say
193
+ say '____ ____ __ __ ____ ____ __ ', :color => 31, :justify => :center, :padding => line_length
194
+ say '\ \ / / | | | | \ \ / / | | ', :color => 32, :justify => :center, :padding => line_length
195
+ say ' \ \/ / | | | | \ \/ / | | ', :color => 33, :justify => :center, :padding => line_length
196
+ say ' \_ _/ | | | | \_ _/ | | ', :color => 34, :justify => :center, :padding => line_length
197
+ say ' | | | `--\' | | | | | ', :color => 35, :justify => :center, :padding => line_length
198
+ say ' |__| \______/ |__| |__| ', :color => 36, :justify => :center, :padding => line_length
199
+ say
200
+ say "VERSION #{Yuyi::VERSION}", :justify => :center, :padding => line_length
201
+ say
202
+ say '-' * line_length, :color => 4
203
+ say
204
+ end
203
205
 
204
- # Ask the user for a menu file to load
205
- #
206
- def get_menu
207
- until @path
208
- say 'Navigate to a menu file...', :type => :success
209
- @path = ask "...or just press enter to load `#{Yuyi::DEFAULT_MENU}`", :readline => true, :color => 36 do |path|
210
- path = path.empty? ? Yuyi::DEFAULT_MENU : path
211
-
212
- if Yuyi::Menu.load_from_file path
213
- say 'Downloading Sources... Please Wait', :type => :warn
214
- say
215
-
216
- path
217
- else
218
- say 'Invalid Path... Please check the location of your menu file', :type => :fail
219
- say
220
-
221
- nil
206
+ # Ask the user for a menu file to load
207
+ #
208
+ def get_menu
209
+ until @path
210
+ say 'Navigate to a menu file...', :type => :success
211
+ @path = ask "...or just press enter to load `#{Yuyi::DEFAULT_MENU}`", :readline => true, :color => 36 do |path|
212
+ path = path.empty? ? Yuyi::DEFAULT_MENU : path
213
+
214
+ if Yuyi::Menu.load_from_file path
215
+ say 'Downloading Sources... Please Wait', :type => :warn
216
+ say
217
+
218
+ path
219
+ else
220
+ say 'Invalid Path... Please check the location of your menu file', :type => :fail
221
+ say
222
+
223
+ nil
224
+ end
222
225
  end
223
226
  end
224
- end
225
227
 
226
- Yuyi::Menu.new @path
227
- end
228
+ Yuyi::Menu.new @path
229
+ end
228
230
 
229
- # Ask to check for upgrades
230
- #
231
- def confirm_upgrade
232
- ask 'Do you want to check for upgrades for already installed rolls? (Yn)', :type => :warn do |upgrade|
233
- Yuyi::Menu.upgrade? upgrade == 'Y'
231
+ # Ask to check for upgrades
232
+ #
233
+ def confirm_upgrade
234
+ ask 'Do you want to check for upgrades for already installed rolls? (Yn)', :type => :warn do |upgrade|
235
+ Yuyi::Menu.upgrade? upgrade == 'Y'
236
+ end
234
237
  end
235
- end
236
238
 
237
- # If any rolls on the menu have options, confirm the options before continuing
238
- #
239
- def confirm_options
240
- confirm = false
241
- Yuyi::Menu.rolls.each do |name, roll|
239
+ # If any rolls on the menu have options, confirm the options before continuing
240
+ #
241
+ def confirm_options
242
+ confirm = false
243
+ Yuyi::Menu.rolls.each do |name, roll|
242
244
 
243
- unless roll.class.options.empty?
244
- present_options roll
245
- confirm = true
245
+ unless roll.class.options.empty?
246
+ present_options roll
247
+ confirm = true
248
+ end
246
249
  end
247
- end
248
250
 
249
- if confirm
250
- ask 'Hit any key when you have your options set correctly in your menu file', :type => :warn do
251
- Yuyi::Menu.load_from_file
251
+ if confirm
252
+ ask 'Hit any key when you have your options set correctly in your menu file', :type => :warn do
253
+ Yuyi::Menu.load_from_file
254
+ end
252
255
  end
253
256
  end
254
- end
255
257
 
256
- def authenticate
257
- say 'Yuyi does not need your admin password, but some installations force a prompt.', :type => :warn
258
- say 'You may be asked to enter your password several times. ', :type => :warn
258
+ def authenticate
259
+ say 'Yuyi does not need your admin password, but some installations force a prompt.', :type => :warn
260
+ say 'You may be asked to enter your password several times. ', :type => :warn
259
261
 
260
- # keep the sudo timestamp fresh
261
- Thread::new do
262
- loop do
263
- sleep 1.minute
264
- `sudo -v`
262
+ # keep the sudo timestamp fresh
263
+ Thread::new do
264
+ loop do
265
+ sleep 1.minute
266
+ `sudo -v`
267
+ end
265
268
  end
266
- end
267
269
 
268
- say
269
- end
270
+ say
271
+ end
270
272
 
271
- # Show formatted options
272
- #
273
- def present_options roll, examples = true
274
- indent = 2
275
- longest_option = roll.options.keys.map(&:to_s).max_by(&:length).length + indent
273
+ # Show formatted options
274
+ #
275
+ def present_options roll, examples = true
276
+ indent = 2
277
+ longest_option = roll.options.keys.map(&:to_s).max_by(&:length).length + indent
276
278
 
277
- say "Available options for #{roll.title}...", :color => 32
279
+ say "Available options for #{roll.title}...", :color => 32
278
280
 
279
- roll.option_defs.each do |k, v|
280
- option_color = v[:required] ? 31 : 36
281
+ roll.option_defs.each do |k, v|
282
+ option_color = v[:required] ? 31 : 36
281
283
 
282
- say "#{k.to_s.rjust(longest_option)}: ", :color => option_color, :newline => false
283
- say v[:description]
284
- say (' ' * (longest_option + indent)), :newline => false
285
- if v[:default]
286
- say 'default: ', :color => 36, :newline => false
287
- say v[:default]
284
+ say "#{k.to_s.rjust(longest_option)}: ", :color => option_color, :newline => false
285
+ say v[:description]
286
+ say (' ' * (longest_option + indent)), :newline => false
287
+ if v[:default]
288
+ say 'default: ', :color => 36, :newline => false
289
+ say v[:default]
290
+ end
288
291
  end
289
- end
290
292
 
291
- if examples
292
- examples_hash = {}
293
- example_indent = longest_option + indent
294
- options = roll.options.dup
293
+ if examples
294
+ examples_hash = {}
295
+ example_indent = longest_option + indent
296
+ options = roll.options.dup
295
297
 
296
- # merge examples from roll source in
297
- options.each do |option, value|
298
- if example = roll.option_defs[option][:example]
299
- options[option] = example
298
+ # merge examples from roll source in
299
+ options.each do |option, value|
300
+ if example = roll.option_defs[option][:example]
301
+ options[option] = example
302
+ end
300
303
  end
301
- end
302
304
 
303
- examples_hash[roll.file_name.to_s] = options
305
+ examples_hash[roll.file_name.to_s] = options
304
306
 
305
307
 
306
- say
307
- say 'Example', :color => 33, :indent => example_indent, :newline => false
308
- say examples_hash.deep_stringify_keys!.to_yaml.sub('---', '').gsub(/\n(\s*)/, "\n\\1#{' ' * example_indent}")
308
+ say
309
+ say 'Example', :color => 33, :indent => example_indent, :newline => false
310
+ say examples_hash.deep_stringify_keys!.to_yaml.sub('---', '').gsub(/\n(\s*)/, "\n\\1#{' ' * example_indent}")
311
+ end
309
312
  end
310
- end
311
313
 
312
- # Output text with a certain color (or style)
313
- # Reference for color codes
314
- # https://github.com/flori/term-ansicolor/blob/master/lib/term/ansicolor.rb
315
- #
316
- def colorize text, color_code
317
- return text unless color_code
318
- "\e[#{color_code}m#{text}\e[0m"
319
- end
314
+ # Output text with a certain color (or style)
315
+ # Reference for color codes
316
+ # https://github.com/flori/term-ansicolor/blob/master/lib/term/ansicolor.rb
317
+ #
318
+ def colorize text, color_code
319
+ return text unless color_code
320
+ "\e[#{color_code}m#{text}\e[0m"
321
+ end
320
322
 
321
- # METHODS FOR FLAGS
322
- #
323
- def help
324
- longest_option = CLI_OPTIONS.keys.map(&:to_s).max.length
323
+ # METHODS FOR FLAGS
324
+ #
325
+ def help
326
+ longest_option = CLI_OPTIONS.keys.map(&:to_s).max.length
325
327
 
326
- say
327
- CLI_OPTIONS.each do |option, description|
328
- string = ''
329
- string << "-#{option.to_s.chars.first}"
330
- string << ', '
331
- string << "--#{option.to_s.ljust(longest_option)}"
332
- string << ' '
333
- string << description
334
- say string
328
+ say
329
+ CLI_OPTIONS.each do |option, description|
330
+ string = ''
331
+ string << "-#{option.to_s.chars.first}"
332
+ string << ', '
333
+ string << "--#{option.to_s.ljust(longest_option)}"
334
+ string << ' '
335
+ string << description
336
+ say string
337
+ end
338
+ say
335
339
  end
336
- say
337
- end
338
-
339
- # List all available rolls
340
- #
341
- def list
342
- get_menu
343
- Yuyi::Menu.set_sources
344
340
 
345
- # Collect all rolls from all sources
341
+ # List all available rolls
346
342
  #
347
- rolls = []
348
- Yuyi::Menu.sources.each do |source|
349
- rolls |= source.available_rolls.keys
350
- end
343
+ def list
344
+ get_menu
345
+ Yuyi::Menu.set_sources
346
+
347
+ # Collect all rolls from all sources
348
+ #
349
+ rolls = []
350
+ Yuyi::Menu.sources.each do |source|
351
+ rolls |= source.available_rolls.keys
352
+ end
351
353
 
352
- # alphabatize rolls
353
- rolls = rolls.map(&:to_s).sort.map(&:to_sym)
354
+ # alphabatize rolls
355
+ rolls = rolls.map(&:to_s).sort.map(&:to_sym)
354
356
 
355
- say 'Available Rolls', :type => :success
356
- say '---------------', :type => :success
357
- rolls.each do |roll|
358
- say roll.to_s
357
+ say 'Available Rolls', :type => :success
358
+ say '---------------', :type => :success
359
+ rolls.each do |roll|
360
+ say roll.to_s
361
+ end
362
+ say
359
363
  end
360
- say
361
- end
362
364
 
363
- # Return current version
364
- #
365
- def version
366
- say "#{Yuyi::NAME} #{Yuyi::VERSION}"
367
- end
365
+ # Return current version
366
+ #
367
+ def version
368
+ say "#{Yuyi::NAME} #{Yuyi::VERSION}"
369
+ end
368
370
 
369
- # Return current version
370
- #
371
- def verbose
372
- @verbose = true
373
- start
374
- end
371
+ # Return current version
372
+ #
373
+ def verbose
374
+ @verbose = true
375
+ start
376
+ end
375
377
  end
data/lib/yuyi/menu.rb CHANGED
@@ -138,6 +138,12 @@ class Yuyi::Menu
138
138
  all_rolls.each do |file_name|
139
139
  rolls[file_name].dessert
140
140
  end
141
+
142
+
143
+ Yuyi.say '=' * header_length, :color => 36
144
+ Yuyi.say 'YUYI COMPLETED', :color => 36, :justify => :center, :padding => header_length
145
+ Yuyi.say '=' * header_length, :color => 36
146
+ Yuyi.say
141
147
  end
142
148
 
143
149
  # Find the best roll in the source to be added
data/lib/yuyi/roll.rb CHANGED
@@ -212,6 +212,10 @@ private
212
212
  end
213
213
 
214
214
  def installed?
215
+ if Yuyi.verbose?
216
+ say "INSTALLED?: #{self.title}", :color => 36
217
+ end
218
+
215
219
  begin
216
220
  !!instance_eval(&self.class.installed?)
217
221
  rescue
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yuyi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brewster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-30 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec