executable 1.2.0 → 1.3.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.
- checksums.yaml +7 -0
- data/{HISTORY.rdoc → HISTORY.md} +31 -4
- data/LICENSE.txt +22 -0
- data/{README.rdoc → README.md} +66 -31
- data/demo/{00_introduction.rdoc → 00_introduction.md} +1 -1
- data/demo/{01_single_command.rdoc → 01_single_command.md} +1 -1
- data/demo/{02_multiple_commands.rdoc → 02_multiple_commands.md} +1 -1
- data/demo/{03_help_text.rdoc → 03_help_text.md} +5 -5
- data/demo/{04_manpage.rdoc → 04_manpage.md} +4 -4
- data/demo/{06_delegate_example.rdoc → 06_delegate_example.md} +1 -1
- data/demo/{07_command_methods.rdoc → 07_command_methods.md} +1 -1
- data/demo/{08_dispatach.rdoc → 08_dispatach.md} +1 -1
- data/demo/{05_optparse_example.rdoc → 09_optparse_example.md} +1 -1
- data/demo/samples/bin/hello +9 -2
- data/lib/executable/completion.rb +82 -0
- data/lib/executable/core_ext/unbound_method.rb +102 -0
- data/lib/executable/core_ext.rb +1 -102
- data/lib/executable/dispatch.rb +1 -1
- data/lib/executable/domain.rb +52 -5
- data/lib/executable/help.rb +28 -19
- data/lib/executable/parser.rb +7 -3
- data/lib/executable/version.rb +2 -22
- data/lib/executable.rb +3 -2
- metadata +43 -89
- data/.ruby +0 -61
- data/.yardopts +0 -7
- data/COPYING.rdoc +0 -35
- data/DEMO.rdoc +0 -568
- data/Schedule.reap +0 -17
- data/meta/authors +0 -2
- data/meta/copyrights +0 -3
- data/meta/created +0 -1
- data/meta/description +0 -6
- data/meta/name +0 -1
- data/meta/organization +0 -1
- data/meta/repositories +0 -2
- data/meta/requirements +0 -6
- data/meta/resources +0 -7
- data/meta/summary +0 -1
- data/meta/version +0 -1
- data/test/test_executable.rb +0 -59
data/test/test_executable.rb
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
$:.unshift(File.dirname(__FILE__)+'/../lib')
|
|
2
|
-
|
|
3
|
-
require 'microtest'
|
|
4
|
-
require 'ae'
|
|
5
|
-
|
|
6
|
-
require 'executable'
|
|
7
|
-
|
|
8
|
-
class ExecutableTestCase < MicroTest::TestCase
|
|
9
|
-
|
|
10
|
-
class MyCommand
|
|
11
|
-
include Executable
|
|
12
|
-
|
|
13
|
-
attr_reader :size, :quiet, :file
|
|
14
|
-
|
|
15
|
-
def initialize
|
|
16
|
-
@file = 'hey.txt' # default
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def quiet=(bool)
|
|
20
|
-
@quiet = bool
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def quiet?
|
|
24
|
-
@quiet
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def size=(integer)
|
|
28
|
-
@size = integer.to_i
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def file=(fname)
|
|
32
|
-
@file = fname
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def call(*args)
|
|
36
|
-
@args = args
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def test_boolean_optiion
|
|
41
|
-
mc = MyCommand.execute('--quiet')
|
|
42
|
-
mc.assert.quiet?
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_integer_optiion
|
|
46
|
-
mc = MyCommand.execute('--size=4')
|
|
47
|
-
mc.size.assert == 4
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def test_default_value
|
|
51
|
-
mc = MyCommand.execute('')
|
|
52
|
-
mc.file.assert == 'hey.txt'
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
#def usage_output
|
|
56
|
-
# MyCommand.help.usage.assert == "{$0} [options] [subcommand]"
|
|
57
|
-
#end
|
|
58
|
-
|
|
59
|
-
end
|