rubikon 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/Rakefile +1 -1
- data/lib/rubikon/application/instance_methods.rb +1 -0
- data/lib/rubikon.rb +1 -1
- data/test/test_command.rb +2 -2
- data/test/test_has_arguments.rb +52 -42
- data/test/test_helper.rb +0 -1
- data/test/test_option.rb +0 -11
- metadata +5 -4
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--private
|
data/Rakefile
CHANGED
@@ -32,7 +32,7 @@ begin
|
|
32
32
|
gem.email = 'koraktor@gmail.com'
|
33
33
|
gem.description = 'A simple to use, yet powerful Ruby framework for building console-based applications.'
|
34
34
|
gem.date = Time.now
|
35
|
-
gem.files = %w(README.md Rakefile LICENSE) + samples_files + src_files + test_files
|
35
|
+
gem.files = %w(.yardopts README.md Rakefile LICENSE) + samples_files + src_files + test_files
|
36
36
|
gem.has_rdoc = false
|
37
37
|
gem.homepage = 'http://koraktor.github.com/rubikon'
|
38
38
|
gem.name = gem.rubyforge_project = 'rubikon'
|
data/lib/rubikon.rb
CHANGED
data/test/test_command.rb
CHANGED
@@ -11,9 +11,9 @@ class TestCommand < Test::Unit::TestCase
|
|
11
11
|
|
12
12
|
context 'A Rubikon command' do
|
13
13
|
|
14
|
-
should 'be a Parameter' do
|
14
|
+
should 'be a Parameter with arguments' do
|
15
15
|
assert Command.included_modules.include?(Parameter)
|
16
|
-
assert Command.
|
16
|
+
assert Command.included_modules.include?(HasArguments)
|
17
17
|
end
|
18
18
|
|
19
19
|
should 'raise an exception when no appliation is given' do
|
data/test/test_has_arguments.rb
CHANGED
@@ -21,79 +21,89 @@ class TestHasArguments < Test::Unit::TestCase
|
|
21
21
|
context 'A parameter with arguments' do
|
22
22
|
|
23
23
|
should 'allow a Numeric as argument count' do
|
24
|
-
|
25
|
-
assert_equal 1..1,
|
26
|
-
assert_nil
|
24
|
+
has_arg = HasArg.new(1)
|
25
|
+
assert_equal 1..1, has_arg.arg_count
|
26
|
+
assert_nil has_arg.arg_names
|
27
27
|
end
|
28
28
|
|
29
29
|
should 'allow a Range as argument count' do
|
30
|
-
|
31
|
-
assert_equal 1..3,
|
32
|
-
assert_nil
|
30
|
+
has_arg = HasArg.new(1..3)
|
31
|
+
assert_equal 1..3, has_arg.arg_count
|
32
|
+
assert_nil has_arg.arg_names
|
33
33
|
end
|
34
34
|
|
35
35
|
should 'allow an Array as argument count' do
|
36
|
-
|
37
|
-
assert_equal 2..6,
|
38
|
-
assert_nil
|
36
|
+
has_arg = HasArg.new([2, 5, 6])
|
37
|
+
assert_equal 2..6, has_arg.arg_count
|
38
|
+
assert_nil has_arg.arg_names
|
39
39
|
end
|
40
40
|
|
41
41
|
should 'allow a Symbol Array as argument names' do
|
42
|
-
|
43
|
-
assert_equal 3..3,
|
44
|
-
assert_equal [:arg1, :arg2, :arg3],
|
42
|
+
has_arg = HasArg.new([:arg1, :arg2, :arg3])
|
43
|
+
assert_equal 3..3, has_arg.arg_count
|
44
|
+
assert_equal [:arg1, :arg2, :arg3], has_arg.arg_names
|
45
45
|
end
|
46
46
|
|
47
47
|
should 'only have required arguments if argument count is > 0' do
|
48
|
-
|
49
|
-
assert
|
50
|
-
assert
|
51
|
-
|
52
|
-
assert_equal %w{argument},
|
48
|
+
has_arg = HasArg.new(2)
|
49
|
+
assert !has_arg.args_full?
|
50
|
+
assert has_arg.more_args?
|
51
|
+
has_arg << 'argument'
|
52
|
+
assert_equal %w{argument}, has_arg.args
|
53
53
|
assert_raise MissingArgumentError do
|
54
|
-
|
54
|
+
has_arg.check_args
|
55
55
|
end
|
56
|
-
|
57
|
-
assert
|
58
|
-
assert
|
59
|
-
assert_equal %w{argument argument},
|
56
|
+
has_arg << 'argument'
|
57
|
+
assert has_arg.args_full?
|
58
|
+
assert !has_arg.more_args?
|
59
|
+
assert_equal %w{argument argument}, has_arg.args
|
60
60
|
assert_raise ExtraArgumentError do
|
61
|
-
|
61
|
+
has_arg << 'argument'
|
62
62
|
end
|
63
|
-
assert_equal %w{argument argument},
|
63
|
+
assert_equal %w{argument argument}, has_arg.args
|
64
64
|
end
|
65
65
|
|
66
66
|
should 'have required and optional arguments if argument count is < 0' do
|
67
|
-
|
68
|
-
assert
|
69
|
-
assert
|
67
|
+
has_arg = HasArg.new(-1)
|
68
|
+
assert !has_arg.args_full?
|
69
|
+
assert has_arg.more_args?
|
70
70
|
assert_raise MissingArgumentError do
|
71
|
-
|
71
|
+
has_arg.check_args
|
72
72
|
end
|
73
|
-
|
74
|
-
assert
|
75
|
-
assert
|
76
|
-
assert_equal %w{argument},
|
73
|
+
has_arg << 'argument'
|
74
|
+
assert has_arg.args_full?
|
75
|
+
assert has_arg.more_args?
|
76
|
+
assert_equal %w{argument}, has_arg.args
|
77
77
|
end
|
78
78
|
|
79
79
|
should 'only have optional arguments if argument count is 0' do
|
80
|
-
|
81
|
-
assert
|
82
|
-
assert
|
83
|
-
|
84
|
-
assert_equal %w{argument},
|
80
|
+
has_arg = HasArg.new(0)
|
81
|
+
assert has_arg.args_full?
|
82
|
+
assert has_arg.more_args?
|
83
|
+
has_arg << 'argument'
|
84
|
+
assert_equal %w{argument}, has_arg.args
|
85
85
|
end
|
86
86
|
|
87
87
|
should 'provide named arguments' do
|
88
|
-
|
89
|
-
|
90
|
-
assert_equal 'argument',
|
91
|
-
assert_equal 'argument',
|
88
|
+
has_arg = HasArg.new([:named])
|
89
|
+
has_arg << 'argument'
|
90
|
+
assert_equal 'argument', has_arg[:named]
|
91
|
+
assert_equal 'argument', has_arg.named
|
92
92
|
assert_raise NoMethodError do
|
93
|
-
|
93
|
+
has_arg.not_named
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
+
should 'call its code block if it is activated' do
|
98
|
+
block_run = false
|
99
|
+
has_arg = HasArg.new nil do
|
100
|
+
block_run = true
|
101
|
+
end
|
102
|
+
has_arg.active!
|
103
|
+
assert has_arg.active?
|
104
|
+
assert block_run
|
105
|
+
end
|
106
|
+
|
97
107
|
end
|
98
108
|
|
99
109
|
end
|
data/test/test_helper.rb
CHANGED
data/test/test_option.rb
CHANGED
@@ -14,17 +14,6 @@ class TestOption < Test::Unit::TestCase
|
|
14
14
|
should 'be a Parameter with arguments' do
|
15
15
|
assert Option.included_modules.include?(Parameter)
|
16
16
|
assert Option.included_modules.include?(HasArguments)
|
17
|
-
assert Option.new(@app, :test).is_a?(Parameter)
|
18
|
-
end
|
19
|
-
|
20
|
-
should 'call its code block if it is activated' do
|
21
|
-
block_run = false
|
22
|
-
option = Option.new @app, :test do
|
23
|
-
block_run = true
|
24
|
-
end
|
25
|
-
option.active!
|
26
|
-
assert option.active?
|
27
|
-
assert block_run
|
28
17
|
end
|
29
18
|
|
30
19
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubikon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sebastian Staudt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-18 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -70,6 +70,7 @@ extra_rdoc_files:
|
|
70
70
|
- LICENSE
|
71
71
|
- README.md
|
72
72
|
files:
|
73
|
+
- .yardopts
|
73
74
|
- LICENSE
|
74
75
|
- README.md
|
75
76
|
- Rakefile
|