inversion 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,8 +1,56 @@
1
+ 2012-06-27 Mahlon E. Smith <mahlon@martini.nu>
2
+
3
+ * lib/inversion/mixins.rb, lib/inversion/template.rb,
4
+ spec/inversion/mixins_spec.rb:
5
+ Add Modules/Classes to the immediate object list when deep copying.
6
+ Don't needlessly deep_copy the node tree on template duplication.
7
+ [fb0ab0db2042] [tip]
8
+
9
+ 2012-06-22 Michael Granger <ged@FaerieMUD.org>
10
+
11
+ * .rvm.gems, Rakefile:
12
+ Update dependencies.
13
+ [bf49edf3b889]
14
+
15
+ * .hgtags:
16
+ Added tag v0.10.1 for changeset 16d06faa003e
17
+ [f45915b72d58]
18
+
19
+ * .hgsigs:
20
+ Added signature for changeset 432abb56d593
21
+ [16d06faa003e] [v0.10.1]
22
+
23
+ * History.rdoc, lib/inversion.rb:
24
+ Bump patch version, update history.
25
+ [432abb56d593]
26
+
27
+ * lib/inversion/mixins.rb, lib/inversion/renderstate.rb,
28
+ lib/inversion/template.rb, spec/inversion/template_spec.rb:
29
+ Fix attribute changes being shared between duplicated templates.
30
+
31
+ - Pull up deep_copy function into a mixin
32
+ - Use deep_copy in a copy constructor on Inversion::Template to make
33
+ internal datastructures distinct, including @attributes.
34
+ - Also clean up some old cruft with the way the Parser is used.
35
+ [8350fbf49ef2]
36
+
37
+ 2012-05-18 Michael Granger <ged@FaerieMUD.org>
38
+
39
+ * .rvm.gems:
40
+ Bumping Loggability dependency for inheritance bugfix
41
+ [b65ce51ca6ee]
42
+
43
+ 2012-05-10 Michael Granger <ged@FaerieMUD.org>
44
+
45
+ * .rvm.gems, Rakefile:
46
+ Bump Loggability dependency to 0.2.
47
+ [7e3c047cbfba]
48
+
1
49
  2012-05-07 Michael Granger <ged@FaerieMUD.org>
2
50
 
3
51
  * .hgtags:
4
52
  Added tag v0.10.0 for changeset 64cf302354aa
5
- [79bc44fab294] [tip]
53
+ [79bc44fab294]
6
54
 
7
55
  * .hgsigs:
8
56
  Added signature for changeset 9d9c49d532be
@@ -35,7 +83,7 @@
35
83
 
36
84
  * .hgtags:
37
85
  Added tag v0.9.0 for changeset 27f082ef7985
38
- [dd18f3255985] [github/master]
86
+ [dd18f3255985]
39
87
 
40
88
  * .hgsigs:
41
89
  Added signature for changeset b208fa9154b1
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ == v0.10.2 [2012-06-27] Mahlon E. Smith <mahlon@martini.nu>
2
+
3
+ - Bugfix: Don't dup Classes and Modules in template attributes.
4
+ - Optimization: Don't needlessly duplicate the node tree on template
5
+ duplication.
6
+
7
+
1
8
  == v0.10.1 [2012-06-22] Michael Granger <ged@FaerieMUD.org>
2
9
 
3
10
  - Bugfix: duplicated templates get distinct copies of their attributes.
data/Rakefile CHANGED
@@ -20,20 +20,19 @@ hoespec = Hoe.spec 'inversion' do
20
20
  self.developer 'Michael Granger', 'ged@FaerieMUD.org'
21
21
  self.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
22
22
 
23
- self.dependency 'loggability', '~> 0.2'
23
+ self.dependency 'loggability', '~> 0.4'
24
24
 
25
+ self.dependency 'highline', '~> 1.6', :development
26
+ self.dependency 'hoe-deveiate', '~> 0.1', :development
27
+ self.dependency 'hoe-manualgen', '~> 0.3', :development
28
+ self.dependency 'rack-test', '~> 0.6', :development
25
29
  self.dependency 'rdoc', '~> 3.12', :development
26
- self.dependency 'rspec', '~> 2.8', :development
30
+ self.dependency 'rspec', '~> 2.10', :development
31
+ self.dependency 'simplecov', '~> 0.6', :development
32
+ self.dependency 'sinatra', '~> 1.3', :development
27
33
  self.dependency 'tilt', '~> 1.3', :development
28
- self.dependency 'sinatra', '~> 1.2', :development
29
- self.dependency 'rack-test', '~> 0.6', :development
30
- self.dependency 'simplecov', '~> 0.4', :development
31
- self.dependency 'hoe-manualgen', '~> 0.2', :development
32
-
33
- # bin/inversion deps
34
- self.dependency 'trollop', '~> 1.16', :development
35
- self.dependency 'highline', '~> 1.6', :development
36
34
  self.dependency 'sysexits', '~> 1.0', :development
35
+ self.dependency 'trollop', '~> 1.16', :development
37
36
 
38
37
  self.spec_extras[:licenses] = ["BSD"]
39
38
  self.spec_extras[:rdoc_options] = ['-f', 'fivefish', '-t', 'Inversion Templates']
data/lib/inversion.rb CHANGED
@@ -25,10 +25,10 @@ module Inversion
25
25
  warn ">>> Inversion requires Ruby 1.9.2 or later. <<<" if RUBY_VERSION < '1.9.2'
26
26
 
27
27
  # Library version constant
28
- VERSION = '0.10.1'
28
+ VERSION = '0.10.2'
29
29
 
30
30
  # Version-control revision constant
31
- REVISION = %q$Revision: 432abb56d593 $
31
+ REVISION = %q$Revision: 7236fd2ac3fb $
32
32
 
33
33
 
34
34
  ### Get the Inversion version.
@@ -200,6 +200,10 @@ module Inversion
200
200
  # A collection of data-manipulation functions.
201
201
  module DataUtilities
202
202
 
203
+ ###############
204
+ module_function
205
+ ###############
206
+
203
207
  ### Recursively copy the specified +obj+ and return the result.
204
208
  def deep_copy( obj )
205
209
  # self.log.debug "Deep copying: %p" % [ obj ]
@@ -208,7 +212,7 @@ module Inversion
208
212
  return obj if obj.class.name == 'RSpec::Mocks::Mock'
209
213
 
210
214
  return case obj
211
- when NilClass, Numeric, TrueClass, FalseClass, Symbol
215
+ when NilClass, Numeric, TrueClass, FalseClass, Symbol, Module
212
216
  obj
213
217
 
214
218
  when Array
@@ -216,6 +220,7 @@ module Inversion
216
220
 
217
221
  when Hash
218
222
  newhash = {}
223
+ newhash.default_proc = obj.default_proc if obj.default_proc
219
224
  obj.each do |k,v|
220
225
  newhash[ deep_copy(k) ] = deep_copy( v )
221
226
  end
@@ -157,7 +157,6 @@ class Inversion::Template
157
157
  ### Copy constructor -- make copies of some internal data structures, too.
158
158
  def initialize_copy( other )
159
159
  @options = deep_copy( other.options )
160
- @node_tree = deep_copy( other.node_tree )
161
160
  @attributes = deep_copy( other.attributes )
162
161
  end
163
162
 
@@ -139,5 +139,120 @@ describe Inversion, "mixins" do
139
139
  end
140
140
  end
141
141
 
142
+
143
+ describe Inversion::DataUtilities do
144
+
145
+ it "doesn't try to dup immediate objects" do
146
+ Inversion::DataUtilities.deep_copy( nil ).should be( nil )
147
+ Inversion::DataUtilities.deep_copy( 112 ).should be( 112 )
148
+ Inversion::DataUtilities.deep_copy( true ).should be( true )
149
+ Inversion::DataUtilities.deep_copy( false ).should be( false )
150
+ Inversion::DataUtilities.deep_copy( :a_symbol ).should be( :a_symbol )
151
+ end
152
+
153
+ it "doesn't try to dup modules/classes" do
154
+ klass = Class.new
155
+ Inversion::DataUtilities.deep_copy( klass ).should be( klass )
156
+ end
157
+
158
+ it "makes distinct copies of arrays and their members" do
159
+ original = [ 'foom', Set.new([ 1,2 ]), :a_symbol ]
160
+
161
+ copy = Inversion::DataUtilities.deep_copy( original )
162
+
163
+ copy.should == original
164
+ copy.should_not be( original )
165
+ copy[0].should == original[0]
166
+ copy[0].should_not be( original[0] )
167
+ copy[1].should == original[1]
168
+ copy[1].should_not be( original[1] )
169
+ copy[2].should == original[2]
170
+ copy[2].should be( original[2] ) # Immediate
171
+ end
172
+
173
+ it "makes recursive copies of deeply-nested Arrays" do
174
+ original = [ 1, [ 2, 3, [4], 5], 6, [7, [8, 9], 0] ]
175
+
176
+ copy = Inversion::DataUtilities.deep_copy( original )
177
+
178
+ copy.should == original
179
+ copy.should_not be( original )
180
+ copy[1].should_not be( original[1] )
181
+ copy[1][2].should_not be( original[1][2] )
182
+ copy[3].should_not be( original[3] )
183
+ copy[3][1].should_not be( original[3][1] )
184
+ end
185
+
186
+ it "makes distinct copies of Hashes and their members" do
187
+ original = {
188
+ :a => 1,
189
+ 'b' => 2,
190
+ 3 => 'c',
191
+ }
192
+
193
+ copy = Inversion::DataUtilities.deep_copy( original )
194
+
195
+ copy.should == original
196
+ copy.should_not be( original )
197
+ copy[:a].should == 1
198
+ copy.key( 2 ).should == 'b'
199
+ copy.key( 2 ).should_not be( original.key(2) )
200
+ copy[3].should == 'c'
201
+ copy[3].should_not be( original[3] )
202
+ end
203
+
204
+ it "makes distinct copies of deeply-nested Hashes" do
205
+ original = {
206
+ :a => {
207
+ :b => {
208
+ :c => 'd',
209
+ :e => 'f',
210
+ },
211
+ :g => 'h',
212
+ },
213
+ :i => 'j',
214
+ }
215
+
216
+ copy = Inversion::DataUtilities.deep_copy( original )
217
+
218
+ copy.should == original
219
+ copy[:a][:b][:c].should == 'd'
220
+ copy[:a][:b][:c].should_not be( original[:a][:b][:c] )
221
+ copy[:a][:b][:e].should == 'f'
222
+ copy[:a][:b][:e].should_not be( original[:a][:b][:e] )
223
+ copy[:a][:g].should == 'h'
224
+ copy[:a][:g].should_not be( original[:a][:g] )
225
+ copy[:i].should == 'j'
226
+ copy[:i].should_not be( original[:i] )
227
+ end
228
+
229
+ it "copies the default proc of copied Hashes" do
230
+ original = Hash.new {|h,k| h[ k ] = Set.new }
231
+
232
+ copy = Inversion::DataUtilities.deep_copy( original )
233
+
234
+ copy.default_proc.should == original.default_proc
235
+ end
236
+
237
+ it "preserves taintedness of copied objects" do
238
+ original = Object.new
239
+ original.taint
240
+
241
+ copy = Inversion::DataUtilities.deep_copy( original )
242
+
243
+ copy.should_not be( original )
244
+ copy.should be_tainted()
245
+ end
246
+
247
+ it "preserves frozen-ness of copied objects" do
248
+ original = Object.new
249
+ original.freeze
250
+
251
+ copy = Inversion::DataUtilities.deep_copy( original )
252
+
253
+ copy.should_not be( original )
254
+ copy.should be_frozen()
255
+ end
256
+ end
142
257
  end
143
258
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inversion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -37,7 +37,7 @@ cert_chain:
37
37
  YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
38
38
  Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
39
39
  cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
40
- date: 2012-06-22 00:00:00.000000000 Z
40
+ date: 2012-06-27 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: loggability
@@ -46,7 +46,7 @@ dependencies:
46
46
  requirements:
47
47
  - - ~>
48
48
  - !ruby/object:Gem::Version
49
- version: '0.2'
49
+ version: '0.4'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
@@ -54,7 +54,7 @@ dependencies:
54
54
  requirements:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
- version: '0.2'
57
+ version: '0.4'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hoe-mercurial
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -120,13 +120,13 @@ dependencies:
120
120
  - !ruby/object:Gem::Version
121
121
  version: '3.10'
122
122
  - !ruby/object:Gem::Dependency
123
- name: rspec
123
+ name: highline
124
124
  requirement: !ruby/object:Gem::Requirement
125
125
  none: false
126
126
  requirements:
127
127
  - - ~>
128
128
  - !ruby/object:Gem::Version
129
- version: '2.8'
129
+ version: '1.6'
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
@@ -134,15 +134,15 @@ dependencies:
134
134
  requirements:
135
135
  - - ~>
136
136
  - !ruby/object:Gem::Version
137
- version: '2.8'
137
+ version: '1.6'
138
138
  - !ruby/object:Gem::Dependency
139
- name: tilt
139
+ name: hoe-deveiate
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
143
143
  - - ~>
144
144
  - !ruby/object:Gem::Version
145
- version: '1.3'
145
+ version: '0.1'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
@@ -150,15 +150,15 @@ dependencies:
150
150
  requirements:
151
151
  - - ~>
152
152
  - !ruby/object:Gem::Version
153
- version: '1.3'
153
+ version: '0.1'
154
154
  - !ruby/object:Gem::Dependency
155
- name: sinatra
155
+ name: rack-test
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  none: false
158
158
  requirements:
159
159
  - - ~>
160
160
  - !ruby/object:Gem::Version
161
- version: '1.2'
161
+ version: '0.6'
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
@@ -166,15 +166,15 @@ dependencies:
166
166
  requirements:
167
167
  - - ~>
168
168
  - !ruby/object:Gem::Version
169
- version: '1.2'
169
+ version: '0.6'
170
170
  - !ruby/object:Gem::Dependency
171
- name: rack-test
171
+ name: rspec
172
172
  requirement: !ruby/object:Gem::Requirement
173
173
  none: false
174
174
  requirements:
175
175
  - - ~>
176
176
  - !ruby/object:Gem::Version
177
- version: '0.6'
177
+ version: '2.10'
178
178
  type: :development
179
179
  prerelease: false
180
180
  version_requirements: !ruby/object:Gem::Requirement
@@ -182,7 +182,7 @@ dependencies:
182
182
  requirements:
183
183
  - - ~>
184
184
  - !ruby/object:Gem::Version
185
- version: '0.6'
185
+ version: '2.10'
186
186
  - !ruby/object:Gem::Dependency
187
187
  name: simplecov
188
188
  requirement: !ruby/object:Gem::Requirement
@@ -190,7 +190,7 @@ dependencies:
190
190
  requirements:
191
191
  - - ~>
192
192
  - !ruby/object:Gem::Version
193
- version: '0.4'
193
+ version: '0.6'
194
194
  type: :development
195
195
  prerelease: false
196
196
  version_requirements: !ruby/object:Gem::Requirement
@@ -198,15 +198,15 @@ dependencies:
198
198
  requirements:
199
199
  - - ~>
200
200
  - !ruby/object:Gem::Version
201
- version: '0.4'
201
+ version: '0.6'
202
202
  - !ruby/object:Gem::Dependency
203
- name: trollop
203
+ name: sinatra
204
204
  requirement: !ruby/object:Gem::Requirement
205
205
  none: false
206
206
  requirements:
207
207
  - - ~>
208
208
  - !ruby/object:Gem::Version
209
- version: '1.16'
209
+ version: '1.3'
210
210
  type: :development
211
211
  prerelease: false
212
212
  version_requirements: !ruby/object:Gem::Requirement
@@ -214,15 +214,15 @@ dependencies:
214
214
  requirements:
215
215
  - - ~>
216
216
  - !ruby/object:Gem::Version
217
- version: '1.16'
217
+ version: '1.3'
218
218
  - !ruby/object:Gem::Dependency
219
- name: highline
219
+ name: tilt
220
220
  requirement: !ruby/object:Gem::Requirement
221
221
  none: false
222
222
  requirements:
223
223
  - - ~>
224
224
  - !ruby/object:Gem::Version
225
- version: '1.6'
225
+ version: '1.3'
226
226
  type: :development
227
227
  prerelease: false
228
228
  version_requirements: !ruby/object:Gem::Requirement
@@ -230,7 +230,7 @@ dependencies:
230
230
  requirements:
231
231
  - - ~>
232
232
  - !ruby/object:Gem::Version
233
- version: '1.6'
233
+ version: '1.3'
234
234
  - !ruby/object:Gem::Dependency
235
235
  name: sysexits
236
236
  requirement: !ruby/object:Gem::Requirement
@@ -247,6 +247,22 @@ dependencies:
247
247
  - - ~>
248
248
  - !ruby/object:Gem::Version
249
249
  version: '1.0'
250
+ - !ruby/object:Gem::Dependency
251
+ name: trollop
252
+ requirement: !ruby/object:Gem::Requirement
253
+ none: false
254
+ requirements:
255
+ - - ~>
256
+ - !ruby/object:Gem::Version
257
+ version: '1.16'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ none: false
262
+ requirements:
263
+ - - ~>
264
+ - !ruby/object:Gem::Version
265
+ version: '1.16'
250
266
  - !ruby/object:Gem::Dependency
251
267
  name: hoe
252
268
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file