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 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'
@@ -4,6 +4,7 @@
4
4
  # Copyright (c) 2009-2010, Sebastian Staudt
5
5
 
6
6
  require 'pathname'
7
+ require 'stringio'
7
8
 
8
9
  require 'rubikon/application/sandbox'
9
10
  require 'rubikon/command'
data/lib/rubikon.rb CHANGED
@@ -24,6 +24,6 @@ require 'rubikon/application/base'
24
24
  module Rubikon
25
25
 
26
26
  # This is the current version of the Rubikon gem
27
- VERSION = '0.4.0'
27
+ VERSION = '0.4.1'
28
28
 
29
29
  end
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.new(@app, :command){}.is_a?(Parameter)
16
+ assert Command.included_modules.include?(HasArguments)
17
17
  end
18
18
 
19
19
  should 'raise an exception when no appliation is given' do
@@ -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
- @has_arg = HasArg.new(1)
25
- assert_equal 1..1, @has_arg.arg_count
26
- assert_nil @has_arg.arg_names
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
- @has_arg = HasArg.new(1..3)
31
- assert_equal 1..3, @has_arg.arg_count
32
- assert_nil @has_arg.arg_names
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
- @has_arg = HasArg.new([2, 5, 6])
37
- assert_equal 2..6, @has_arg.arg_count
38
- assert_nil @has_arg.arg_names
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
- @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
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
- @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
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
- @has_arg.check_args
54
+ has_arg.check_args
55
55
  end
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
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
- @has_arg << 'argument'
61
+ has_arg << 'argument'
62
62
  end
63
- assert_equal %w{argument argument}, @has_arg.args
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
- @has_arg = HasArg.new(-1)
68
- assert !@has_arg.args_full?
69
- assert @has_arg.more_args?
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
- @has_arg.check_args
71
+ has_arg.check_args
72
72
  end
73
- @has_arg << 'argument'
74
- assert @has_arg.args_full?
75
- assert @has_arg.more_args?
76
- assert_equal %w{argument}, @has_arg.args
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
- @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
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
- @has_arg = HasArg.new([:named])
89
- @has_arg << 'argument'
90
- assert_equal 'argument', @has_arg[:named]
91
- assert_equal 'argument', @has_arg.named
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
- @has_arg.not_named
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
@@ -10,7 +10,6 @@ include Rubikon
10
10
 
11
11
  require 'rubygems'
12
12
  require 'shoulda'
13
- require 'stringio'
14
13
 
15
14
  unless RUBY_VERSION[0..2] == '1.9'
16
15
  begin require 'redgreen'; rescue LoadError; end
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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
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-16 00:00:00 +02:00
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