murano-cli-commander 4.4.10
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.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +44 -0
- data/.rubocop_todo.yml +77 -0
- data/.travis.yml +14 -0
- data/DEVELOPMENT +15 -0
- data/Gemfile +3 -0
- data/History.rdoc +446 -0
- data/LICENSE +22 -0
- data/Manifest +38 -0
- data/README.md +475 -0
- data/Rakefile +13 -0
- data/bin/murano-cli-commander +104 -0
- data/lib/murano-cli-commander.rb +35 -0
- data/lib/murano-cli-commander/blank.rb +7 -0
- data/lib/murano-cli-commander/command.rb +214 -0
- data/lib/murano-cli-commander/configure.rb +14 -0
- data/lib/murano-cli-commander/core_ext.rb +2 -0
- data/lib/murano-cli-commander/core_ext/array.rb +24 -0
- data/lib/murano-cli-commander/core_ext/object.rb +8 -0
- data/lib/murano-cli-commander/delegates.rb +25 -0
- data/lib/murano-cli-commander/help_formatters.rb +49 -0
- data/lib/murano-cli-commander/help_formatters/base.rb +24 -0
- data/lib/murano-cli-commander/help_formatters/terminal.rb +19 -0
- data/lib/murano-cli-commander/help_formatters/terminal/command_help.erb +35 -0
- data/lib/murano-cli-commander/help_formatters/terminal/help.erb +36 -0
- data/lib/murano-cli-commander/help_formatters/terminal_compact.rb +11 -0
- data/lib/murano-cli-commander/help_formatters/terminal_compact/command_help.erb +27 -0
- data/lib/murano-cli-commander/help_formatters/terminal_compact/help.erb +29 -0
- data/lib/murano-cli-commander/import.rb +5 -0
- data/lib/murano-cli-commander/methods.rb +11 -0
- data/lib/murano-cli-commander/platform.rb +7 -0
- data/lib/murano-cli-commander/runner.rb +455 -0
- data/lib/murano-cli-commander/user_interaction.rb +551 -0
- data/lib/murano-cli-commander/version.rb +3 -0
- data/murano-cli-commander.gemspec +36 -0
- data/spec/command_spec.rb +169 -0
- data/spec/configure_spec.rb +37 -0
- data/spec/core_ext/array_spec.rb +18 -0
- data/spec/core_ext/object_spec.rb +19 -0
- data/spec/help_formatters/terminal_compact_spec.rb +69 -0
- data/spec/help_formatters/terminal_spec.rb +67 -0
- data/spec/methods_spec.rb +61 -0
- data/spec/runner_spec.rb +646 -0
- data/spec/spec_helper.rb +78 -0
- data/spec/ui_spec.rb +30 -0
- metadata +163 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,78 @@
|
|
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 'murano-cli-commander/import'`
|
12
|
+
# but without adding an `at_exit` hook, which interferes with exit code
|
13
|
+
require 'murano-cli-commander'
|
14
|
+
require 'murano-cli-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
|
+
command :test do |c|
|
28
|
+
c.syntax = 'test [options] <file>'
|
29
|
+
c.description = 'test description'
|
30
|
+
c.example 'description', 'command'
|
31
|
+
c.example 'description 2', 'command 2'
|
32
|
+
c.option '-v', '--verbose', 'verbose description'
|
33
|
+
c.when_called do |args, _options|
|
34
|
+
format('test %s', args.join)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
@command = command :test
|
38
|
+
end
|
39
|
+
|
40
|
+
# Create a new command runner
|
41
|
+
|
42
|
+
def new_command_runner(*args, &block)
|
43
|
+
Commander::Runner.instance_variable_set :"@singleton", Commander::Runner.new(args)
|
44
|
+
program :name, 'test'
|
45
|
+
program :version, '1.2.3'
|
46
|
+
program :description, 'something'
|
47
|
+
create_test_command
|
48
|
+
yield if block
|
49
|
+
Commander::Runner.instance
|
50
|
+
end
|
51
|
+
|
52
|
+
# Comply with how specs were previously written
|
53
|
+
|
54
|
+
def command_runner
|
55
|
+
Commander::Runner.instance
|
56
|
+
end
|
57
|
+
|
58
|
+
def run(*args)
|
59
|
+
new_command_runner(*args) do
|
60
|
+
program :help_formatter, Commander::HelpFormatter::Base
|
61
|
+
yield if block_given?
|
62
|
+
end.run!
|
63
|
+
@output.string
|
64
|
+
end
|
65
|
+
|
66
|
+
RSpec.configure do |c|
|
67
|
+
c.expect_with(:rspec) do |e|
|
68
|
+
e.syntax = :expect
|
69
|
+
end
|
70
|
+
|
71
|
+
c.mock_with(:rspec) do |m|
|
72
|
+
m.syntax = :expect
|
73
|
+
end
|
74
|
+
|
75
|
+
c.before(:each) do
|
76
|
+
allow(Commander::UI).to receive(:enable_paging)
|
77
|
+
end
|
78
|
+
end
|
data/spec/ui_spec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
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
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: murano-cli-commander
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.4.10
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Exosite LLC
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-08-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: highline
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.7.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.7.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.49.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.49.1
|
83
|
+
description: The complete solution for Ruby command-line executables. Commander bridges
|
84
|
+
the gap between other terminal related libraries you know and love (OptionParser,
|
85
|
+
HighLine), while providing many new features, and an elegant API.
|
86
|
+
email:
|
87
|
+
- murano-cli-commander@exosite.com
|
88
|
+
executables:
|
89
|
+
- murano-cli-commander
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files: []
|
92
|
+
files:
|
93
|
+
- ".gitignore"
|
94
|
+
- ".rspec"
|
95
|
+
- ".rubocop.yml"
|
96
|
+
- ".rubocop_todo.yml"
|
97
|
+
- ".travis.yml"
|
98
|
+
- DEVELOPMENT
|
99
|
+
- Gemfile
|
100
|
+
- History.rdoc
|
101
|
+
- LICENSE
|
102
|
+
- Manifest
|
103
|
+
- README.md
|
104
|
+
- Rakefile
|
105
|
+
- bin/murano-cli-commander
|
106
|
+
- lib/murano-cli-commander.rb
|
107
|
+
- lib/murano-cli-commander/blank.rb
|
108
|
+
- lib/murano-cli-commander/command.rb
|
109
|
+
- lib/murano-cli-commander/configure.rb
|
110
|
+
- lib/murano-cli-commander/core_ext.rb
|
111
|
+
- lib/murano-cli-commander/core_ext/array.rb
|
112
|
+
- lib/murano-cli-commander/core_ext/object.rb
|
113
|
+
- lib/murano-cli-commander/delegates.rb
|
114
|
+
- lib/murano-cli-commander/help_formatters.rb
|
115
|
+
- lib/murano-cli-commander/help_formatters/base.rb
|
116
|
+
- lib/murano-cli-commander/help_formatters/terminal.rb
|
117
|
+
- lib/murano-cli-commander/help_formatters/terminal/command_help.erb
|
118
|
+
- lib/murano-cli-commander/help_formatters/terminal/help.erb
|
119
|
+
- lib/murano-cli-commander/help_formatters/terminal_compact.rb
|
120
|
+
- lib/murano-cli-commander/help_formatters/terminal_compact/command_help.erb
|
121
|
+
- lib/murano-cli-commander/help_formatters/terminal_compact/help.erb
|
122
|
+
- lib/murano-cli-commander/import.rb
|
123
|
+
- lib/murano-cli-commander/methods.rb
|
124
|
+
- lib/murano-cli-commander/platform.rb
|
125
|
+
- lib/murano-cli-commander/runner.rb
|
126
|
+
- lib/murano-cli-commander/user_interaction.rb
|
127
|
+
- lib/murano-cli-commander/version.rb
|
128
|
+
- murano-cli-commander.gemspec
|
129
|
+
- spec/command_spec.rb
|
130
|
+
- spec/configure_spec.rb
|
131
|
+
- spec/core_ext/array_spec.rb
|
132
|
+
- spec/core_ext/object_spec.rb
|
133
|
+
- spec/help_formatters/terminal_compact_spec.rb
|
134
|
+
- spec/help_formatters/terminal_spec.rb
|
135
|
+
- spec/methods_spec.rb
|
136
|
+
- spec/runner_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
- spec/ui_spec.rb
|
139
|
+
homepage: https://github.com/exosite/murano-cli-commander
|
140
|
+
licenses:
|
141
|
+
- MIT
|
142
|
+
metadata: {}
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
requirements: []
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.7.7
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: The complete solution for Ruby command-line executables
|
163
|
+
test_files: []
|