convoy 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/convoy.gemspec +14 -11
  3. data/examples/basic_depends_on +2 -2
  4. data/lib/convoy/action_command/base.rb +9 -9
  5. data/lib/convoy/app.rb +13 -13
  6. data/lib/convoy/error/error.rb +2 -2
  7. data/lib/convoy/formatter/command.rb +2 -2
  8. data/lib/convoy/formatter/commands.rb +1 -1
  9. data/lib/convoy/formatter/default_help_formatter.rb +14 -21
  10. data/lib/convoy/formatter/option.rb +2 -2
  11. data/lib/convoy/formatter/options.rb +2 -2
  12. data/lib/convoy/formatter/shell_command_executor.rb +1 -1
  13. data/lib/convoy/formatter/stream_output_formatter.rb +10 -10
  14. data/lib/convoy/formatter/string_grid.rb +3 -3
  15. data/lib/convoy/formatter/string_splitter.rb +1 -1
  16. data/lib/convoy/global_pre_parser.rb +2 -2
  17. data/lib/convoy/logger.rb +3 -3
  18. data/lib/convoy/option_parser.rb +13 -13
  19. data/lib/convoy/setup/configuration/generator.rb +7 -7
  20. data/lib/convoy/setup/configuration/loader.rb +1 -1
  21. data/lib/convoy/setup/configuration/locator/executing_script_directory.rb +1 -1
  22. data/lib/convoy/setup/dsl/command.rb +10 -10
  23. data/lib/convoy/setup/dsl/global.rb +1 -1
  24. data/lib/convoy/setup/dsl/options.rb +7 -7
  25. data/lib/convoy/setup_accessor.rb +5 -5
  26. data/lib/convoy/trollop.rb +42 -33
  27. data/lib/convoy/utils.rb +2 -2
  28. data/spec/integration/basic_config_file_spec.rb +3 -3
  29. data/spec/integration/basic_depends_on_spec.rb +2 -2
  30. data/spec/lib/convoy/action_command/base_spec.rb +32 -32
  31. data/spec/lib/convoy/formatter/option_spec.rb +1 -1
  32. data/spec/lib/convoy/formatter/stream_output_formatter_spec.rb +1 -1
  33. data/spec/lib/convoy/setup/configuration/merge_tool_spec.rb +10 -10
  34. data/spec/lib/convoy/setup/configuration/reader_spec.rb +3 -3
  35. data/spec/lib/convoy/setup/configuration/writer_spec.rb +12 -12
  36. data/spec/lib/convoy/utils_spec.rb +2 -2
  37. data/spec/spec_helper.rb +1 -1
  38. data/spec/support/shared_contexts/integration_setup.rb +5 -5
  39. data/version.rb +1 -0
  40. metadata +24 -5
  41. data/.ruby-version +0 -1
  42. data/.travis.yml +0 -8
@@ -21,10 +21,10 @@ module Convoy
21
21
  commands.each do |command_name|
22
22
  command_name = command_name.to_sym
23
23
  #next if command_name == :convoy
24
- options[command_name] = {}
25
- options[command_name][:options] = {}
24
+ options[command_name] = {}
25
+ options[command_name][:options] = {}
26
26
  options[command_name][:commands] = {}
27
- current_context = context.dup
27
+ current_context = context.dup
28
28
  current_context << command_name
29
29
  options(current_context, options[command_name][:options]) #command_options
30
30
  options_for_commands(setup.canonical_command_names_for(current_context), current_context, options[command_name][:commands])
@@ -34,17 +34,17 @@ module Convoy
34
34
  def init_config_hash
35
35
  {
36
36
  :global => {
37
- :options => {},
37
+ :options => {},
38
38
  :commands => {}
39
39
  },
40
- :user => {}
40
+ :user => {}
41
41
  }
42
42
  end
43
43
 
44
44
  def options(context = [], options = {})
45
45
  command_names = setup.command_names_for(context)
46
- parser = init_parser(command_names)
47
- parser = add_setup_options_to(parser, context)
46
+ parser = init_parser(command_names)
47
+ parser = add_setup_options_to(parser, context)
48
48
  options.merge!(default_option_values(parser))
49
49
  end
50
50
 
@@ -5,7 +5,7 @@ module Convoy
5
5
  attr_reader :setup, :auto_options
6
6
 
7
7
  def initialize(setup, auto_options)
8
- @setup = setup
8
+ @setup = setup
9
9
  @auto_options = auto_options
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Convoy
5
5
  class ExecutingScriptDirectory < Base
6
6
  def locate
7
7
  location_directory = File.dirname($0)
8
- filepath = File.expand_path(File.join(location_directory, filename))
8
+ filepath = File.expand_path(File.join(location_directory, filename))
9
9
  File.exists?(filepath) ? filepath : nil
10
10
  end
11
11
  end
@@ -4,8 +4,8 @@ module Convoy
4
4
  class Command
5
5
  def initialize(name, options = {}, &block)
6
6
  reset(name)
7
- @description = options[:description] || options[:desc] || ""
8
- @aliases = [options[:aliases] || []].flatten
7
+ @description = options[:description] || options[:desc] || ""
8
+ @aliases = [options[:aliases] || []].flatten
9
9
  @requires_arguments ||= options[:requires_arguments]
10
10
  block.call(self) if block_given?
11
11
  rescue => e
@@ -22,8 +22,8 @@ module Convoy
22
22
 
23
23
  def command(name, options = {}, &block)
24
24
  options[:requires_arguments] = @requires_arguments
25
- command = Command.new(name.to_sym, options, &block)
26
- aliases = [options[:aliases] || []].flatten + [name]
25
+ command = Command.new(name.to_sym, options, &block)
26
+ aliases = [options[:aliases] || []].flatten + [name]
27
27
  aliases.each do |name|
28
28
  @commands[name.to_sym] = command
29
29
  end
@@ -48,13 +48,13 @@ module Convoy
48
48
  private
49
49
 
50
50
  def reset(name)
51
- @name = name
52
- @summary = nil
53
- @description = nil
51
+ @name = name
52
+ @summary = nil
53
+ @description = nil
54
54
  @requires_arguments = false
55
- @commands = {}
56
- @options = Options.new(name)
57
- @action = Action.new(name)
55
+ @commands = {}
56
+ @options = Options.new(name)
57
+ @action = Action.new(name)
58
58
  custom_reset
59
59
  end
60
60
 
@@ -20,7 +20,7 @@ module Convoy
20
20
  private
21
21
 
22
22
  def custom_reset
23
- @version = nil
23
+ @version = nil
24
24
  @config_file = nil
25
25
  end
26
26
  end
@@ -12,14 +12,14 @@ module Convoy
12
12
 
13
13
  def initialize(command_name = :global)
14
14
  @command_name = command_name
15
- @options = {}
15
+ @options = {}
16
16
  @dependencies = {}
17
- @conflicts = {}
18
- @validations = {}
17
+ @conflicts = {}
18
+ @validations = {}
19
19
  end
20
20
 
21
21
  def opt(name, desc="", opts={})
22
- opts[:desc] ||= desc
22
+ opts[:desc] ||= desc
23
23
  @options[name] ||= opts
24
24
  dependency(name, :on => opts[:depends_on]) if opts[:depends_on]
25
25
  conflict(*[name, opts[:conflicts_with]].flatten) if opts[:conflicts_with]
@@ -27,7 +27,7 @@ module Convoy
27
27
 
28
28
  def validate(name, description, &block)
29
29
  @validations[name] ||= []
30
- @validations[name] << {:desc => description, :block => block}
30
+ @validations[name] << { :desc => description, :block => block }
31
31
  end
32
32
 
33
33
  def dependency(option_name, opts = {})
@@ -42,8 +42,8 @@ module Convoy
42
42
  def conflict(*opts)
43
43
  opts.each do |opt|
44
44
  conflicts_for_opt = opts.reject { |value| value == opt }
45
- @conflicts[opt] ||= []
46
- @conflicts[opt] += conflicts_for_opt
45
+ @conflicts[opt] ||= []
46
+ @conflicts[opt] += conflicts_for_opt
47
47
  @conflicts[opt].uniq!
48
48
  end
49
49
  end
@@ -98,7 +98,7 @@ module Convoy
98
98
 
99
99
  def command_aliases_for(command_name, context = [])
100
100
  with_context(context) do |current_context|
101
- commands = fetch_instance_variable_from(current_context, :commands)
101
+ commands = fetch_instance_variable_from(current_context, :commands)
102
102
  description = fetch_instance_variable_from(commands[command_name], :aliases)
103
103
  end
104
104
  end
@@ -121,11 +121,11 @@ module Convoy
121
121
  end
122
122
 
123
123
  def with_context(context = [], &block)
124
- context = [] if context.nil? || context.empty?
125
- context = [context] unless context.kind_of?(Array)
124
+ context = [] if context.nil? || context.empty?
125
+ context = [context] unless context.kind_of?(Array)
126
126
  current_context = global_instance
127
127
  context.each do |command_name|
128
- commands = fetch_instance_variable_from(current_context, :commands)
128
+ commands = fetch_instance_variable_from(current_context, :commands)
129
129
  current_context = commands[command_name.to_sym]
130
130
  end
131
131
  block.call(current_context)
@@ -137,7 +137,7 @@ module Convoy
137
137
 
138
138
  def action_block_from(context_object)
139
139
  action_object = fetch_instance_variable_from(context_object, :action)
140
- block = fetch_instance_variable_from(action_object, :block)
140
+ block = fetch_instance_variable_from(action_object, :block)
141
141
  #TODO make sure that if there is no block we exit with a client error
142
142
  end
143
143
 
@@ -60,7 +60,7 @@ module Trollop
60
60
  ## The complete set of legal values for the +:type+ parameter of #opt.
61
61
  TYPES = FLAG_TYPES + SINGLE_ARG_TYPES + MULTI_ARG_TYPES
62
62
 
63
- INVALID_SHORT_ARG_REGEX = /[\d-]/ #:nodoc:
63
+ INVALID_SHORT_ARG_REGEX = /[-]/ #:nodoc:
64
64
 
65
65
  ## The values from the commandline that were not interpreted by #parse.
66
66
  attr_reader :leftovers
@@ -73,16 +73,16 @@ module Trollop
73
73
 
74
74
  ## Initializes the parser, and instance-evaluates any block given.
75
75
  def initialize *a, &b
76
- @version = nil
77
- @leftovers = []
78
- @specs = {}
79
- @long = {}
80
- @short = {}
81
- @order = []
82
- @constraints = []
83
- @stop_words = []
76
+ @version = nil
77
+ @leftovers = []
78
+ @specs = {}
79
+ @long = {}
80
+ @short = {}
81
+ @order = []
82
+ @constraints = []
83
+ @stop_words = []
84
84
  @stop_on_unknown = false
85
- @help_formatter = nil
85
+ @help_formatter = nil
86
86
 
87
87
  #instance_eval(&b) if b # can't take arguments
88
88
  cloaker(&b).bind(self).call(*a) if b
@@ -257,10 +257,10 @@ module Trollop
257
257
  ## fill in :multi
258
258
  opts[:multi] ||= false
259
259
 
260
- opts[:desc] ||= desc
261
- @long[opts[:long]] = name
260
+ opts[:desc] ||= desc
261
+ @long[opts[:long]] = name
262
262
  @short[opts[:short]] = name if opts[:short] && opts[:short] != :none
263
- @specs[name] = opts
263
+ @specs[name] = opts
264
264
  @order << [:opt, name]
265
265
  end
266
266
 
@@ -327,7 +327,7 @@ module Trollop
327
327
  ##
328
328
  ## throws CommandlineError, HelpNeeded, and VersionNeeded exceptions.
329
329
  def parse cmdline=ARGV
330
- vals = {}
330
+ vals = {}
331
331
  required = {}
332
332
 
333
333
  opt :version, 'Prints version and exits' if @version unless @specs[:version] || @long['version']
@@ -335,8 +335,8 @@ module Trollop
335
335
 
336
336
  @specs.each do |sym, opts|
337
337
  required[sym] = true if opts[:required]
338
- vals[sym] = opts[:default]
339
- vals[sym] = [] if opts[:multi] && !opts[:default] # multi arguments default to [], not nil
338
+ vals[sym] = opts[:default]
339
+ vals[sym] = [] if opts[:multi] && !opts[:default] # multi arguments default to [], not nil
340
340
  end
341
341
 
342
342
  resolve_default_short_options!
@@ -358,7 +358,7 @@ module Trollop
358
358
  @long[$1] || @long["no-#{$1}"]
359
359
  else
360
360
  # raise CommandlineError, "invalid argument syntax: '#{arg}'"
361
- puts "\n \x1B[48;5;196m ERROR \x1B[0m \xe2\x80\x94 Invalid argument syntax: #{arg}\n\n"
361
+ puts "\n \x1B[48;5;196m Error \x1B[0m \xe2\x86\x92 Invalid argument syntax: #{arg}\n\n"
362
362
  exit
363
363
  end
364
364
 
@@ -366,20 +366,20 @@ module Trollop
366
366
 
367
367
  # raise CommandlineError, "unknown argument '#{arg}'" unless sym
368
368
  unless sym
369
- puts "\n \x1B[48;5;196m ERROR \x1B[0m \xe2\x80\x94 Unknown flag: #{arg}\n\n"
369
+ puts "\n \x1B[48;5;196m Error \x1B[0m \xe2\x86\x92 Unknown flag: #{arg}\n\n"
370
370
  exit
371
371
  end
372
372
 
373
373
  if given_args.include?(sym) && !@specs[sym][:multi]
374
374
  # raise CommandlineError, "option '#{arg}' specified multiple times"
375
- puts "\n \x1B[48;5;196m ERROR \x1B[0m \xe2\x80\x94 Flag specified multiple times: #{arg}\n\n"
375
+ puts "\n \x1B[48;5;196m Error \x1B[0m \xe2\x86\x92 Flag specified multiple times: #{arg}\n\n"
376
376
  exit
377
377
  end
378
378
 
379
- given_args[sym] ||= {}
380
- given_args[sym][:arg] = arg
379
+ given_args[sym] ||= {}
380
+ given_args[sym][:arg] = arg
381
381
  given_args[sym][:negative_given] = negative_given
382
- given_args[sym][:params] ||= []
382
+ given_args[sym][:params] ||= []
383
383
 
384
384
  # The block returns the number of parameters taken.
385
385
  num_params_taken = 0
@@ -408,14 +408,20 @@ module Trollop
408
408
 
409
409
  case type
410
410
  when :depends
411
- syms.each { |sym| raise CommandlineError, "--#{@specs[constraint_sym][:long]} requires --#{@specs[sym][:long]}" unless given_args.include? sym }
411
+ syms.each { |sym|
412
+ Blufin::Terminal::error('Missing constraint', "--#{@specs[constraint_sym][:long]} requires --#{@specs[sym][:long]}") unless given_args.include? sym
413
+ }
412
414
  when :conflicts
413
- syms.each { |sym| raise CommandlineError, "--#{@specs[constraint_sym][:long]} conflicts with --#{@specs[sym][:long]}" if given_args.include?(sym) && (sym != constraint_sym) }
415
+ syms.each { |sym|
416
+ Blufin::Terminal::error('Conflicting constraint', "--#{@specs[constraint_sym][:long]} conflicts with --#{@specs[sym][:long]}") if given_args.include?(sym) && (sym != constraint_sym)
417
+ }
414
418
  end
415
419
  end
416
420
 
417
421
  required.each do |sym, val|
418
- raise CommandlineError, "option --#{@specs[sym][:long]} must be specified" unless given_args.include? sym
422
+ unless given_args.include? sym
423
+ Blufin::Terminal::error('Missing option', "option --#{@specs[sym][:long]} must be specified")
424
+ end
419
425
  end
420
426
 
421
427
  ## parse parameters
@@ -423,7 +429,10 @@ module Trollop
423
429
  arg, params, negative_given = given_data.values_at :arg, :params, :negative_given
424
430
 
425
431
  opts = @specs[sym]
426
- raise CommandlineError, "option '#{arg}' needs a parameter" if params.empty? && opts[:type] != :flag
432
+
433
+ if params.empty? && opts[:type] != :flag
434
+ Blufin::Terminal::error('Missing parameter', "option '#{arg}' needs a parameter")
435
+ end
427
436
 
428
437
  vals["#{sym}_given".intern] = true # mark argument as specified on the commandline
429
438
 
@@ -516,7 +525,7 @@ module Trollop
516
525
  end
517
526
  end
518
527
 
519
- leftcol_width = left.values.map { |s| s.length }.max || 0
528
+ leftcol_width = left.values.map { |s| s.length }.max || 0
520
529
  rightcol_start = leftcol_width + 6 # spaces
521
530
 
522
531
  unless @order.size > 0 && @order.first.first == :text
@@ -600,7 +609,7 @@ module Trollop
600
609
  ## yield successive arg, parameter pairs
601
610
  def each_arg args
602
611
  remains = []
603
- i = 0
612
+ i = 0
604
613
 
605
614
  until i >= args.length
606
615
  if @stop_words.member? args[i]
@@ -695,7 +704,7 @@ module Trollop
695
704
 
696
705
  def collect_argument_parameters args, start_at
697
706
  params = []
698
- pos = start_at
707
+ pos = start_at
699
708
  while args[pos] && args[pos] !~ PARAM_RE && !@stop_words.member?(args[pos]) do
700
709
  params << args[pos]
701
710
  pos += 1
@@ -712,16 +721,16 @@ module Trollop
712
721
  c = opts[:long].split(//).find { |d| d !~ INVALID_SHORT_ARG_REGEX && !@short.member?(d) }
713
722
  if c # found a character to use
714
723
  opts[:short] = c
715
- @short[c] = name
724
+ @short[c] = name
716
725
  end
717
726
  end
718
727
  end
719
728
 
720
729
  def wrap_line str, opts={}
721
730
  prefix = opts[:prefix] || 0
722
- width = opts[:width] || (self.width - 1)
723
- start = 0
724
- ret = []
731
+ width = opts[:width] || (self.width - 1)
732
+ start = 0
733
+ ret = []
725
734
  until start > str.length
726
735
  nextt =
727
736
  if start + width >= str.length
data/lib/convoy/utils.rb CHANGED
@@ -5,8 +5,8 @@ module Convoy
5
5
  class << self
6
6
  def symbolize_keys(hash)
7
7
  hash.inject({}) do |result, (key, value)|
8
- new_key = (key.kind_of?(String) ? key.to_sym : key)
9
- new_value = (value.kind_of?(Hash) ? symbolize_keys(value) : value)
8
+ new_key = (key.kind_of?(String) ? key.to_sym : key)
9
+ new_value = (value.kind_of?(Hash) ? symbolize_keys(value) : value)
10
10
  result[new_key] = new_value
11
11
  result
12
12
  end
@@ -35,7 +35,7 @@ describe "Convoy basic app with config file defined", :integration => true do
35
35
  context "and config file already exists" do
36
36
  before do
37
37
  FileUtils.mkdir_p(File.dirname path)
38
- File.open(path, 'w') { |f| f.write(JSON.pretty_generate({:global => {:commands => {}, :options => {:option1 => 'hello'}}, :user => {}})) }
38
+ File.open(path, 'w') { |f| f.write(JSON.pretty_generate({ :global => { :commands => {}, :options => { :option1 => 'hello' } }, :user => {} })) }
39
39
 
40
40
  begin
41
41
  subject
@@ -55,7 +55,7 @@ describe "Convoy basic app with config file defined", :integration => true do
55
55
  let(:option_string) { "" }
56
56
  before do
57
57
  FileUtils.mkdir_p(File.dirname path)
58
- File.open(path, 'w') { |f| f.write(JSON.pretty_generate({:global => {:commands => {}, :options => {:option1 => 'hello'}}, :user => {}})) }
58
+ File.open(path, 'w') { |f| f.write(JSON.pretty_generate({ :global => { :commands => {}, :options => { :option1 => 'hello' } }, :user => {} })) }
59
59
 
60
60
  begin
61
61
  subject
@@ -85,7 +85,7 @@ describe "Convoy basic app with config file defined", :integration => true do
85
85
 
86
86
  before do
87
87
  FileUtils.mkdir_p(File.dirname path)
88
- File.open(path, 'w') { |f| f.write(JSON.pretty_generate({:global => {:commands => {}, :options => {:option1 => 'hello'}}, :user => {}})) }
88
+ File.open(path, 'w') { |f| f.write(JSON.pretty_generate({ :global => { :commands => {}, :options => { :option1 => 'hello' } }, :user => {} })) }
89
89
 
90
90
  begin
91
91
  subject
@@ -137,7 +137,7 @@ describe "Convoy basic app with dependent options", :integration => true do
137
137
  opts.opt :option1, "Option1", :short => '-o', :long => '--option1', :type => :string
138
138
  opts.opt :option2, "Option2", :short => :none, :long => '--option2', :type => :string, :multi => true
139
139
 
140
- opts.dependency :option2, :on => {:option1 => 'bar'}
140
+ opts.dependency :option2, :on => { :option1 => 'bar' }
141
141
  end
142
142
 
143
143
  app.action do |options, arguments|
@@ -170,7 +170,7 @@ describe "Convoy basic app with dependent options", :integration => true do
170
170
  opts.opt :option1, "Option1", :short => '-o', :long => '--option1', :type => :string
171
171
  opts.opt :option2, "Option2", :short => :none, :long => '--option2', :type => :string, :multi => true
172
172
 
173
- opts.dependency :option2, :on => [:flag1, {:option1 => 'bar'}]
173
+ opts.dependency :option2, :on => [:flag1, { :option1 => 'bar' }]
174
174
  end
175
175
 
176
176
  app.action do |options, arguments|
@@ -22,27 +22,27 @@ describe Convoy::SetupAccessor do
22
22
 
23
23
  context "and options hash is of valid structure" do
24
24
  context "and command is global" do
25
- let(:options) { {:global => {:commands => {}}} }
25
+ let(:options) { { :global => { :commands => {} } } }
26
26
  it { subject.should == [] }
27
27
  end
28
28
 
29
29
  context "and command is child of global" do
30
- let(:options) { {:global => {:commands => {:command1 => {:commands => {}}}}} }
30
+ let(:options) { { :global => { :commands => { :command1 => { :commands => {} } } } } }
31
31
  it { subject.should == [:command1] }
32
32
 
33
33
  context "and no commands hash for sub command in options" do
34
- let(:options) { {:global => {:commands => {:command1 => {}}}} }
34
+ let(:options) { { :global => { :commands => { :command1 => {} } } } }
35
35
  it { subject.should == [:command1] }
36
36
  end
37
37
  end
38
38
 
39
39
  context "and command is grandchild of global" do
40
- let(:options) { {:global => {:commands => {:command1 => {:commands => {:sub_command1 => {:commands => {}}}}}}} }
40
+ let(:options) { { :global => { :commands => { :command1 => { :commands => { :sub_command1 => { :commands => {} } } } } } } }
41
41
  it { subject.should == [:command1, :sub_command1] }
42
42
  end
43
43
 
44
44
  context "and command is great grandchild of global" do
45
- let(:options) { {:global => {:commands => {:command1 => {:commands => {:sub_command1 => {:commands => {:sub_sub_command1 => {:commands => {}}}}}}}}} }
45
+ let(:options) { { :global => { :commands => { :command1 => { :commands => { :sub_command1 => { :commands => { :sub_sub_command1 => { :commands => {} } } } } } } } } }
46
46
  it { subject.should == [:command1, :sub_command1, :sub_sub_command1] }
47
47
  end
48
48
  end
@@ -53,17 +53,17 @@ describe Convoy::SetupAccessor do
53
53
  subject { command.send(:command_name) }
54
54
 
55
55
  context "when context is global" do
56
- let(:options) { {:global => {:commands => {}}} }
56
+ let(:options) { { :global => { :commands => {} } } }
57
57
  it { subject.should == :global }
58
58
  end
59
59
 
60
60
  context "when context is of size 1" do
61
- let(:options) { {:global => {:commands => {:command1 => {:commands => {}}}}} }
61
+ let(:options) { { :global => { :commands => { :command1 => { :commands => {} } } } } }
62
62
  it { subject.should == :command1 }
63
63
  end
64
64
 
65
65
  context "when context is of size 2" do
66
- let(:options) { {:global => {:commands => {:command1 => {:commands => {:sub_command1 => {:commands => {}}}}}}} }
66
+ let(:options) { { :global => { :commands => { :command1 => { :commands => { :sub_command1 => { :commands => {} } } } } } } }
67
67
  it { subject.should == :sub_command1 }
68
68
  end
69
69
  end
@@ -72,18 +72,18 @@ describe Convoy::SetupAccessor do
72
72
  subject { command.send(:command_options) }
73
73
 
74
74
  context "when context is global" do
75
- let(:options) { {:global => {:commands => {}, :options => {:hello => :world}}} }
76
- it { subject.should == {:hello => :world} }
75
+ let(:options) { { :global => { :commands => {}, :options => { :hello => :world } } } }
76
+ it { subject.should == { :hello => :world } }
77
77
  end
78
78
 
79
79
  context "when context is of size 1" do
80
- let(:options) { {:global => {:commands => {:command1 => {:commands => {}, :options => {:hello => :world}}}}} }
81
- it { subject.should == {:hello => :world} }
80
+ let(:options) { { :global => { :commands => { :command1 => { :commands => {}, :options => { :hello => :world } } } } } }
81
+ it { subject.should == { :hello => :world } }
82
82
  end
83
83
 
84
84
  context "when context is of size 2" do
85
- let(:options) { {:global => {:commands => {:command1 => {:commands => {:sub_command1 => {:commands => {}, :options => {:hello => :world}}}}}}} }
86
- it { subject.should == {:hello => :world} }
85
+ let(:options) { { :global => { :commands => { :command1 => { :commands => { :sub_command1 => { :commands => {}, :options => { :hello => :world } } } } } } } }
86
+ it { subject.should == { :hello => :world } }
87
87
  end
88
88
  end
89
89
 
@@ -91,13 +91,13 @@ describe Convoy::SetupAccessor do
91
91
  subject { command.send(:global_options) }
92
92
 
93
93
  context "when context is global" do
94
- let(:options) { {:global => {:commands => {}, :options => {:hello => :world}}} }
95
- it { subject.should == {:hello => :world} }
94
+ let(:options) { { :global => { :commands => {}, :options => { :hello => :world } } } }
95
+ it { subject.should == { :hello => :world } }
96
96
  end
97
97
 
98
98
  context "when context is of size 1" do
99
- let(:options) { {:global => {:commands => {:command1 => {:commands => {}}}, :options => {:hello => :world}}} }
100
- it { subject.should == {:hello => :world} }
99
+ let(:options) { { :global => { :commands => { :command1 => { :commands => {} } }, :options => { :hello => :world } } } }
100
+ it { subject.should == { :hello => :world } }
101
101
  end
102
102
  end
103
103
 
@@ -105,18 +105,18 @@ describe Convoy::SetupAccessor do
105
105
  subject { command.send(:parent_options) }
106
106
 
107
107
  context "when context is global" do
108
- let(:options) { {:global => {:commands => {}, :options => {:hello => :world}}} }
108
+ let(:options) { { :global => { :commands => {}, :options => { :hello => :world } } } }
109
109
  it { subject.should == {} }
110
110
  end
111
111
 
112
112
  context "when context is of size 1" do
113
- let(:options) { {:global => {:commands => {:command1 => {:commands => {}}}, :options => {:hello => :world}}} }
114
- it { subject.should == {:hello => :world} }
113
+ let(:options) { { :global => { :commands => { :command1 => { :commands => {} } }, :options => { :hello => :world } } } }
114
+ it { subject.should == { :hello => :world } }
115
115
  end
116
116
 
117
117
  context "when context is of size 2" do
118
- let(:options) { {:global => {:commands => {:command1 => {:commands => {:sub_command1 => {:commands => {}}}, :options => {:hello => :world}}}}} }
119
- it { subject.should == {:hello => :world} }
118
+ let(:options) { { :global => { :commands => { :command1 => { :commands => { :sub_command1 => { :commands => {} } }, :options => { :hello => :world } } } } } }
119
+ it { subject.should == { :hello => :world } }
120
120
  end
121
121
  end
122
122
 
@@ -124,18 +124,18 @@ describe Convoy::SetupAccessor do
124
124
  subject { command.send(:grandparent_options) }
125
125
 
126
126
  context "when context is global" do
127
- let(:options) { {:global => {:commands => {}, :options => {:hello => :world}}} }
127
+ let(:options) { { :global => { :commands => {}, :options => { :hello => :world } } } }
128
128
  it { subject.should == {} }
129
129
  end
130
130
 
131
131
  context "when context is of size 1" do
132
- let(:options) { {:global => {:commands => {:command1 => {:commands => {}}}, :options => {:hello => :world}}} }
132
+ let(:options) { { :global => { :commands => { :command1 => { :commands => {} } }, :options => { :hello => :world } } } }
133
133
  it { subject.should == {} }
134
134
  end
135
135
 
136
136
  context "when context is of size 2" do
137
- let(:options) { {:global => {:commands => {:command1 => {:commands => {:sub_command1 => {:commands => {}}}}}, :options => {:hello => :world}}} }
138
- it { subject.should == {:hello => :world} }
137
+ let(:options) { { :global => { :commands => { :command1 => { :commands => { :sub_command1 => { :commands => {} } } } }, :options => { :hello => :world } } } }
138
+ it { subject.should == { :hello => :world } }
139
139
  end
140
140
  end
141
141
 
@@ -143,11 +143,11 @@ describe Convoy::SetupAccessor do
143
143
  subject { command.send(:ancestor_options, generation_number) }
144
144
 
145
145
  context "when context is global" do
146
- let(:options) { {:global => {:commands => {}, :options => {:hello => :world}}} }
146
+ let(:options) { { :global => { :commands => {}, :options => { :hello => :world } } } }
147
147
 
148
148
  context "and generation number is 0" do
149
149
  let(:generation_number) { 0 }
150
- it { subject.should == {:hello => :world} }
150
+ it { subject.should == { :hello => :world } }
151
151
  end
152
152
 
153
153
  context "and generation number is 1" do
@@ -167,16 +167,16 @@ describe Convoy::SetupAccessor do
167
167
  end
168
168
 
169
169
  context "when context is of size 1" do
170
- let(:options) { {:global => {:commands => {:command1 => {:commands => {}, :options => {:foo => :bar}}}, :options => {:hello => :world}}} }
170
+ let(:options) { { :global => { :commands => { :command1 => { :commands => {}, :options => { :foo => :bar } } }, :options => { :hello => :world } } } }
171
171
 
172
172
  context "and generation number is 0" do
173
173
  let(:generation_number) { 0 }
174
- it { subject.should == {:foo => :bar} }
174
+ it { subject.should == { :foo => :bar } }
175
175
  end
176
176
 
177
177
  context "and generation number is 1" do
178
178
  let(:generation_number) { 1 }
179
- it { subject.should == {:hello => :world} }
179
+ it { subject.should == { :hello => :world } }
180
180
  end
181
181
 
182
182
  context "and generation number is 2" do