convoy 1.1.0 → 1.2.0

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.
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
@@ -4,7 +4,7 @@ describe Convoy::Formatter::Option do
4
4
  let(:context) { [] }
5
5
  let(:name) { 'option1' }
6
6
  let(:details) do
7
- {:short => short, :long => "option1", :type => type, :default => default, :desc => desc, :multi => false}
7
+ { :short => short, :long => "option1", :type => type, :default => default, :desc => desc, :multi => false }
8
8
  end
9
9
  let(:short) { :none }
10
10
  let(:type) { :string }
@@ -35,7 +35,7 @@ describe Convoy::Formatter::StreamOutputFormatter do
35
35
  describe "#puts" do
36
36
  subject { formatter.puts(string, options) }
37
37
  let(:string) { 'hello' }
38
- let(:options) { {:newlines => newlines} }
38
+ let(:options) { { :newlines => newlines } }
39
39
  let(:newlines) { 1 }
40
40
 
41
41
  before { subject; stream.rewind }
@@ -5,36 +5,36 @@ describe Convoy::Setup::Configuration::MergeTool do
5
5
  subject { merge_tool.config_hash }
6
6
 
7
7
  context "when there is a new command" do
8
- let(:old_config_hash) { {:global => {:commands => {}, :options => {:option1 => nil}}, :user => {:hello => :world}} }
9
- let(:new_config_hash) { {:global => {:commands => {:command1 => {:commands => {}, :options => {}}}, :options => {}}, :user => {}} }
8
+ let(:old_config_hash) { { :global => { :commands => {}, :options => { :option1 => nil } }, :user => { :hello => :world } } }
9
+ let(:new_config_hash) { { :global => { :commands => { :command1 => { :commands => {}, :options => {} } }, :options => {} }, :user => {} } }
10
10
 
11
11
  it("should be part of the config") { subject[:global][:commands][:command1].should_not be_nil }
12
12
  end
13
13
 
14
14
  context "when there is a new option for an old command" do
15
- let(:old_config_hash) { {:global => {:commands => {}, :options => {:option1 => nil}}, :user => {:hello => :world}} }
16
- let(:new_config_hash) { {:global => {:commands => {}, :options => {:option1 => nil, :option2 => nil}}, :user => {}} }
15
+ let(:old_config_hash) { { :global => { :commands => {}, :options => { :option1 => nil } }, :user => { :hello => :world } } }
16
+ let(:new_config_hash) { { :global => { :commands => {}, :options => { :option1 => nil, :option2 => nil } }, :user => {} } }
17
17
 
18
18
  it("should be part of the config") { subject[:global][:options].keys.should include(:option2) }
19
19
  end
20
20
 
21
21
  context "when an old option for a command is no longer there" do
22
- let(:old_config_hash) { {:global => {:commands => {}, :options => {:option1 => nil}}, :user => {:hello => :world}} }
23
- let(:new_config_hash) { {:global => {:commands => {}, :options => {:option2 => nil}}, :user => {}} }
22
+ let(:old_config_hash) { { :global => { :commands => {}, :options => { :option1 => nil } }, :user => { :hello => :world } } }
23
+ let(:new_config_hash) { { :global => { :commands => {}, :options => { :option2 => nil } }, :user => {} } }
24
24
 
25
25
  it("should not be part of the config") { subject[:global][:options].keys.should_not include(:option1) }
26
26
  end
27
27
 
28
28
  context "when old config hash has user supplied value for option" do
29
- let(:old_config_hash) { {:global => {:commands => {}, :options => {:option1 => :hello}}, :user => {:hello => :world}} }
30
- let(:new_config_hash) { {:global => {:commands => {}, :options => {:option1 => nil}}, :user => {}} }
29
+ let(:old_config_hash) { { :global => { :commands => {}, :options => { :option1 => :hello } }, :user => { :hello => :world } } }
30
+ let(:new_config_hash) { { :global => { :commands => {}, :options => { :option1 => nil } }, :user => {} } }
31
31
 
32
32
  it("should retain the user supplied value for option") { subject[:global][:options][:option1].should == :hello }
33
33
  end
34
34
 
35
35
  context "when old user hash has values" do
36
- let(:old_config_hash) { {:global => {:commands => {}, :options => {}}, :user => {:hello => :world}} }
37
- let(:new_config_hash) { {:global => {:commands => {}, :options => {}}, :user => {}} }
36
+ let(:old_config_hash) { { :global => { :commands => {}, :options => {} }, :user => { :hello => :world } } }
37
+ let(:new_config_hash) { { :global => { :commands => {}, :options => {} }, :user => {} } }
38
38
  it("should retain the user config values") { subject[:user][:hello].should == :world }
39
39
  end
40
40
  end
@@ -3,7 +3,7 @@ describe Convoy::Setup::Configuration::Reader do
3
3
 
4
4
  let(:reader) { Convoy::Setup::Configuration::Reader.new(path) }
5
5
  let(:path) { '/usr/alan/blah.json' }
6
- let(:data) { {:hello => :world} }
6
+ let(:data) { { :hello => :world } }
7
7
 
8
8
  describe "#read" do
9
9
  subject { reader.read }
@@ -29,13 +29,13 @@ describe Convoy::Setup::Configuration::Reader do
29
29
  end
30
30
 
31
31
  context "when configuration file present" do
32
- let(:config_data) { {:hello => :blah} }
32
+ let(:config_data) { { :hello => :blah } }
33
33
 
34
34
  before do
35
35
  FileUtils.mkdir_p(File.dirname path)
36
36
  File.open(path, 'w') { |f| f.write(JSON.pretty_generate(config_data)) }
37
37
  end
38
- it { subject.data.should == {:hello => "blah"} }
38
+ it { subject.data.should == { :hello => "blah" } }
39
39
  end
40
40
  end
41
41
  end
@@ -2,7 +2,7 @@ describe Convoy::Setup::Configuration::Writer do
2
2
  include FakeFS::SpecHelpers
3
3
  let(:writer) { Convoy::Setup::Configuration::Writer.new(path, data) }
4
4
  let(:path) { '/usr/alan/blah.json' }
5
- let(:data) { {:hello => :world} }
5
+ let(:data) { { :hello => :world } }
6
6
 
7
7
  describe "#write" do
8
8
  subject { writer.write }
@@ -19,10 +19,10 @@ describe Convoy::Setup::Configuration::Writer do
19
19
  it { subject.data.should == data }
20
20
  it("file should have the right contents") do
21
21
  subject
22
- json = File.read(path)
23
- hash = ::JSON.parse(json)
22
+ json = File.read(path)
23
+ hash = ::JSON.parse(json)
24
24
  actual_data = Convoy::Utils.symbolize_keys(hash)
25
- actual_data.should == {:hello => "world"}
25
+ actual_data.should == { :hello => "world" }
26
26
  end
27
27
  end
28
28
 
@@ -45,16 +45,16 @@ describe Convoy::Setup::Configuration::Writer do
45
45
  it { subject.data.should == data }
46
46
  it("file should have the right contents") do
47
47
  subject
48
- json = File.read(path)
49
- hash = ::JSON.parse(json)
48
+ json = File.read(path)
49
+ hash = ::JSON.parse(json)
50
50
  actual_data = Convoy::Utils.symbolize_keys(hash)
51
- actual_data.should == {:hello => "world"}
51
+ actual_data.should == { :hello => "world" }
52
52
  end
53
53
  end
54
54
 
55
55
  context "when file does exit" do
56
- let(:previous_data) { {:hello => :blah} }
57
- let(:data) { {:hello => :world, :foo => :bar} }
56
+ let(:previous_data) { { :hello => :blah } }
57
+ let(:data) { { :hello => :world, :foo => :bar } }
58
58
  before do
59
59
  FileUtils.mkdir_p(File.dirname path)
60
60
  File.open(path, 'w') { |f| f.write(JSON.pretty_generate(previous_data)) }
@@ -65,10 +65,10 @@ describe Convoy::Setup::Configuration::Writer do
65
65
  it { subject.data.should == data }
66
66
  it("file should have the right contents") do
67
67
  subject
68
- json = File.read(path)
69
- hash = ::JSON.parse(json)
68
+ json = File.read(path)
69
+ hash = ::JSON.parse(json)
70
70
  actual_data = Convoy::Utils.symbolize_keys(hash)
71
- actual_data.should == {:hello => "blah", :foo => "bar"}
71
+ actual_data.should == { :hello => "blah", :foo => "bar" }
72
72
  end
73
73
  end
74
74
  end
@@ -3,13 +3,13 @@ describe Convoy::Utils do
3
3
  subject { Convoy::Utils.symbolize_keys(hash) }
4
4
 
5
5
  context "when single level hash" do
6
- let(:hash) { {'a' => 1, :b => 2} }
6
+ let(:hash) { { 'a' => 1, :b => 2 } }
7
7
  it("the :a key should be a symbol") { subject[:a].should == 1 }
8
8
  it("the :b key should be a symbol") { subject[:b].should == 2 }
9
9
  end
10
10
 
11
11
  context "when hash has nested hashes" do
12
- let(:hash) { {'a' => 1, :b => {'c' => {'d' => 2}}} }
12
+ let(:hash) { { 'a' => 1, :b => { 'c' => { 'd' => 2 } } } }
13
13
  it("the :a key should be a symbol") { subject[:a].should == 1 }
14
14
  it("the nested keys, :b, :c and :d should all be symbols") { subject[:b][:c][:d].should == 2 }
15
15
  end
data/spec/spec_helper.rb CHANGED
@@ -16,7 +16,7 @@ Dir[File.join(File.dirname(__FILE__), 'support', '**', "*.rb").to_s].each { |fil
16
16
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
17
  RSpec.configure do |config|
18
18
  config.treat_symbols_as_metadata_keys_with_true_values = true
19
- config.run_all_when_everything_filtered = true
19
+ config.run_all_when_everything_filtered = true
20
20
  config.filter_run :focus
21
21
 
22
22
  config.include IntegrationHelpers, :integration => true
@@ -11,17 +11,17 @@ shared_context "integration test setup", :integration => true do
11
11
  after do
12
12
  $stderr = STDERR
13
13
  $stdout = STDOUT
14
- $stdin = STDIN
14
+ $stdin = STDIN
15
15
  end
16
16
 
17
17
  module Convoy
18
18
  class IntegrationTestCommand < ::Convoy::ActionCommand::Base
19
19
  def execute(result)
20
- result[:command_name] = command_name
20
+ result[:command_name] = command_name
21
21
  result[:command_options] = command_options
22
- result[:options] = options
23
- result[:arguments] = arguments
24
- result[:config] = config if config
22
+ result[:options] = options
23
+ result[:arguments] = arguments
24
+ result[:config] = config if config
25
25
  end
26
26
  end
27
27
  end
data/version.rb ADDED
@@ -0,0 +1 @@
1
+ CONVOY_VERSION = '1.2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convoy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Rannetsperger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nesty
@@ -30,6 +30,26 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: blufin-lib
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '='
38
+ - !ruby/object:Gem::Version
39
+ version: 1.5.0
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.5.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '='
48
+ - !ruby/object:Gem::Version
49
+ version: 1.5.0
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.5.0
33
53
  - !ruby/object:Gem::Dependency
34
54
  name: rspec
35
55
  requirement: !ruby/object:Gem::Requirement
@@ -122,8 +142,6 @@ files:
122
142
  - ".gitignore"
123
143
  - ".irbrc"
124
144
  - ".rspec"
125
- - ".ruby-version"
126
- - ".travis.yml"
127
145
  - Gemfile
128
146
  - LICENSE
129
147
  - README.md
@@ -226,6 +244,7 @@ files:
226
244
  - spec/support/matchers/execute_action_with_options_matcher.rb
227
245
  - spec/support/matchers/exit_with_code_matcher.rb
228
246
  - spec/support/shared_contexts/integration_setup.rb
247
+ - version.rb
229
248
  homepage: http://github.com/alb3rtuk/convoy
230
249
  licenses:
231
250
  - MIT
@@ -246,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
265
  version: '0'
247
266
  requirements: []
248
267
  rubyforge_project:
249
- rubygems_version: 2.4.1
268
+ rubygems_version: 2.6.12
250
269
  signing_key:
251
270
  specification_version: 4
252
271
  summary: A library that makes building command line apps in ruby so easy, you'll feel
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.0.0-p0
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "1.9.2"
4
- - "1.9.3"
5
- - "2.0.0"
6
- - jruby-19mode # JRuby in 1.9 mode
7
- #- rbx-19mode
8
- script: bundle exec rspec spec