commander-openflighthpc 2.0.1 → 2.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/README.md +45 -138
  3. data/commander-openflighthpc.gemspec +2 -1
  4. data/lib/commander.rb +3 -4
  5. data/lib/commander/cli.rb +15 -76
  6. data/lib/commander/command.rb +81 -176
  7. data/lib/commander/error_handler.rb +62 -0
  8. data/lib/commander/help_formatters.rb +0 -4
  9. data/lib/commander/help_formatters/terminal.rb +0 -5
  10. data/lib/commander/help_formatters/terminal/command_help.erb +14 -6
  11. data/lib/commander/help_formatters/terminal/help.erb +12 -4
  12. data/lib/commander/runner.rb +92 -130
  13. data/lib/commander/version.rb +1 -1
  14. metadata +21 -46
  15. data/bin/commander +0 -104
  16. data/lib/commander/blank.rb +0 -7
  17. data/lib/commander/core_ext.rb +0 -2
  18. data/lib/commander/core_ext/array.rb +0 -24
  19. data/lib/commander/core_ext/object.rb +0 -8
  20. data/lib/commander/help_formatters/terminal/subcommand_help.erb +0 -23
  21. data/lib/commander/help_formatters/terminal_compact.rb +0 -11
  22. data/lib/commander/help_formatters/terminal_compact/command_help.erb +0 -26
  23. data/lib/commander/help_formatters/terminal_compact/help.erb +0 -29
  24. data/lib/commander/help_formatters/terminal_compact/subcommand_help.erb +0 -15
  25. data/lib/commander/import.rb +0 -5
  26. data/lib/commander/patches/decimal-integer.rb +0 -17
  27. data/lib/commander/patches/help_formatter_binding.rb +0 -15
  28. data/lib/commander/patches/implicit-short-tags.rb +0 -75
  29. data/lib/commander/patches/priority_sort.rb +0 -21
  30. data/lib/commander/patches/validate_inputs.rb +0 -79
  31. data/lib/commander/platform.rb +0 -7
  32. data/spec/command_spec.rb +0 -157
  33. data/spec/configure_spec.rb +0 -37
  34. data/spec/core_ext/array_spec.rb +0 -18
  35. data/spec/core_ext/object_spec.rb +0 -19
  36. data/spec/help_formatters/terminal_compact_spec.rb +0 -69
  37. data/spec/help_formatters/terminal_spec.rb +0 -67
  38. data/spec/methods_spec.rb +0 -61
  39. data/spec/patches/validate_inputs_spec.rb +0 -84
  40. data/spec/runner_spec.rb +0 -672
  41. data/spec/spec_helper.rb +0 -79
  42. data/spec/ui_spec.rb +0 -30
@@ -1,79 +0,0 @@
1
- require 'rubygems'
2
- require 'stringio'
3
- require 'simplecov'
4
- SimpleCov.start do
5
- add_filter '/spec/'
6
- end
7
-
8
- # Unshift so that local files load instead of something in gems
9
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
10
-
11
- # This basically replicates the behavior of `require 'commander/import'`
12
- # but without adding an `at_exit` hook, which interferes with exit code
13
- require 'commander'
14
- require 'commander/methods'
15
-
16
- # Mock terminal IO streams so we can spec against them
17
-
18
- def mock_terminal
19
- @input = StringIO.new
20
- @output = StringIO.new
21
- $terminal = HighLine.new @input, @output
22
- end
23
-
24
- # Create test command for usage within several specs
25
-
26
- def create_test_command
27
- stub_const('Commander::Patches::ValidateInputs::PatchEnabled', false)
28
- command :test do |c|
29
- c.syntax = 'test [options] <file>'
30
- c.description = 'test description'
31
- c.example 'description', 'command'
32
- c.example 'description 2', 'command 2'
33
- c.option '-v', '--verbose', 'verbose description'
34
- c.when_called do |args, _options|
35
- format('test %s', args.join)
36
- end
37
- end
38
- @command = command :test
39
- end
40
-
41
- # Create a new command runner
42
-
43
- def new_command_runner(*args, &block)
44
- Commander::Runner.instance_variable_set :"@singleton", Commander::Runner.new(args)
45
- program :name, 'test'
46
- program :version, '1.2.3'
47
- program :description, 'something'
48
- create_test_command
49
- yield if block
50
- Commander::Runner.instance
51
- end
52
-
53
- # Comply with how specs were previously written
54
-
55
- def command_runner
56
- Commander::Runner.instance
57
- end
58
-
59
- def run(*args)
60
- new_command_runner(*args) do
61
- program :help_formatter, Commander::HelpFormatter::Base
62
- yield if block_given?
63
- end.run!
64
- @output.string
65
- end
66
-
67
- RSpec.configure do |c|
68
- c.expect_with(:rspec) do |e|
69
- e.syntax = :expect
70
- end
71
-
72
- c.mock_with(:rspec) do |m|
73
- m.syntax = :expect
74
- end
75
-
76
- c.before(:each) do
77
- allow(Commander::UI).to receive(:enable_paging)
78
- end
79
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Commander::UI do
4
- include Commander::Methods
5
-
6
- describe '.replace_tokens' do
7
- it 'should replace tokens within a string, with hash values' do
8
- result = Commander::UI.replace_tokens 'Welcome :name, enjoy your :object'.freeze, name: 'TJ', object: 'cookie'
9
- expect(result).to eq('Welcome TJ, enjoy your cookie')
10
- end
11
- end
12
-
13
- describe 'progress' do
14
- it 'should not die on an empty list' do
15
- exception = false
16
- begin
17
- progress([]) {}
18
- rescue
19
- exception = true
20
- end
21
- expect(exception).not_to be true
22
- end
23
- end
24
-
25
- describe '.available_editor' do
26
- it 'should not fail on available editors with shell arguments' do
27
- expect(Commander::UI.available_editor('sh -c')).to eq('sh -c')
28
- end
29
- end
30
- end