blockenspiel 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Blockenspiel.rdoc +5 -1
- data/History.rdoc +7 -0
- data/README.rdoc +6 -2
- data/Version +1 -1
- data/ext/unmixer_mri/extconf.rb +10 -10
- data/ext/unmixer_mri/unmixer_mri.c +10 -10
- data/lib/blockenspiel.rb +7 -7
- data/lib/blockenspiel/builder.rb +52 -52
- data/lib/blockenspiel/dsl_setup.rb +86 -86
- data/lib/blockenspiel/errors.rb +18 -18
- data/lib/blockenspiel/impl.rb +116 -116
- data/lib/blockenspiel/unmixer_rubinius.rb +22 -22
- data/lib/blockenspiel/unmixer_unimplemented.rb +17 -17
- data/lib/blockenspiel/version.rb +9 -9
- data/lib/blockenspiel/versionomy.rb +11 -13
- data/test/tc_basic.rb +38 -38
- data/test/tc_behaviors.rb +36 -36
- data/test/tc_dsl_attrs.rb +37 -37
- data/test/tc_dsl_methods.rb +86 -86
- data/test/tc_dynamic.rb +39 -39
- data/test/tc_embedded_block.rb +29 -28
- data/test/tc_mixins.rb +103 -68
- data/test/tc_modules.rb +49 -49
- data/test/tc_version.rb +59 -0
- metadata +27 -29
- data/lib/blockenspiel_unmixer_jruby.jar +0 -0
data/test/tc_modules.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Blockenspiel module tests
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# This file contains tests for DSL module inclusion.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
# Copyright 2008-2011 Daniel Azuma
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# All rights reserved.
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Redistribution and use in source and binary forms, with or without
|
13
13
|
# modification, are permitted provided that the following conditions are met:
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# * Redistributions of source code must retain the above copyright notice,
|
16
16
|
# this list of conditions and the following disclaimer.
|
17
17
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# * Neither the name of the copyright holder, nor the names of any other
|
21
21
|
# contributors to this software, may be used to endorse or promote products
|
22
22
|
# derived from this software without specific prior written permission.
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
25
25
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
26
26
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -42,86 +42,86 @@ require 'blockenspiel'
|
|
42
42
|
|
43
43
|
module Blockenspiel
|
44
44
|
module Tests # :nodoc:
|
45
|
-
|
45
|
+
|
46
46
|
class TestBasic < ::Test::Unit::TestCase # :nodoc:
|
47
|
-
|
48
|
-
|
47
|
+
|
48
|
+
|
49
49
|
class Target1
|
50
50
|
include ::Blockenspiel::DSL
|
51
|
-
|
51
|
+
|
52
52
|
def initialize
|
53
53
|
@hash = ::Hash.new
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def set_value(key_, value_)
|
57
57
|
@hash[key_] = value_
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def _helper_method(key_, value_)
|
61
61
|
@hash[key_] = value_
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def get_value(key_)
|
65
65
|
@hash[key_]
|
66
66
|
end
|
67
67
|
dsl_method :get_value, false
|
68
|
-
|
68
|
+
|
69
69
|
def get_value2(key_)
|
70
70
|
@hash[key_]
|
71
71
|
end
|
72
72
|
dsl_method :get_value2, false
|
73
|
-
|
73
|
+
|
74
74
|
end
|
75
|
-
|
76
|
-
|
75
|
+
|
76
|
+
|
77
77
|
module Module2
|
78
|
-
|
78
|
+
|
79
79
|
def set_value(key_, value_)
|
80
80
|
@hash[key_] = value_
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
def _get_value(key_)
|
84
84
|
@hash[key_]
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
class Target2a
|
90
90
|
include ::Blockenspiel::DSL
|
91
|
-
|
91
|
+
|
92
92
|
def initialize
|
93
93
|
@hash = ::Hash.new
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
include Module2
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
class Target2b
|
100
100
|
include ::Blockenspiel::DSL
|
101
|
-
|
101
|
+
|
102
102
|
def initialize
|
103
103
|
@hash = ::Hash.new
|
104
104
|
end
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
class Target2c < Target2b
|
108
108
|
include Module2
|
109
109
|
end
|
110
|
-
|
111
|
-
|
110
|
+
|
111
|
+
|
112
112
|
# Helper method
|
113
|
-
|
113
|
+
|
114
114
|
def get_value(key_)
|
115
115
|
return :helper
|
116
116
|
end
|
117
|
-
|
118
|
-
|
117
|
+
|
118
|
+
|
119
119
|
# Test simple usage.
|
120
|
-
#
|
120
|
+
#
|
121
121
|
# * Asserts that methods are mixed in to self.
|
122
122
|
# * Asserts that methods are removed from self afterward.
|
123
123
|
# * Asserts that the specified target object still receives the messages.
|
124
|
-
|
124
|
+
|
125
125
|
def test_simple_target
|
126
126
|
block_ = ::Proc.new do
|
127
127
|
set_value(:a, 1)
|
@@ -131,13 +131,13 @@ module Blockenspiel
|
|
131
131
|
assert(!self.respond_to?(:set_value))
|
132
132
|
assert_equal(1, target_.get_value(:a))
|
133
133
|
end
|
134
|
-
|
135
|
-
|
134
|
+
|
135
|
+
|
136
136
|
# Test omissions.
|
137
|
-
#
|
137
|
+
#
|
138
138
|
# * Asserts that underscore methods are not mixed in.
|
139
139
|
# * Asserts that methods that are turned off after the fact cannot be called.
|
140
|
-
|
140
|
+
|
141
141
|
def test_omissions
|
142
142
|
block_ = ::Proc.new do
|
143
143
|
set_value(:a, 1)
|
@@ -150,12 +150,12 @@ module Blockenspiel
|
|
150
150
|
target_ = Target1.new
|
151
151
|
::Blockenspiel.invoke(block_, target_)
|
152
152
|
end
|
153
|
-
|
154
|
-
|
153
|
+
|
154
|
+
|
155
155
|
# Test module inclusion.
|
156
|
-
#
|
156
|
+
#
|
157
157
|
# * Asserts that methods from an included module are handled.
|
158
|
-
|
158
|
+
|
159
159
|
def test_simple_module_inclusion
|
160
160
|
block_ = ::Proc.new do
|
161
161
|
set_value(:a, 1)
|
@@ -165,12 +165,12 @@ module Blockenspiel
|
|
165
165
|
::Blockenspiel.invoke(block_, target_)
|
166
166
|
assert_equal(1, target_._get_value(:a))
|
167
167
|
end
|
168
|
-
|
169
|
-
|
168
|
+
|
169
|
+
|
170
170
|
# Test module inclusion from a subclass
|
171
|
-
#
|
171
|
+
#
|
172
172
|
# * Asserts that a module can be included from a DSL subclass.
|
173
|
-
|
173
|
+
|
174
174
|
def test_simple_module_inclusion_from_subclass
|
175
175
|
block_ = ::Proc.new do
|
176
176
|
set_value(:a, 1)
|
@@ -180,9 +180,9 @@ module Blockenspiel
|
|
180
180
|
::Blockenspiel.invoke(block_, target_)
|
181
181
|
assert_equal(1, target_._get_value(:a))
|
182
182
|
end
|
183
|
-
|
184
|
-
|
183
|
+
|
184
|
+
|
185
185
|
end
|
186
|
-
|
186
|
+
|
187
187
|
end
|
188
188
|
end
|
data/test/tc_version.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Blockenspiel version tests
|
4
|
+
#
|
5
|
+
# This file contains tests for the version.
|
6
|
+
#
|
7
|
+
# -----------------------------------------------------------------------------
|
8
|
+
# Copyright 2008-2011 Daniel Azuma
|
9
|
+
#
|
10
|
+
# All rights reserved.
|
11
|
+
#
|
12
|
+
# Redistribution and use in source and binary forms, with or without
|
13
|
+
# modification, are permitted provided that the following conditions are met:
|
14
|
+
#
|
15
|
+
# * Redistributions of source code must retain the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer.
|
17
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
18
|
+
# this list of conditions and the following disclaimer in the documentation
|
19
|
+
# and/or other materials provided with the distribution.
|
20
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
21
|
+
# contributors to this software, may be used to endorse or promote products
|
22
|
+
# derived from this software without specific prior written permission.
|
23
|
+
#
|
24
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
25
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
26
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
27
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
28
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
29
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
30
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
32
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
33
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
34
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
35
|
+
# -----------------------------------------------------------------------------
|
36
|
+
;
|
37
|
+
|
38
|
+
|
39
|
+
require 'test/unit'
|
40
|
+
require 'blockenspiel'
|
41
|
+
|
42
|
+
|
43
|
+
module Blockenspiel
|
44
|
+
module Tests # :nodoc:
|
45
|
+
|
46
|
+
class TestVersion < ::Test::Unit::TestCase # :nodoc:
|
47
|
+
|
48
|
+
|
49
|
+
# Test that the version autoload works.
|
50
|
+
|
51
|
+
def test_version
|
52
|
+
assert_not_nil(::Blockenspiel::VERSION)
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
metadata
CHANGED
@@ -1,30 +1,29 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockenspiel
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.4
|
4
5
|
prerelease:
|
5
|
-
version: 0.4.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Daniel Azuma
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-06-24 00:00:00 Z
|
12
|
+
date: 2012-06-28 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
|
16
|
-
|
14
|
+
description: Blockenspiel is a helper library designed to make it easy to implement
|
15
|
+
DSL blocks. It is designed to be comprehensive and robust, supporting most common
|
16
|
+
usage patterns, and working correctly in the presence of nested blocks and multithreading.
|
17
17
|
email: dazuma@gmail.com
|
18
18
|
executables: []
|
19
|
-
|
20
|
-
extensions:
|
19
|
+
extensions:
|
21
20
|
- ext/unmixer_mri/extconf.rb
|
22
|
-
extra_rdoc_files:
|
21
|
+
extra_rdoc_files:
|
23
22
|
- Blockenspiel.rdoc
|
24
23
|
- History.rdoc
|
25
24
|
- ImplementingDSLblocks.rdoc
|
26
25
|
- README.rdoc
|
27
|
-
files:
|
26
|
+
files:
|
28
27
|
- lib/blockenspiel/builder.rb
|
29
28
|
- lib/blockenspiel/dsl_setup.rb
|
30
29
|
- lib/blockenspiel/errors.rb
|
@@ -34,7 +33,6 @@ files:
|
|
34
33
|
- lib/blockenspiel/version.rb
|
35
34
|
- lib/blockenspiel/versionomy.rb
|
36
35
|
- lib/blockenspiel.rb
|
37
|
-
- lib/blockenspiel_unmixer_jruby.jar
|
38
36
|
- ext/unmixer_mri/unmixer_mri.c
|
39
37
|
- ext/unmixer_mri/extconf.rb
|
40
38
|
- test/files/file1.rb
|
@@ -46,39 +44,38 @@ files:
|
|
46
44
|
- test/tc_embedded_block.rb
|
47
45
|
- test/tc_mixins.rb
|
48
46
|
- test/tc_modules.rb
|
47
|
+
- test/tc_version.rb
|
49
48
|
- Blockenspiel.rdoc
|
50
49
|
- History.rdoc
|
51
50
|
- ImplementingDSLblocks.rdoc
|
52
51
|
- README.rdoc
|
53
52
|
- Version
|
54
|
-
homepage: http://
|
53
|
+
homepage: http://dazuma.github.com/blockenspiel
|
55
54
|
licenses: []
|
56
|
-
|
57
55
|
post_install_message:
|
58
56
|
rdoc_options: []
|
59
|
-
|
60
|
-
require_paths:
|
57
|
+
require_paths:
|
61
58
|
- lib
|
62
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
60
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
67
64
|
version: 1.8.7
|
68
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
66
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
67
|
+
requirements:
|
68
|
+
- - ! '>'
|
69
|
+
- !ruby/object:Gem::Version
|
73
70
|
version: 1.3.1
|
74
71
|
requirements: []
|
75
|
-
|
76
72
|
rubyforge_project: virtuoso
|
77
|
-
rubygems_version: 1.8.
|
73
|
+
rubygems_version: 1.8.24
|
78
74
|
signing_key:
|
79
75
|
specification_version: 3
|
80
|
-
summary: Blockenspiel is a helper library designed to make it easy to implement DSL
|
81
|
-
|
76
|
+
summary: Blockenspiel is a helper library designed to make it easy to implement DSL
|
77
|
+
blocks.
|
78
|
+
test_files:
|
82
79
|
- test/tc_basic.rb
|
83
80
|
- test/tc_behaviors.rb
|
84
81
|
- test/tc_dsl_attrs.rb
|
@@ -87,3 +84,4 @@ test_files:
|
|
87
84
|
- test/tc_embedded_block.rb
|
88
85
|
- test/tc_mixins.rb
|
89
86
|
- test/tc_modules.rb
|
87
|
+
- test/tc_version.rb
|
Binary file
|