aquarium 0.5.1 → 0.7.1
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/CHANGES +240 -215
- data/README +61 -44
- data/RELEASE-PLAN +21 -23
- data/Rakefile +64 -94
- data/UPGRADE +45 -35
- data/aquarium.gemspec +50 -0
- data/examples/README.txt +6 -0
- data/examples/aspect_design_example_spec.rb +2 -2
- data/examples/design_by_contract_example_spec.rb +3 -3
- data/examples/exception_wrapping_example_spec.rb +2 -2
- data/examples/introductions_example_spec.rb +1 -1
- data/examples/method_tracing_example_spec.rb +17 -16
- data/examples/reusable_aspect_hack_example_spec.rb +5 -5
- data/jruby/Rakefile +61 -0
- data/jruby/java/example/Worker.java +9 -0
- data/jruby/java/example/sorter/StringListSorter.java +22 -0
- data/jruby/java/example/sorter/converter/StringListCaseConverterAndSorter.java +42 -0
- data/jruby/java/example/visibility/Visibility.java +13 -0
- data/jruby/spec/java_class_aspects_spec.rb +434 -0
- data/jruby/spec/java_visibility_spec.rb +122 -0
- data/jruby/spec/spec_helper.rb +5 -0
- data/lib/aquarium/aspects/aspect.rb +8 -4
- data/lib/aquarium/utils/type_utils.rb +4 -1
- data/lib/aquarium/version.rb +29 -28
- data/previous_failures.txt +0 -0
- data/rspec.watchr +60 -0
- data/spec/aquarium/aspects/advice_spec.rb +10 -10
- data/spec/aquarium/aspects/aspect_invocation_spec.rb +79 -79
- data/spec/aquarium/aspects/aspect_spec.rb +73 -73
- data/spec/aquarium/aspects/aspect_with_nested_types_spec.rb +5 -5
- data/spec/aquarium/aspects/concurrent_aspects_spec.rb +1 -1
- data/spec/aquarium/aspects/default_objects_handler_spec.rb +5 -5
- data/spec/aquarium/aspects/join_point_spec.rb +40 -40
- data/spec/aquarium/aspects/pointcut_and_composition_spec.rb +8 -8
- data/spec/aquarium/aspects/pointcut_spec.rb +25 -25
- data/spec/aquarium/extensions/regex_spec.rb +6 -6
- data/spec/aquarium/extras/design_by_contract_spec.rb +6 -6
- data/spec/aquarium/finders/finder_result_spec.rb +2 -2
- data/spec/aquarium/finders/method_finder_spec.rb +24 -24
- data/spec/aquarium/finders/pointcut_finder_spec.rb +10 -10
- data/spec/aquarium/finders/pointcut_finder_spec_test_classes.rb +4 -4
- data/spec/aquarium/finders/type_finder_spec.rb +5 -5
- data/spec/aquarium/finders/type_finder_with_descendents_and_ancestors_spec.rb +6 -5
- data/spec/aquarium/finders/type_finder_with_nested_types_spec.rb +2 -2
- data/spec/aquarium/utils/logic_error_spec.rb +1 -1
- data/spec/aquarium/utils/method_utils_spec.rb +38 -38
- data/spec/aquarium/utils/nil_object_spec.rb +11 -11
- data/spec/aquarium/utils/options_utils_spec.rb +8 -8
- data/spec/aquarium/utils/type_utils_spec.rb +3 -3
- metadata +238 -57
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 607c8e2ff478a03b28cb82786e11db87f2809aeedb30749ca57c93e3da75a8e3
|
4
|
+
data.tar.gz: 027f4f0635c170239546fde6547f8c84a684020046cd940f3466ab9f8bbb45a4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: de21011f1c22b93eac2de02630836c40759511a80d2d02b6ee626e98a17b41bcaf50d1bb65393da9123b1638e7b503c37075764e30fbb380dd25e216134ac6e3
|
7
|
+
data.tar.gz: 30157999d9b464b2bdcb8808a14ab7f1ed90b89a8959f7cc9fe5ed7cb52f4355c6a4770f6210622d47b3e2ec85fe6e8f80ab917eb74a26d2cedd5d3448fc911f
|
data/CHANGES
CHANGED
@@ -1,12 +1,37 @@
|
|
1
|
+
== Version 0.7.1
|
2
|
+
|
3
|
+
Adds support for Ruby 2.6. It was tested with 2.6.3p62 (2019-04-16 revision 67580). Basic JRuby 9.2.7.0 (2.5.3) 2019-04-09 8a269e3 support is provided, but using JRuby currently does *not* pass all the custom Java specs in the `jruby/spec` directory, which specifically test working with Java classes. However, JRuby does pass all the Ruby specs in the `spec` directory. This is a long-standing issue with JRuby support in Aquarium. Patches are welcome!
|
4
|
+
|
5
|
+
== Version 0.6.0
|
6
|
+
|
7
|
+
V0.6.0 fixes thread-unsafe code in Aspect::alias_original_method_text, which
|
8
|
+
I've known about since the beginning of the project. At the beginning of Aquarium,
|
9
|
+
circa 2006, the overhead of making copies of JoinPoints in this method was
|
10
|
+
approximately 30%! So, I sacrificed thread-safety for performance. Now, thread
|
11
|
+
safety is increasingly important in modern apps, and fortunately, the overhead
|
12
|
+
on newer machines and newer versions of Ruby is greatly reduced for making these
|
13
|
+
copies. Hence, this problem is fixed.
|
14
|
+
|
15
|
+
The rspec suite does not test thread safety in any rigorous way, so caution is
|
16
|
+
advised. Please report any problems or better, submit pull requests of better
|
17
|
+
threading tests and possible bug fixes. As always, thanks in advance.
|
18
|
+
|
19
|
+
I also fixed deprecation warnings from the latest version of RSpec. There were a
|
20
|
+
lot of them!
|
21
|
+
|
22
|
+
Now supports Ruby 1.9.X, Ruby 2.0, and JRuby 1.7.4 (please report version-related bugs!)
|
23
|
+
Drops official support for Ruby 1.8.X.
|
24
|
+
|
25
|
+
|
1
26
|
== Version 0.5.1
|
2
27
|
|
3
28
|
V0.5.1 adds support for Ruby 1.8.7, Ruby 1.9.3, JRuby 1.6.7,
|
4
29
|
RSpec 2.9, and Webgen (0.5.14 - for the build process).
|
5
30
|
|
6
|
-
WARNING: Earlier versions of Ruby 1.8, 1.9 and JRuby 1.X are not
|
31
|
+
WARNING: Earlier versions of Ruby 1.8, 1.9 and JRuby 1.X are not
|
7
32
|
supported. JRuby support is limited to "pure" Ruby code; the main
|
8
|
-
RSpec specifications pass under JRuby, but not the JRuby-specific
|
9
|
-
specifications in jruby/spec. Restoring full JRuby support is planned,
|
33
|
+
RSpec specifications pass under JRuby, but not the JRuby-specific
|
34
|
+
specifications in jruby/spec. Restoring full JRuby support is planned,
|
10
35
|
but the timeframe is TBD.
|
11
36
|
|
12
37
|
It also has some minor API changes summarized below.
|
@@ -16,28 +41,28 @@ Enhancements:
|
|
16
41
|
27235 Support RSpec 1.2.8 (actually 2.9) and and JRuby 1.3.1 (actually 1.6.7)
|
17
42
|
27236 Upgrade website generation to webgen 0.5.X (X=14)
|
18
43
|
|
19
|
-
The actual versions of these tools supported are more recent versions
|
44
|
+
The actual versions of these tools supported are more recent versions
|
20
45
|
shown in parentheses.
|
21
46
|
|
22
|
-
There are no API changes in this release, with two exceptions.
|
47
|
+
There are no API changes in this release, with two exceptions.
|
23
48
|
|
24
|
-
First, Most of the code changes are minor fixes to RSpec files. The one
|
25
|
-
exception is an apparent change that occurred in JRuby 1.3.X with respect
|
26
|
-
to the access restrictions on Java methods. It now appears that protected
|
27
|
-
methods are public, that is they are in the method list returned by
|
28
|
-
:public_methods, but not :protected_methods. Also, private methods are
|
29
|
-
not returned by any of the :*_methods.
|
49
|
+
First, Most of the code changes are minor fixes to RSpec files. The one
|
50
|
+
exception is an apparent change that occurred in JRuby 1.3.X with respect
|
51
|
+
to the access restrictions on Java methods. It now appears that protected
|
52
|
+
methods are public, that is they are in the method list returned by
|
53
|
+
:public_methods, but not :protected_methods. Also, private methods are
|
54
|
+
not returned by any of the :*_methods.
|
30
55
|
|
31
|
-
Second, there was a deprecated option to the MethodFinder class,
|
56
|
+
Second, there was a deprecated option to the MethodFinder class,
|
32
57
|
:options, that has been removed. Use :method_options instead.
|
33
58
|
|
34
|
-
I used the upgrade to Webgen 0.5.X as an excuse to refresh the web site's
|
59
|
+
I used the upgrade to Webgen 0.5.X as an excuse to refresh the web site's
|
35
60
|
appearance. The content is mostly the same as before.
|
36
61
|
|
37
62
|
|
38
63
|
== Version 0.4.3
|
39
64
|
|
40
|
-
V0.4.3 adds a few bug fixes and enhancements, and several internal
|
65
|
+
V0.4.3 adds a few bug fixes and enhancements, and several internal
|
41
66
|
refactorings to improve performance, etc.
|
42
67
|
|
43
68
|
Bug fixes:
|
@@ -45,114 +70,114 @@ Bug fixes:
|
|
45
70
|
|
46
71
|
Enhancements:
|
47
72
|
14165 Support Ruby 1.8.2, 1.8.5, 1.8.6, 1.9.X and 2.0 releases and snapshots
|
48
|
-
21283 Allow "_of" suffix at end of "*_and_descendents", "*_and_ancestors",
|
73
|
+
21283 Allow "_of" suffix at end of "*_and_descendents", "*_and_ancestors",
|
49
74
|
and "*_nested_types"
|
50
|
-
21924 Should be able to turn off contract-testing aspects globally in the
|
75
|
+
21924 Should be able to turn off contract-testing aspects globally in the
|
51
76
|
Design by Contract extra module
|
52
|
-
21993 By default, don't advise "system" methods that being with "_", but
|
77
|
+
21993 By default, don't advise "system" methods that being with "_", but
|
53
78
|
provide an option to do so
|
54
79
|
|
55
80
|
Details:
|
56
|
-
14165: I closed this one because it's too broad. Aquarium currently runs with
|
81
|
+
14165: I closed this one because it's too broad. Aquarium currently runs with
|
57
82
|
1.8.6. I will open a new enhancement specifically for 1.9.
|
58
|
-
21283: Sometimes appending "_of" makes the specification read more smoothly,
|
83
|
+
21283: Sometimes appending "_of" makes the specification read more smoothly,
|
59
84
|
so it's now an option.
|
60
|
-
21924: To class-level methods in DesignByContract, enable_all and disable_all,
|
85
|
+
21924: To class-level methods in DesignByContract, enable_all and disable_all,
|
61
86
|
globally turn contracts on or off. See their documentation for details.
|
62
|
-
21993: Now, by default, MethodFinder won't match any method that starts with
|
63
|
-
two underscores ("__"), so you don't have to :exclude_ancestors as much just
|
64
|
-
to avoid matching methods like "__id__" and "__send__". There is also a new
|
65
|
-
:method_options called :include_system_methods that will not suppress
|
66
|
-
matching these methods. So, I'm calling these special methods "system
|
67
|
-
methods". I don't yet provide a way to configure this list (RSpec methods
|
68
|
-
would be good additions...). The list is currently defined as an array of
|
69
|
-
regex's, MethodFinder::IGNORED_SYSTEM_METHODS. NOTE: This is effectively a
|
87
|
+
21993: Now, by default, MethodFinder won't match any method that starts with
|
88
|
+
two underscores ("__"), so you don't have to :exclude_ancestors as much just
|
89
|
+
to avoid matching methods like "__id__" and "__send__". There is also a new
|
90
|
+
:method_options called :include_system_methods that will not suppress
|
91
|
+
matching these methods. So, I'm calling these special methods "system
|
92
|
+
methods". I don't yet provide a way to configure this list (RSpec methods
|
93
|
+
would be good additions...). The list is currently defined as an array of
|
94
|
+
regex's, MethodFinder::IGNORED_SYSTEM_METHODS. NOTE: This is effectively a
|
70
95
|
behavior change, although it's not likely to affect anyone.
|
71
96
|
|
72
97
|
== Version 0.4.2
|
73
98
|
|
74
|
-
V0.4.2 adds a few bug fixes and enhancements, greatly improved RDoc output,
|
99
|
+
V0.4.2 adds a few bug fixes and enhancements, greatly improved RDoc output,
|
75
100
|
and internal refactorings to improve performance.
|
76
101
|
|
77
102
|
Bug fixes:
|
78
103
|
15202 Intermittent confusion between classes and objects when invoking advice
|
79
|
-
19262 Just putting join_point argument in advice block causes mysterious
|
104
|
+
19262 Just putting join_point argument in advice block causes mysterious
|
80
105
|
method missing error.
|
81
106
|
19321 Advice overhead is too high (ongoing improvements)
|
82
107
|
|
83
108
|
Enhancements:
|
84
|
-
13403 Support recursion into nested types without requiring "tricky" regular
|
109
|
+
13403 Support recursion into nested types without requiring "tricky" regular
|
85
110
|
expressions
|
86
111
|
13406 "Sugar" for adding methods and attributes to types
|
87
112
|
18537 Provide a search for all pointcut constants
|
88
113
|
19666 Improve the RDoc output
|
89
|
-
19119 Provide an "after_raising" type of advice that lets you handle the
|
114
|
+
19119 Provide an "after_raising" type of advice that lets you handle the
|
90
115
|
exception.
|
91
116
|
|
92
|
-
#15202: I never figured out the cause of this problem, but it hasn't been seen
|
93
|
-
since late last
|
94
|
-
year, so I suspect it disappeared as a side effect of on-going refactoring and
|
117
|
+
#15202: I never figured out the cause of this problem, but it hasn't been seen
|
118
|
+
since late last
|
119
|
+
year, so I suspect it disappeared as a side effect of on-going refactoring and
|
95
120
|
enhancements.
|
96
121
|
|
97
|
-
#19262: If you just specified "|jp|" for an advice block, you would sometimes
|
98
|
-
get a method missing error. I never figured out exactly why, but it was
|
99
|
-
somehow related to passing the usual three arguments internally, where the
|
100
|
-
last two would be ignored in this case. Now, the code checks the arity and
|
101
|
-
only passes the join point in this case.
|
122
|
+
#19262: If you just specified "|jp|" for an advice block, you would sometimes
|
123
|
+
get a method missing error. I never figured out exactly why, but it was
|
124
|
+
somehow related to passing the usual three arguments internally, where the
|
125
|
+
last two would be ignored in this case. Now, the code checks the arity and
|
126
|
+
only passes the join point in this case.
|
102
127
|
|
103
|
-
#19321: I removed some of the wasted object creation and initialization in
|
104
|
-
advice invocation,
|
105
|
-
improving the overhead by about 40%. However, it is still at least 10x higher
|
106
|
-
than simple method aliasing, so I want to make more improvements. (I did not
|
128
|
+
#19321: I removed some of the wasted object creation and initialization in
|
129
|
+
advice invocation,
|
130
|
+
improving the overhead by about 40%. However, it is still at least 10x higher
|
131
|
+
than simple method aliasing, so I want to make more improvements. (I did not
|
107
132
|
close this item.)
|
108
133
|
|
109
|
-
#13403: I added new options :types_and_nested_types and :types_and_nested that
|
110
|
-
are analogous to the similar "ancestors" and "descendents" options. The
|
111
|
-
nested option will return the specified types and any types they "enclose".
|
134
|
+
#13403: I added new options :types_and_nested_types and :types_and_nested that
|
135
|
+
are analogous to the similar "ancestors" and "descendents" options. The
|
136
|
+
nested option will return the specified types and any types they "enclose".
|
112
137
|
There are also corresponding "exclude" options.
|
113
138
|
|
114
|
-
#13406: I've decided not to do this, as it really isn't the "simplest thing
|
139
|
+
#13406: I've decided not to do this, as it really isn't the "simplest thing
|
115
140
|
that could possibly work." It's easy enough for the user to define a module
|
116
|
-
of new behavior and just use "obj.extend(module)". However, when the user
|
141
|
+
of new behavior and just use "obj.extend(module)". However, when the user
|
117
142
|
needs to do this over a set of types, Aquarium's TypeFinder can be helpful,
|
118
143
|
so I added an example to the Examples code and page.
|
119
144
|
|
120
|
-
#18537: I've provided an example of the design approach where you define
|
121
|
-
pointcuts in a class, as a kind of "aspect interface" and write aspects that
|
122
|
-
specify those pointcuts. The problem has been that you had to name every
|
123
|
-
single such pointcut explicitly. There was no "finder" option, as for types,
|
124
|
-
methods, etc. Now there is a pointcut finder option with a new option
|
125
|
-
":named_pointcuts" for Aspect.new to specify a search for pointcuts in a set
|
126
|
-
of types matching a name specification. Either constants or class variables
|
145
|
+
#18537: I've provided an example of the design approach where you define
|
146
|
+
pointcuts in a class, as a kind of "aspect interface" and write aspects that
|
147
|
+
specify those pointcuts. The problem has been that you had to name every
|
148
|
+
single such pointcut explicitly. There was no "finder" option, as for types,
|
149
|
+
methods, etc. Now there is a pointcut finder option with a new option
|
150
|
+
":named_pointcuts" for Aspect.new to specify a search for pointcuts in a set
|
151
|
+
of types matching a name specification. Either constants or class variables
|
127
152
|
will be matched (or both).
|
128
153
|
|
129
|
-
#19666: The rdoc for the key classes was cleaned up so it "renders" better.
|
154
|
+
#19666: The rdoc for the key classes was cleaned up so it "renders" better.
|
130
155
|
Feedback is welcome.
|
131
156
|
|
132
|
-
#19119: I finished the previously-incomplete support for allowing advice to
|
133
|
-
change the raised exception, in both after and after_raising advice. A
|
134
|
-
common scenario is to wrap the thrown exception in another. For example, a
|
157
|
+
#19119: I finished the previously-incomplete support for allowing advice to
|
158
|
+
change the raised exception, in both after and after_raising advice. A
|
159
|
+
common scenario is to wrap the thrown exception in another. For example, a
|
135
160
|
low-level, service-specific exception (like a database error) in a
|
136
|
-
higher-level, more generic application exception.
|
161
|
+
higher-level, more generic application exception.
|
137
162
|
|
138
|
-
You still can't rescue the exception completely in :after_raising and :after
|
139
|
-
advice; the value for the exception in
|
163
|
+
You still can't rescue the exception completely in :after_raising and :after
|
164
|
+
advice; the value for the exception in
|
140
165
|
joinpoint.context.raised_exception
|
141
|
-
when the advice returns will be raised by Aquarium. I think that permitting
|
142
|
-
:after_raising or :after advice to "eat" the exception could cause subtle
|
143
|
-
issues with scope and variable binding. It would also probably violate the
|
144
|
-
"principle of least surprise"; the advice code that rescues the exception would
|
166
|
+
when the advice returns will be raised by Aquarium. I think that permitting
|
167
|
+
:after_raising or :after advice to "eat" the exception could cause subtle
|
168
|
+
issues with scope and variable binding. It would also probably violate the
|
169
|
+
"principle of least surprise"; the advice code that rescues the exception would
|
145
170
|
not be as "obvious" to the reader as the familiar idiom of rescue clauses
|
146
|
-
that we are accustomed to using. Therefore, if you want to recover completely
|
171
|
+
that we are accustomed to using. Therefore, if you want to recover completely
|
147
172
|
from an exception, use rescue clauses in around advice.
|
148
173
|
|
149
174
|
== Version 0.4.1
|
150
175
|
|
151
|
-
V0.4.1 adds a few bug fixes, a few more user examples, internal refactoring and
|
176
|
+
V0.4.1 adds a few bug fixes, a few more user examples, internal refactoring and
|
152
177
|
some performance improvements.
|
153
178
|
|
154
179
|
Bug fixes:
|
155
|
-
19116 When an exception is thrown during advice execution, the error message
|
180
|
+
19116 When an exception is thrown during advice execution, the error message
|
156
181
|
always reports the advice type is :before!
|
157
182
|
19261 after_raising DSL method provides no way to specify exceptions
|
158
183
|
|
@@ -161,19 +186,19 @@ Enhancements:
|
|
161
186
|
19320 Move the Aquarium::...::AspectDSL file to Aquarium::DSL for convenience
|
162
187
|
19399 Improve the Design by Contract example
|
163
188
|
|
164
|
-
I added a new :exceptions argument (synonym :exception) that takes a single
|
165
|
-
exception or list thereof. You can only use this argument with :after_raising.
|
166
|
-
If you specify exceptions with the latter and use the :exceptions argument,
|
189
|
+
I added a new :exceptions argument (synonym :exception) that takes a single
|
190
|
+
exception or list thereof. You can only use this argument with :after_raising.
|
191
|
+
If you specify exceptions with the latter and use the :exceptions argument,
|
167
192
|
the values will be merged.
|
168
193
|
|
169
|
-
I thought it was ugly to have to type "include
|
170
|
-
Aquarium::Aspects::DSL::AspectDSL", so I moved the code so now it's "include
|
171
|
-
Aquarium::DSL". However, for backwards compatibility, the old module still
|
194
|
+
I thought it was ugly to have to type "include
|
195
|
+
Aquarium::Aspects::DSL::AspectDSL", so I moved the code so now it's "include
|
196
|
+
Aquarium::DSL". However, for backwards compatibility, the old module still
|
172
197
|
works.
|
173
198
|
|
174
199
|
== Version 0.4.0
|
175
200
|
|
176
|
-
V0.4.0 adds specs to characterize and test advising Java classes when running
|
201
|
+
V0.4.0 adds specs to characterize and test advising Java classes when running
|
177
202
|
on JRuby and adds several API enhancements.
|
178
203
|
|
179
204
|
Bug fixes:
|
@@ -185,50 +210,50 @@ Enhancements:
|
|
185
210
|
17834 Allow :class and :module (and variants) wherever :type is allowed
|
186
211
|
17881 Add specs that exercise advising Java types and objects using JRuby
|
187
212
|
|
188
|
-
#17844 occurred because of the way JRuby encodes Java packages into modules.
|
213
|
+
#17844 occurred because of the way JRuby encodes Java packages into modules.
|
189
214
|
Aquarium now properly handles JRuby types.
|
190
215
|
|
191
216
|
#17883 reflected a JRuby bug, so a workaround was required.
|
192
|
-
|
193
|
-
#17834 allows the user to substitute the words "class", "classes", "module" or
|
194
|
-
"modules" anywhere the words "type" and "types" are used in the API, since some
|
217
|
+
|
218
|
+
#17834 allows the user to substitute the words "class", "classes", "module" or
|
219
|
+
"modules" anywhere the words "type" and "types" are used in the API, since some
|
195
220
|
users might naturally want to write aspects like this:
|
196
221
|
|
197
222
|
around :calls_to => :my_method, :in_class => MyClass do ...; end
|
198
223
|
|
199
|
-
However, there is no enforcement to ensure that "class" is only used for
|
200
|
-
classes and "module" is only used for modules, etc. Note: it's possible we'll
|
201
|
-
enforce this in some future release, as a way of saying things like "only advise
|
224
|
+
However, there is no enforcement to ensure that "class" is only used for
|
225
|
+
classes and "module" is only used for modules, etc. Note: it's possible we'll
|
226
|
+
enforce this in some future release, as a way of saying things like "only advise
|
202
227
|
classes that match ...", etc. Caveat Emptor!
|
203
228
|
|
204
|
-
For #18090, a bug prevented JoinPoint#invoke_original_join_point (which allows
|
205
|
-
you to bypass all advices at the join point) from working except for :around
|
229
|
+
For #18090, a bug prevented JoinPoint#invoke_original_join_point (which allows
|
230
|
+
you to bypass all advices at the join point) from working except for :around
|
206
231
|
advice (and yes, the specs didn't cover this adequately - gasp!). Now fixed.
|
207
232
|
|
208
|
-
For #17881, I created a separate set of specs for JRuby, so it's easier to run
|
209
|
-
the "regular" Aquarium specs using MRI and the JRuby-specific specs separately
|
210
|
-
with JRuby. The new "jruby" directory contains a Rakefile, another set of specs,
|
211
|
-
and Java example code for the specs to use. The default Rakefile task re-runs
|
212
|
-
the main Aquarium spec suite using JRuby, to confirm that the suite passes
|
213
|
-
successfully, then it runs a set of different specs that load sample Java
|
233
|
+
For #17881, I created a separate set of specs for JRuby, so it's easier to run
|
234
|
+
the "regular" Aquarium specs using MRI and the JRuby-specific specs separately
|
235
|
+
with JRuby. The new "jruby" directory contains a Rakefile, another set of specs,
|
236
|
+
and Java example code for the specs to use. The default Rakefile task re-runs
|
237
|
+
the main Aquarium spec suite using JRuby, to confirm that the suite passes
|
238
|
+
successfully, then it runs a set of different specs that load sample Java
|
214
239
|
interfaces and classes into JRuby and then advises them with Aquarium.
|
215
240
|
|
216
|
-
I found a few JRuby bugs and other behavior differences between MRI during this
|
217
|
-
release. I was able to handle them with modifications to the Aquarium code. If
|
218
|
-
you "grep" the Aquarium "lib" and "spec" directories for the word "jruby"
|
219
|
-
(ignoring case), you'll find notes about these issues and the workarounds I
|
241
|
+
I found a few JRuby bugs and other behavior differences between MRI during this
|
242
|
+
release. I was able to handle them with modifications to the Aquarium code. If
|
243
|
+
you "grep" the Aquarium "lib" and "spec" directories for the word "jruby"
|
244
|
+
(ignoring case), you'll find notes about these issues and the workarounds I
|
220
245
|
implemented.
|
221
246
|
|
222
|
-
The separate JRuby spec suite shows what you can and cannot do with Java types.
|
223
|
-
As a side benefit, it also demonstrates how Java types, objects, and methods
|
224
|
-
are mapped to Ruby. There are some important limitations, however. See the
|
225
|
-
jruby.html page on the website or the README for more details.
|
247
|
+
The separate JRuby spec suite shows what you can and cannot do with Java types.
|
248
|
+
As a side benefit, it also demonstrates how Java types, objects, and methods
|
249
|
+
are mapped to Ruby. There are some important limitations, however. See the
|
250
|
+
jruby.html page on the website or the README for more details.
|
226
251
|
|
227
252
|
Note: JRuby 1.1RC2 was used.
|
228
|
-
|
253
|
+
|
229
254
|
== Version 0.3.1
|
230
255
|
|
231
|
-
V0.3.1 adds numerous performance improvements, especially in the RSpec suite,
|
256
|
+
V0.3.1 adds numerous performance improvements, especially in the RSpec suite,
|
232
257
|
and some minor API additions.
|
233
258
|
|
234
259
|
Bug fixes:
|
@@ -236,60 +261,60 @@ N.A.
|
|
236
261
|
|
237
262
|
Enhancements:
|
238
263
|
14447 Unify internal handling of reporting errors to the user
|
239
|
-
17514 Provide an Aquarium library-wide logger with configuration parameters and
|
264
|
+
17514 Provide an Aquarium library-wide logger with configuration parameters and
|
240
265
|
instance overrides
|
241
266
|
17515 Add an optional warning if an aspect doesn't match any join points
|
242
|
-
17516 Remove unnecessary examples that use :types_and_descendents to shorten
|
267
|
+
17516 Remove unnecessary examples that use :types_and_descendents to shorten
|
243
268
|
time to run the RSpec suite
|
244
|
-
17565 JoinPoint.new should convert a type name, symbol, or regex to the type
|
269
|
+
17565 JoinPoint.new should convert a type name, symbol, or regex to the type
|
245
270
|
and only allow one type
|
246
271
|
|
247
|
-
These first two enhancements are related. There is a now an
|
248
|
-
Aquarium::Utils::DefaultLogger module with static accessors for getting and
|
249
|
-
setting the "system-wide" logger.
|
272
|
+
These first two enhancements are related. There is a now an
|
273
|
+
Aquarium::Utils::DefaultLogger module with static accessors for getting and
|
274
|
+
setting the "system-wide" logger.
|
250
275
|
|
251
|
-
When instance-level overrides are necessary, the Aquarium::Utils::OptionsUtils
|
252
|
-
provides "universal" options (but currently used only by Aspect and Pointcut)
|
253
|
-
for specifying a logger (with the new :logger parameter), or alternatively,
|
254
|
-
specifying just the output stream (:logger_stream) and/or the severity
|
255
|
-
(:severity, one of the standard library's Logger::Severity-defined constants).
|
256
|
-
If either of the latter two options is specified, a separate logger instance is
|
276
|
+
When instance-level overrides are necessary, the Aquarium::Utils::OptionsUtils
|
277
|
+
provides "universal" options (but currently used only by Aspect and Pointcut)
|
278
|
+
for specifying a logger (with the new :logger parameter), or alternatively,
|
279
|
+
specifying just the output stream (:logger_stream) and/or the severity
|
280
|
+
(:severity, one of the standard library's Logger::Severity-defined constants).
|
281
|
+
If either of the latter two options is specified, a separate logger instance is
|
257
282
|
created, rather than changing parameters for the global logger.
|
258
283
|
|
259
|
-
OptionsUtils also supports a :noop parameter, which classes interpret to mean
|
284
|
+
OptionsUtils also supports a :noop parameter, which classes interpret to mean
|
260
285
|
do none (or perhaps only some) of the processing. Useful for debugging.
|
261
286
|
|
262
|
-
#17515 adds a helpful warning to the system (or aspect-instance's) logger if
|
263
|
-
an aspect matches no join points. This warning will be suppressed if (i) the
|
264
|
-
severity level for the logger is above WARN or (ii) the aspect was created
|
287
|
+
#17515 adds a helpful warning to the system (or aspect-instance's) logger if
|
288
|
+
an aspect matches no join points. This warning will be suppressed if (i) the
|
289
|
+
severity level for the logger is above WARN or (ii) the aspect was created
|
265
290
|
with the option :ignore_no_matching_join_points => true.
|
266
291
|
|
267
|
-
#17516 fixes halved the long execution times for the whole RSpec suite by
|
268
|
-
refactoring some examples that used type finders with the :types_and_descendents
|
269
|
-
option unnecessarily. It is a very intensive computation! Note that I stubbed
|
270
|
-
out these calls using an aspect with around advise, a useful "development-time"
|
292
|
+
#17516 fixes halved the long execution times for the whole RSpec suite by
|
293
|
+
refactoring some examples that used type finders with the :types_and_descendents
|
294
|
+
option unnecessarily. It is a very intensive computation! Note that I stubbed
|
295
|
+
out these calls using an aspect with around advise, a useful "development-time"
|
271
296
|
aspect. See Aquarium::TypeUtilsStub (in spec_example_types.rb) and how it's used
|
272
|
-
in pointcut_spec.rb. Using this technique and other optimizations, the time to
|
297
|
+
in pointcut_spec.rb. Using this technique and other optimizations, the time to
|
273
298
|
run the suite was reduced from ~5 minutes to about 1 minute.
|
274
|
-
|
275
|
-
#17565 fixes a "hole" in JoinPoint, where it doesn't confirm that a specified
|
276
|
-
type string, symbol or regex matches a class that exists and only one class. Now
|
299
|
+
|
300
|
+
#17565 fixes a "hole" in JoinPoint, where it doesn't confirm that a specified
|
301
|
+
type string, symbol or regex matches a class that exists and only one class. Now
|
277
302
|
it does and it stores the type, rather than the original "specification" for it.
|
278
303
|
|
279
304
|
== Version 0.3.0
|
280
305
|
|
281
|
-
V0.3.0 adds numerous improvements to the DSL, making aspect specification more
|
306
|
+
V0.3.0 adds numerous improvements to the DSL, making aspect specification more
|
282
307
|
intuitive and English-like. For example, where you previously wrote, e.g.,
|
283
308
|
|
284
309
|
around :methods => :all, :types => [Foo, Bar], :advice => advice_proc
|
285
310
|
after :attribute => name, :attribute_options => [:readers], :objects => [foo, bar] ...
|
286
|
-
|
311
|
+
|
287
312
|
Now you can write the same aspects as follows:
|
288
313
|
|
289
314
|
around :calls_to => :all_methods, :within_types => [Foo, Bar], :use_advice => advice_proc
|
290
315
|
after :reading => name, :on_objects => [foo, bar] ...
|
291
316
|
|
292
|
-
Other improvements include performance and robustness enhancements and
|
317
|
+
Other improvements include performance and robustness enhancements and
|
293
318
|
miscellaneous internal refactoring and DRY improvements.
|
294
319
|
|
295
320
|
Bug fixes:
|
@@ -300,23 +325,23 @@ Enhancements:
|
|
300
325
|
|
301
326
|
For #17154, the following changes were made:
|
302
327
|
Added :all_methods as a synonym for the :all special value.
|
303
|
-
Added :reading as a synonym for :attributes => ..., :attribute_options =>
|
328
|
+
Added :reading as a synonym for :attributes => ..., :attribute_options =>
|
304
329
|
[:readers]
|
305
|
-
Added :writing and :changing as synonyms for :attributes => ...,
|
330
|
+
Added :writing and :changing as synonyms for :attributes => ...,
|
306
331
|
:attribute_options => [:writers]
|
307
332
|
Added :accessing as a synonym for :attributes => ...
|
308
|
-
Added :calls_to, :calling, :invoking, :sending_message_to as synonyms for
|
333
|
+
Added :calls_to, :calling, :invoking, :sending_message_to as synonyms for
|
309
334
|
:methods.
|
310
|
-
Added :on_types, :in_types, :within_types and :for_types as synonyms for :types.
|
311
|
-
The same set of prefixes is supported for :type, :objects, :object, and the
|
335
|
+
Added :on_types, :in_types, :within_types and :for_types as synonyms for :types.
|
336
|
+
The same set of prefixes is supported for :type, :objects, :object, and the
|
312
337
|
various :exclude_*, :*_and_ancestors, and :*_and_descendents.
|
313
338
|
|
314
|
-
The full list of possible synonyms are shown in the spec examples. In
|
339
|
+
The full list of possible synonyms are shown in the spec examples. In
|
315
340
|
particular, see "pointcut_spec.rb".
|
316
341
|
|
317
342
|
== Version 0.2.0
|
318
343
|
|
319
|
-
V0.2.0 changes the parameter list used for advice blocks and adds numerous
|
344
|
+
V0.2.0 changes the parameter list used for advice blocks and adds numerous
|
320
345
|
enhancements, robustness improvements and more complete "spec'ing".
|
321
346
|
|
322
347
|
Bug fixes:
|
@@ -325,20 +350,20 @@ none
|
|
325
350
|
Enhancements:
|
326
351
|
13402 Support a subclass syntax like AspectJ's "Type+".
|
327
352
|
13984 More flexible argument list to the advise block.
|
328
|
-
14053 Remove JoinPoint#type, JoinPoint#type=, JoinPoint#object, and
|
353
|
+
14053 Remove JoinPoint#type, JoinPoint#type=, JoinPoint#object, and
|
329
354
|
JoinPoint#object=
|
330
355
|
14061 Add a control flow mechanism to skipping (sic) intermediate advice
|
331
356
|
15164 Deprecate ObjectFinder
|
332
357
|
15413 Remove ObjectFinder
|
333
358
|
15710 Eliminate redundant public methods in various "finders"
|
334
359
|
|
335
|
-
#13402 adds new invocation options to specify types and their descendents
|
336
|
-
(subclasses or modules that include the specified module(s)) and ancestors.
|
337
|
-
The latter should be used cautiously as it will include things like Kernel,
|
338
|
-
Object, and Class! I used new command options rather than the AspectJ "+"
|
339
|
-
suffix (and the proposed, but never implemented "-" suffix for ancestors),
|
340
|
-
because the "+" would be confusing with regular expressions and not in the
|
341
|
-
spirit of trying to make the pointcut language "easy to read". So, the
|
360
|
+
#13402 adds new invocation options to specify types and their descendents
|
361
|
+
(subclasses or modules that include the specified module(s)) and ancestors.
|
362
|
+
The latter should be used cautiously as it will include things like Kernel,
|
363
|
+
Object, and Class! I used new command options rather than the AspectJ "+"
|
364
|
+
suffix (and the proposed, but never implemented "-" suffix for ancestors),
|
365
|
+
because the "+" would be confusing with regular expressions and not in the
|
366
|
+
spirit of trying to make the pointcut language "easy to read". So, the
|
342
367
|
following are now available:
|
343
368
|
:type_and_ancestors
|
344
369
|
:types_and_ancestors
|
@@ -349,39 +374,39 @@ Enhancements:
|
|
349
374
|
:exclude_types_and_ancestors
|
350
375
|
:exclude_type_and_descendents
|
351
376
|
:exclude_types_and_descendents
|
352
|
-
If you want both the ancestors and descendents, just use both options with
|
377
|
+
If you want both the ancestors and descendents, just use both options with
|
353
378
|
the same value.
|
354
379
|
|
355
|
-
#13984 adds the object as the second argument to the advice block parameter
|
356
|
-
list. This change reflects the fact that the object is often needed, but
|
357
|
-
calling jp.context.advised_object is a bit tedious. THIS CHANGE BREAKS
|
358
|
-
BACKWARDS COMPATIBILITY!! An exception is raised if advice has the signature
|
380
|
+
#13984 adds the object as the second argument to the advice block parameter
|
381
|
+
list. This change reflects the fact that the object is often needed, but
|
382
|
+
calling jp.context.advised_object is a bit tedious. THIS CHANGE BREAKS
|
383
|
+
BACKWARDS COMPATIBILITY!! An exception is raised if advice has the signature
|
359
384
|
|jp, *args|.
|
360
385
|
|
361
|
-
#14061 adds a new method, JoinPoint#invoke_original_join_point, which will
|
362
|
-
invoke the original method without intermediate advice. If called within
|
363
|
-
around advice, you can write advice that vetoes all subsequent advice, yet
|
364
|
-
invokes the original method. Use this technique cautiously, however, since you
|
365
|
-
may not always know what other advices are involved and what side effects this
|
386
|
+
#14061 adds a new method, JoinPoint#invoke_original_join_point, which will
|
387
|
+
invoke the original method without intermediate advice. If called within
|
388
|
+
around advice, you can write advice that vetoes all subsequent advice, yet
|
389
|
+
invokes the original method. Use this technique cautiously, however, since you
|
390
|
+
may not always know what other advices are involved and what side effects this
|
366
391
|
control-flow change might cause.
|
367
392
|
|
368
|
-
#15164 and 15413 remove ObjectFinder because it is not used and it requires
|
369
|
-
ObjectSpace, which has high overhead and won't be enabled, by default, in
|
393
|
+
#15164 and 15413 remove ObjectFinder because it is not used and it requires
|
394
|
+
ObjectSpace, which has high overhead and won't be enabled, by default, in
|
370
395
|
JRuby (it will be optional).
|
371
396
|
|
372
|
-
#15710 removes redundant methods that were becoming a maintenance issue, in
|
373
|
-
particular, MethodFinder#find_all_by and TypeFinder#find_by_name. This is a
|
374
|
-
non-backwards-compatible API change.
|
397
|
+
#15710 removes redundant methods that were becoming a maintenance issue, in
|
398
|
+
particular, MethodFinder#find_all_by and TypeFinder#find_by_name. This is a
|
399
|
+
non-backwards-compatible API change.
|
375
400
|
|
376
|
-
Finally, note that I have not yet been able to resolve bug #15202, "Intermittent
|
377
|
-
confusion between classes and objects when invoking advice." I believe this is a
|
378
|
-
very rare occurrence and only likely to ever happen during the "torture-test" of
|
401
|
+
Finally, note that I have not yet been able to resolve bug #15202, "Intermittent
|
402
|
+
confusion between classes and objects when invoking advice." I believe this is a
|
403
|
+
very rare occurrence and only likely to ever happen during the "torture-test" of
|
379
404
|
running the RSpec suite. Please post a comment to Tracker if you encounter it!
|
380
405
|
|
381
406
|
== Version 0.1.8
|
382
407
|
|
383
|
-
V0.1.7 did not successfully "register" at rubyforge. This releases fixes that
|
384
|
-
problem and also adds several feature enhancements and refactorings. There are
|
408
|
+
V0.1.7 did not successfully "register" at rubyforge. This releases fixes that
|
409
|
+
problem and also adds several feature enhancements and refactorings. There are
|
385
410
|
no known upgrade issues.
|
386
411
|
|
387
412
|
Bug fixes:
|
@@ -391,14 +416,14 @@ Enhancements:
|
|
391
416
|
13399 Add :exclusion options for methods and types.
|
392
417
|
14707 :exclude_ancestor_methods as synonym for :suppress_ancestor_methods
|
393
418
|
|
394
|
-
13399 adds new :exclude_(pointcuts|join_points|types|objects|methods|attributes)
|
395
|
-
options for Aspect.new, and Pointcut.new that make it easier to specify a list
|
396
|
-
or regular expression for various "items" and then to exclude particular
|
397
|
-
items, e.g., Aspect.new :around, :types => /nterestingType/, :exclude_types =>
|
419
|
+
13399 adds new :exclude_(pointcuts|join_points|types|objects|methods|attributes)
|
420
|
+
options for Aspect.new, and Pointcut.new that make it easier to specify a list
|
421
|
+
or regular expression for various "items" and then to exclude particular
|
422
|
+
items, e.g., Aspect.new :around, :types => /nterestingType/, :exclude_types =>
|
398
423
|
UninterestingType ...
|
399
424
|
|
400
|
-
The :exclude_ancestor_methods option is now preferred over
|
401
|
-
:suppress_ancestor_methods, since the former is more consistent with the new
|
425
|
+
The :exclude_ancestor_methods option is now preferred over
|
426
|
+
:suppress_ancestor_methods, since the former is more consistent with the new
|
402
427
|
:exclude_* options.
|
403
428
|
|
404
429
|
== Version 0.1.7
|
@@ -407,43 +432,43 @@ Bug fixes:
|
|
407
432
|
14946 Advice fails when instrumenting methods containing special characters
|
408
433
|
15038 Spec for pointcut example variation #1
|
409
434
|
15039 Spec for pointcut example variation #2
|
410
|
-
15085 Specifying just :attributes for aspects also matches all methods, as if
|
435
|
+
15085 Specifying just :attributes for aspects also matches all methods, as if
|
411
436
|
:methods => :all specified
|
412
437
|
|
413
438
|
Enhancements:
|
414
439
|
13396 Unify internal handling of types vs. objects
|
415
440
|
|
416
|
-
15038 and 15039 were bugs in one of the examples (actually in the comments).
|
441
|
+
15038 and 15039 were bugs in one of the examples (actually in the comments).
|
417
442
|
However, experimenting with them also revealed the nasty 15085 bug!
|
418
443
|
|
419
|
-
I previously handled some special characters in method names, but not all the
|
420
|
-
possible ones, hence 14946. Aquarium should now properly handle any valid Ruby
|
444
|
+
I previously handled some special characters in method names, but not all the
|
445
|
+
possible ones, hence 14946. Aquarium should now properly handle any valid Ruby
|
421
446
|
method name.
|
422
447
|
|
423
448
|
== Version 0.1.6
|
424
449
|
|
425
450
|
Bug fixes:
|
426
|
-
14353 Advising subclass method that calls super raises exception when method
|
451
|
+
14353 Advising subclass method that calls super raises exception when method
|
427
452
|
executed
|
428
|
-
14356 Regexps for types must cover the whole name, which is inconsistent with
|
453
|
+
14356 Regexps for types must cover the whole name, which is inconsistent with
|
429
454
|
method/attribute regexps
|
430
455
|
14384 Design by Contract "extra" does not return correct value "invar" handling
|
431
456
|
13410 Fix funky navigation bar on website
|
432
457
|
|
433
|
-
14353 was kind of bad, but it's actually a Ruby bug with a good workaround. If
|
434
|
-
you advised a method that called "super", Ruby would use the wrong method name
|
458
|
+
14353 was kind of bad, but it's actually a Ruby bug with a good workaround. If
|
459
|
+
you advised a method that called "super", Ruby would use the wrong method name
|
435
460
|
to lookup the class in the parent. See the bug description for the details.
|
436
461
|
|
437
|
-
For 14356, type regular expressions now match on parts of names; they don't have
|
438
|
-
to match the whole name. The exception is regular expressions with module
|
439
|
-
separators "::". In this case, it seems to make more sense for the regular
|
440
|
-
expression to be interpreted as follows: If the expression is /A::B::C::D/,
|
441
|
-
then for the the outermost types, the expression behaves as /^.*A/, for the
|
442
|
-
types between two "::", the expressions behave as /^B$/ and /^C$/, and the
|
462
|
+
For 14356, type regular expressions now match on parts of names; they don't have
|
463
|
+
to match the whole name. The exception is regular expressions with module
|
464
|
+
separators "::". In this case, it seems to make more sense for the regular
|
465
|
+
expression to be interpreted as follows: If the expression is /A::B::C::D/,
|
466
|
+
then for the the outermost types, the expression behaves as /^.*A/, for the
|
467
|
+
types between two "::", the expressions behave as /^B$/ and /^C$/, and the
|
443
468
|
trailing expression behaves as /D.*$/.
|
444
469
|
|
445
|
-
14384 was an easy mistake to make with "around" advice; you have to remember to
|
446
|
-
return the result of the "join_point.proceed" call, unless you specifically
|
470
|
+
14384 was an easy mistake to make with "around" advice; you have to remember to
|
471
|
+
return the result of the "join_point.proceed" call, unless you specifically
|
447
472
|
want to change the returned value! Here are two ways to do it:
|
448
473
|
|
449
474
|
do_something_before(...)
|
@@ -452,7 +477,7 @@ For 14356, type regular expressions now match on parts of names; they don't have
|
|
452
477
|
return result
|
453
478
|
|
454
479
|
or
|
455
|
-
|
480
|
+
|
456
481
|
begin
|
457
482
|
do_something_before(...)
|
458
483
|
join_point.proceed
|
@@ -460,10 +485,10 @@ For 14356, type regular expressions now match on parts of names; they don't have
|
|
460
485
|
do_something_after(...)
|
461
486
|
end
|
462
487
|
|
463
|
-
The latter approach looks "asymmetrical" and it will behave differently if
|
464
|
-
"proceed" raises! However, it eliminates the temporary, if you find that
|
488
|
+
The latter approach looks "asymmetrical" and it will behave differently if
|
489
|
+
"proceed" raises! However, it eliminates the temporary, if you find that
|
465
490
|
desirable.
|
466
|
-
|
491
|
+
|
467
492
|
Enhancements:
|
468
493
|
13407 Pick a better method name for JoinPoint#type, which hides the Module#type
|
469
494
|
14385 Pointcut.new should accept a :join_point => jp argument
|
@@ -476,24 +501,24 @@ For 13407, new attribute methods have been added
|
|
476
501
|
* JoinPoint#target_object return the object that the join_point matches.
|
477
502
|
* JoinPoint#target_object= set the object that the join_point matches.
|
478
503
|
|
479
|
-
The following, older methods are now deprecated and will be removed in the 0.2.0
|
504
|
+
The following, older methods are now deprecated and will be removed in the 0.2.0
|
480
505
|
release (#14053):
|
481
506
|
* JoinPoint#type
|
482
507
|
* JoinPoint#type=
|
483
508
|
* JoinPoint#object
|
484
509
|
* JoinPoint#object=
|
485
510
|
|
486
|
-
JoinPoint#type method is deprecated because it hides Module#type, which returns
|
487
|
-
the type of the corresponding object. For "symmetry", the other three methods
|
488
|
-
are also now deprecated and they will be removed in a future release. Until
|
489
|
-
then, all will print a warning message to STDOUT. (If you really want the type
|
490
|
-
of what could be a JoinPoint object, you should use #class anyway, as
|
511
|
+
JoinPoint#type method is deprecated because it hides Module#type, which returns
|
512
|
+
the type of the corresponding object. For "symmetry", the other three methods
|
513
|
+
are also now deprecated and they will be removed in a future release. Until
|
514
|
+
then, all will print a warning message to STDOUT. (If you really want the type
|
515
|
+
of what could be a JoinPoint object, you should use #class anyway, as
|
491
516
|
Module#type is also deprecated!)
|
492
517
|
|
493
518
|
== Version 0.1.5
|
494
519
|
|
495
520
|
Bug fixes:
|
496
|
-
13514 Protected and private methods are made public when advised and left that
|
521
|
+
13514 Protected and private methods are made public when advised and left that
|
497
522
|
way when unadvised
|
498
523
|
13650 Loading Aquarium interferes with Rails filters
|
499
524
|
13864 Bug with negative object_id
|
@@ -502,23 +527,23 @@ Enhancements:
|
|
502
527
|
13392 Convert examples to specs.
|
503
528
|
13463 Support running in JRuby
|
504
529
|
|
505
|
-
Fixing 13650 required an API change, which is why I've tagged this release
|
506
|
-
"0.1.5" instead of something like "0.1.1" (and the changes don't seem big enough
|
530
|
+
Fixing 13650 required an API change, which is why I've tagged this release
|
531
|
+
"0.1.5" instead of something like "0.1.1" (and the changes don't seem big enough
|
507
532
|
to warrant "0.2.0"...).
|
508
533
|
|
509
|
-
Previously, requiring "aquarium.rb" in the top-level "lib" directory would
|
510
|
-
implicitly require lib/aquarium/dsl/aspect_dsl.rb, which has Object include the
|
511
|
-
AspectDSL module. This module adds methods like :before and :after to Object.
|
512
|
-
Unfortunately, those methods collide with methods of the same name that Rails
|
513
|
-
adds to Object. It was also a bit presumptuous of me to assume that everyone
|
534
|
+
Previously, requiring "aquarium.rb" in the top-level "lib" directory would
|
535
|
+
implicitly require lib/aquarium/dsl/aspect_dsl.rb, which has Object include the
|
536
|
+
AspectDSL module. This module adds methods like :before and :after to Object.
|
537
|
+
Unfortunately, those methods collide with methods of the same name that Rails
|
538
|
+
adds to Object. It was also a bit presumptuous of me to assume that everyone
|
514
539
|
wanted those methods on Object ;)
|
515
540
|
|
516
|
-
In this release, aspect_dsl.rb is still implicitly included and it still defines
|
517
|
-
the AspectDSL module. Now, however, it does not include the AspectDSL module in
|
518
|
-
Object. Instead, if you want this behavior for all types, you must require the
|
519
|
-
new lib/aquarium/aspects/dsl/object_dsl.rb explicitly.
|
541
|
+
In this release, aspect_dsl.rb is still implicitly included and it still defines
|
542
|
+
the AspectDSL module. Now, however, it does not include the AspectDSL module in
|
543
|
+
Object. Instead, if you want this behavior for all types, you must require the
|
544
|
+
new lib/aquarium/aspects/dsl/object_dsl.rb explicitly.
|
520
545
|
|
521
|
-
As an alternative, if you just want the AspectDSL module included selectively in
|
546
|
+
As an alternative, if you just want the AspectDSL module included selectively in
|
522
547
|
certain types, then do the following:
|
523
548
|
|
524
549
|
class MyClass # reopen "MyClass"
|
@@ -541,12 +566,12 @@ To add the methods as _instance_ methods on individual objects:
|
|
541
566
|
object.extend(Aquarium::DSL)
|
542
567
|
|
543
568
|
|
544
|
-
Note: as discussed at
|
545
|
-
http://practicalruby.blogspot.com/2007/02/reopen-with-moduleeval.html,
|
546
|
-
using "class_eval" or "module_eval" is safer that just reopening a class if
|
547
|
-
you're not sure that "MyClass" has actually been defined yet. However, in our
|
548
|
-
particular case, it probably doesn't matter, as AspectDSL doesn't change
|
549
|
-
anything about the type, like aliasing existing methods. Still, we can't
|
569
|
+
Note: as discussed at
|
570
|
+
http://practicalruby.blogspot.com/2007/02/reopen-with-moduleeval.html,
|
571
|
+
using "class_eval" or "module_eval" is safer that just reopening a class if
|
572
|
+
you're not sure that "MyClass" has actually been defined yet. However, in our
|
573
|
+
particular case, it probably doesn't matter, as AspectDSL doesn't change
|
574
|
+
anything about the type, like aliasing existing methods. Still, we can't
|
550
575
|
guarantee that this won't change in the future.
|
551
576
|
|
552
577
|
== Version 0.1.0
|