gli 2.0.0.rc6 → 2.0.0.rc7
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.
- data/gli.gemspec +2 -2
- data/lib/gli.rb +4 -0
- data/lib/gli/version.rb +1 -1
- data/test/apps/todo/bin/todo +4 -0
- data/test/tc_flag.rb +1 -2
- data/test/tc_gli.rb +5 -6
- data/test/tc_options.rb +4 -5
- data/test/tc_switch.rb +3 -4
- data/test/tc_terminal.rb +14 -15
- metadata +6 -7
data/gli.gemspec
CHANGED
@@ -8,8 +8,8 @@ spec = Gem::Specification.new do |s|
|
|
8
8
|
s.email = 'davidcopeland@naildrivin5.com'
|
9
9
|
s.homepage = 'http://davetron5000.github.com/gli'
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
|
-
s.summary = '
|
12
|
-
s.description = '
|
11
|
+
s.summary = 'Build command-suite CLI apps that are awesome.'
|
12
|
+
s.description = 'Build command-suite CLI apps that are awesome. Bootstrap your app, add commands, options and documentation while maintaining a well-tested idiomatic command-line app'
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/gli.rb
CHANGED
data/lib/gli/version.rb
CHANGED
data/test/apps/todo/bin/todo
CHANGED
data/test/tc_flag.rb
CHANGED
@@ -2,7 +2,6 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class TC_testFlag < Clean::Test::TestCase
|
4
4
|
include TestHelper
|
5
|
-
include GLI
|
6
5
|
|
7
6
|
def test_basics_simple
|
8
7
|
Given flag_with_names(:f)
|
@@ -38,7 +37,7 @@ class TC_testFlag < Clean::Test::TestCase
|
|
38
37
|
:must_match => /foobar/,
|
39
38
|
:type => Float,
|
40
39
|
}
|
41
|
-
@flag = Flag.new(names,@options)
|
40
|
+
@flag = GLI::Flag.new(names,@options)
|
42
41
|
@cli_option = @flag
|
43
42
|
end
|
44
43
|
end
|
data/test/tc_gli.rb
CHANGED
@@ -14,7 +14,6 @@ require 'test_helper'
|
|
14
14
|
|
15
15
|
class TC_testGLI < Clean::Test::TestCase
|
16
16
|
include TestHelper
|
17
|
-
include GLI
|
18
17
|
|
19
18
|
def setup
|
20
19
|
@fake_stdout = FakeStdOut.new
|
@@ -41,7 +40,7 @@ class TC_testGLI < Clean::Test::TestCase
|
|
41
40
|
def test_flag_create
|
42
41
|
@app.reset
|
43
42
|
do_test_flag_create(@app)
|
44
|
-
do_test_flag_create(Command.new(:names => :f))
|
43
|
+
do_test_flag_create(GLI::Command.new(:names => :f))
|
45
44
|
end
|
46
45
|
|
47
46
|
def test_create_commands_using_strings
|
@@ -226,13 +225,13 @@ class TC_testGLI < Clean::Test::TestCase
|
|
226
225
|
def test_switch_create
|
227
226
|
@app.reset
|
228
227
|
do_test_switch_create(@app)
|
229
|
-
do_test_switch_create(Command.new(:names => :f))
|
228
|
+
do_test_switch_create(GLI::Command.new(:names => :f))
|
230
229
|
end
|
231
230
|
|
232
231
|
def test_switch_create_twice
|
233
232
|
@app.reset
|
234
233
|
do_test_switch_create_twice(@app)
|
235
|
-
do_test_switch_create_twice(Command.new(:names => :f))
|
234
|
+
do_test_switch_create_twice(GLI::Command.new(:names => :f))
|
236
235
|
end
|
237
236
|
|
238
237
|
def test_all_aliases_in_options
|
@@ -459,7 +458,7 @@ class TC_testGLI < Clean::Test::TestCase
|
|
459
458
|
@app.on_error { true }
|
460
459
|
@app.command(:foo) do |c|
|
461
460
|
c.action do |g,o,a|
|
462
|
-
raise CustomExit.new("Problem",45)
|
461
|
+
raise GLI::CustomExit.new("Problem",45)
|
463
462
|
end
|
464
463
|
end
|
465
464
|
assert_equal 45,@app.run(['foo'])
|
@@ -522,7 +521,7 @@ class TC_testGLI < Clean::Test::TestCase
|
|
522
521
|
end
|
523
522
|
end
|
524
523
|
|
525
|
-
assert_raises(CustomExit) { @app.run(['foo']) }
|
524
|
+
assert_raises(GLI::CustomExit) { @app.run(['foo']) }
|
526
525
|
end
|
527
526
|
|
528
527
|
class ConvertMe
|
data/test/tc_options.rb
CHANGED
@@ -2,10 +2,9 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class TC_testOptions < Clean::Test::TestCase
|
4
4
|
include TestHelper
|
5
|
-
include GLI
|
6
5
|
|
7
6
|
def test_by_method
|
8
|
-
o = Options.new
|
7
|
+
o = GLI::Options.new
|
9
8
|
o.name = 'verbose'
|
10
9
|
assert_equal 'verbose', o.name
|
11
10
|
assert_equal 'verbose', o[:name]
|
@@ -13,7 +12,7 @@ class TC_testOptions < Clean::Test::TestCase
|
|
13
12
|
end
|
14
13
|
|
15
14
|
def test_by_string
|
16
|
-
o = Options.new
|
15
|
+
o = GLI::Options.new
|
17
16
|
o['name'] = 'verbose'
|
18
17
|
assert_equal 'verbose', o.name
|
19
18
|
assert_equal 'verbose', o[:name]
|
@@ -21,7 +20,7 @@ class TC_testOptions < Clean::Test::TestCase
|
|
21
20
|
end
|
22
21
|
|
23
22
|
def test_by_symbol
|
24
|
-
o = Options.new
|
23
|
+
o = GLI::Options.new
|
25
24
|
o[:name] = 'verbose'
|
26
25
|
assert_equal 'verbose', o.name
|
27
26
|
assert_equal 'verbose', o[:name]
|
@@ -29,7 +28,7 @@ class TC_testOptions < Clean::Test::TestCase
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def test_map_defers_to_underlying_map
|
32
|
-
o = Options.new
|
31
|
+
o = GLI::Options.new
|
33
32
|
o[:foo] = 'bar'
|
34
33
|
o[:blah] = 'crud'
|
35
34
|
|
data/test/tc_switch.rb
CHANGED
@@ -2,7 +2,6 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class TC_testSwitch < Clean::Test::TestCase
|
4
4
|
include TestHelper
|
5
|
-
include GLI
|
6
5
|
|
7
6
|
def test_basics_simple
|
8
7
|
Given switch_with_names(:filename)
|
@@ -29,8 +28,8 @@ class TC_testSwitch < Clean::Test::TestCase
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def test_includes_negatable
|
32
|
-
assert_equal '-a',Switch.name_as_string('a')
|
33
|
-
assert_equal '--[no-]foo',Switch.name_as_string('foo')
|
31
|
+
assert_equal '-a',GLI::Switch.name_as_string('a')
|
32
|
+
assert_equal '--[no-]foo',GLI::Switch.name_as_string('foo')
|
34
33
|
end
|
35
34
|
|
36
35
|
private
|
@@ -41,7 +40,7 @@ class TC_testSwitch < Clean::Test::TestCase
|
|
41
40
|
:desc => 'Filename',
|
42
41
|
:long_desc => 'The Filename',
|
43
42
|
}
|
44
|
-
@switch = Switch.new(names,@options)
|
43
|
+
@switch = GLI::Switch.new(names,@options)
|
45
44
|
@cli_option = @switch
|
46
45
|
end
|
47
46
|
end
|
data/test/tc_terminal.rb
CHANGED
@@ -2,11 +2,10 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class TC_testTerminal < Clean::Test::TestCase
|
4
4
|
include TestHelper
|
5
|
-
include GLI
|
6
5
|
|
7
6
|
def test_command_exists
|
8
|
-
assert Terminal.instance.command_exists?('ls')
|
9
|
-
assert !Terminal.instance.command_exists?('asdfasfasdf')
|
7
|
+
assert GLI::Terminal.instance.command_exists?('ls')
|
8
|
+
assert !GLI::Terminal.instance.command_exists?('asdfasfasdf')
|
10
9
|
end
|
11
10
|
|
12
11
|
def setup
|
@@ -17,23 +16,23 @@ class TC_testTerminal < Clean::Test::TestCase
|
|
17
16
|
def teardown
|
18
17
|
ENV['COLUMNS'] = @old_columns
|
19
18
|
ENV['LINES'] = @old_lines
|
20
|
-
Terminal.default_size = [80,24]
|
19
|
+
GLI::Terminal.default_size = [80,24]
|
21
20
|
end
|
22
21
|
|
23
22
|
def test_shared_instance_is_same
|
24
|
-
assert_equal Terminal.instance,Terminal.instance
|
23
|
+
assert_equal GLI::Terminal.instance,GLI::Terminal.instance
|
25
24
|
end
|
26
25
|
|
27
26
|
def test_size_based_on_columns
|
28
27
|
ENV['COLUMNS'] = '666'
|
29
28
|
ENV['LINES'] = '777'
|
30
|
-
assert_equal [666,777],Terminal.instance.size
|
29
|
+
assert_equal [666,777],GLI::Terminal.instance.size
|
31
30
|
end
|
32
31
|
|
33
32
|
def test_size_using_tput
|
34
|
-
terminal = Terminal.new
|
33
|
+
terminal = GLI::Terminal.new
|
35
34
|
terminal.make_unsafe!
|
36
|
-
Terminal.instance_eval do
|
35
|
+
GLI::Terminal.instance_eval do
|
37
36
|
def run_command(command)
|
38
37
|
if command == 'tput cols'
|
39
38
|
return '888'
|
@@ -51,9 +50,9 @@ class TC_testTerminal < Clean::Test::TestCase
|
|
51
50
|
end
|
52
51
|
|
53
52
|
def test_size_using_stty
|
54
|
-
terminal = Terminal.new
|
53
|
+
terminal = GLI::Terminal.new
|
55
54
|
terminal.make_unsafe!
|
56
|
-
Terminal.instance_eval do
|
55
|
+
GLI::Terminal.instance_eval do
|
57
56
|
def run_command(command)
|
58
57
|
|
59
58
|
if RUBY_PLATFORM == 'java'
|
@@ -73,22 +72,22 @@ class TC_testTerminal < Clean::Test::TestCase
|
|
73
72
|
end
|
74
73
|
|
75
74
|
def test_size_using_default
|
76
|
-
terminal = Terminal.new
|
75
|
+
terminal = GLI::Terminal.new
|
77
76
|
terminal.make_unsafe!
|
78
|
-
Terminal.instance_eval do
|
77
|
+
GLI::Terminal.instance_eval do
|
79
78
|
def command_exists?(command); false; end
|
80
79
|
def jruby?; false; end
|
81
80
|
end
|
82
81
|
ENV['COLUMNS'] = 'foo'
|
83
82
|
assert_equal [80,24],terminal.size
|
84
83
|
# While we have this set up, lets make sure the default change falls through
|
85
|
-
Terminal.default_size = [90,45]
|
84
|
+
GLI::Terminal.default_size = [90,45]
|
86
85
|
assert_equal [90,45],terminal.size
|
87
86
|
end
|
88
87
|
|
89
88
|
def test_size_using_default_when_exception
|
90
|
-
terminal = Terminal.new
|
91
|
-
Terminal.instance_eval do
|
89
|
+
terminal = GLI::Terminal.new
|
90
|
+
GLI::Terminal.instance_eval do
|
92
91
|
def jruby?; raise "Problem"; end
|
93
92
|
end
|
94
93
|
ENV['COLUMNS'] = 'foo'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc7
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -155,10 +155,9 @@ dependencies:
|
|
155
155
|
- - ! '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
|
-
description:
|
159
|
-
|
160
|
-
|
161
|
-
command-specific options, and arguments
|
158
|
+
description: Build command-suite CLI apps that are awesome. Bootstrap your app, add
|
159
|
+
commands, options and documentation while maintaining a well-tested idiomatic command-line
|
160
|
+
app
|
162
161
|
email: davidcopeland@naildrivin5.com
|
163
162
|
executables:
|
164
163
|
- gli
|
@@ -355,7 +354,7 @@ rubyforge_project: gli
|
|
355
354
|
rubygems_version: 1.8.24
|
356
355
|
signing_key:
|
357
356
|
specification_version: 3
|
358
|
-
summary:
|
357
|
+
summary: Build command-suite CLI apps that are awesome.
|
359
358
|
test_files:
|
360
359
|
- !binary |-
|
361
360
|
ZmVhdHVyZXMvZ2xpX2V4ZWN1dGFibGUuZmVhdHVyZQ==
|