commander-fastlane 4.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +37 -0
- data/.rubocop_todo.yml +77 -0
- data/.travis.yml +12 -0
- data/DEVELOPMENT +15 -0
- data/Gemfile +3 -0
- data/History.rdoc +428 -0
- data/LICENSE +22 -0
- data/Manifest +38 -0
- data/README.md +460 -0
- data/Rakefile +13 -0
- data/bin/commander +104 -0
- data/commander.gemspec +31 -0
- data/lib/commander.rb +35 -0
- data/lib/commander/blank.rb +7 -0
- data/lib/commander/command.rb +210 -0
- data/lib/commander/configure.rb +14 -0
- data/lib/commander/core_ext.rb +2 -0
- data/lib/commander/core_ext/array.rb +24 -0
- data/lib/commander/core_ext/object.rb +8 -0
- data/lib/commander/delegates.rb +25 -0
- data/lib/commander/help_formatters.rb +49 -0
- data/lib/commander/help_formatters/base.rb +24 -0
- data/lib/commander/help_formatters/terminal.rb +19 -0
- data/lib/commander/help_formatters/terminal/command_help.erb +35 -0
- data/lib/commander/help_formatters/terminal/help.erb +44 -0
- data/lib/commander/help_formatters/terminal_compact.rb +11 -0
- data/lib/commander/help_formatters/terminal_compact/command_help.erb +27 -0
- data/lib/commander/help_formatters/terminal_compact/help.erb +35 -0
- data/lib/commander/import.rb +5 -0
- data/lib/commander/methods.rb +11 -0
- data/lib/commander/platform.rb +7 -0
- data/lib/commander/runner.rb +484 -0
- data/lib/commander/user_interaction.rb +528 -0
- data/lib/commander/version.rb +3 -0
- data/spec/command_spec.rb +157 -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 +195 -0
- data/spec/help_formatters/terminal_spec.rb +190 -0
- data/spec/methods_spec.rb +20 -0
- data/spec/runner_spec.rb +646 -0
- data/spec/spec_helper.rb +78 -0
- data/spec/ui_spec.rb +30 -0
- metadata +175 -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 '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
|
+
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,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: commander-fastlane
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.4.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- TJ Holowaychuk
|
8
|
+
- Gabriel Gilder
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: highline
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.7.2
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.7.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '3.2'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '3.2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: simplecov
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubocop
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0.46'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0.46'
|
84
|
+
description: The complete solution for Ruby command-line executables. Commander bridges
|
85
|
+
the gap between other terminal related libraries you know and love (OptionParser,
|
86
|
+
HighLine), while providing many new features, and an elegant API.
|
87
|
+
email:
|
88
|
+
- gabriel@gabrielgilder.com
|
89
|
+
executables:
|
90
|
+
- commander
|
91
|
+
extensions: []
|
92
|
+
extra_rdoc_files: []
|
93
|
+
files:
|
94
|
+
- ".gitignore"
|
95
|
+
- ".rspec"
|
96
|
+
- ".rubocop.yml"
|
97
|
+
- ".rubocop_todo.yml"
|
98
|
+
- ".travis.yml"
|
99
|
+
- DEVELOPMENT
|
100
|
+
- Gemfile
|
101
|
+
- History.rdoc
|
102
|
+
- LICENSE
|
103
|
+
- Manifest
|
104
|
+
- README.md
|
105
|
+
- Rakefile
|
106
|
+
- bin/commander
|
107
|
+
- commander.gemspec
|
108
|
+
- lib/commander.rb
|
109
|
+
- lib/commander/blank.rb
|
110
|
+
- lib/commander/command.rb
|
111
|
+
- lib/commander/configure.rb
|
112
|
+
- lib/commander/core_ext.rb
|
113
|
+
- lib/commander/core_ext/array.rb
|
114
|
+
- lib/commander/core_ext/object.rb
|
115
|
+
- lib/commander/delegates.rb
|
116
|
+
- lib/commander/help_formatters.rb
|
117
|
+
- lib/commander/help_formatters/base.rb
|
118
|
+
- lib/commander/help_formatters/terminal.rb
|
119
|
+
- lib/commander/help_formatters/terminal/command_help.erb
|
120
|
+
- lib/commander/help_formatters/terminal/help.erb
|
121
|
+
- lib/commander/help_formatters/terminal_compact.rb
|
122
|
+
- lib/commander/help_formatters/terminal_compact/command_help.erb
|
123
|
+
- lib/commander/help_formatters/terminal_compact/help.erb
|
124
|
+
- lib/commander/import.rb
|
125
|
+
- lib/commander/methods.rb
|
126
|
+
- lib/commander/platform.rb
|
127
|
+
- lib/commander/runner.rb
|
128
|
+
- lib/commander/user_interaction.rb
|
129
|
+
- lib/commander/version.rb
|
130
|
+
- spec/command_spec.rb
|
131
|
+
- spec/configure_spec.rb
|
132
|
+
- spec/core_ext/array_spec.rb
|
133
|
+
- spec/core_ext/object_spec.rb
|
134
|
+
- spec/help_formatters/terminal_compact_spec.rb
|
135
|
+
- spec/help_formatters/terminal_spec.rb
|
136
|
+
- spec/methods_spec.rb
|
137
|
+
- spec/runner_spec.rb
|
138
|
+
- spec/spec_helper.rb
|
139
|
+
- spec/ui_spec.rb
|
140
|
+
homepage: https://github.com/commander-rb/commander
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 2.5.1
|
161
|
+
signing_key:
|
162
|
+
specification_version: 4
|
163
|
+
summary: The complete solution for Ruby command-line executables
|
164
|
+
test_files:
|
165
|
+
- spec/command_spec.rb
|
166
|
+
- spec/configure_spec.rb
|
167
|
+
- spec/core_ext/array_spec.rb
|
168
|
+
- spec/core_ext/object_spec.rb
|
169
|
+
- spec/help_formatters/terminal_compact_spec.rb
|
170
|
+
- spec/help_formatters/terminal_spec.rb
|
171
|
+
- spec/methods_spec.rb
|
172
|
+
- spec/runner_spec.rb
|
173
|
+
- spec/spec_helper.rb
|
174
|
+
- spec/ui_spec.rb
|
175
|
+
has_rdoc:
|