inversion 0.11.0 → 0.11.1

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,10 +1,29 @@
1
+ 2012-09-12 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * README.rdoc, Rakefile, Tags.rdoc, lib/inversion/template.rb,
4
+ lib/inversion/template/tag.rb, lib/inversion/tilt.rb:
5
+ Integrated the manual with regular API docs
6
+ [4c3cde09af11] [apidocs.patch, qbase, qtip, tip]
7
+
1
8
  2012-07-06 Michael Granger <ged@FaerieMUD.org>
2
9
 
10
+ * .hgtags:
11
+ Added tag v0.11.0 for changeset 8e7ee4f29874
12
+ [71c2a12d9df0] [qparent]
13
+
14
+ * .hgsigs:
15
+ Added signature for changeset 92d48ef3085e
16
+ [8e7ee4f29874] [v0.11.0]
17
+
18
+ * History.rdoc, lib/inversion.rb:
19
+ Bump the minor version, update history.
20
+ [92d48ef3085e]
21
+
3
22
  * lib/inversion/renderstate.rb, lib/inversion/template.rb,
4
23
  spec/inversion/renderstate_spec.rb:
5
24
  Transcode output according to the :encoding option if set on a
6
25
  template
7
- [2202c6ed520b] [tip]
26
+ [2202c6ed520b]
8
27
 
9
28
  * lib/inversion/mixins.rb:
10
29
  Don't try to deep copy Encoding objects, either
@@ -64,7 +83,7 @@
64
83
 
65
84
  * .rvm.gems:
66
85
  Bumping Loggability dependency for inheritance bugfix
67
- [b65ce51ca6ee]
86
+ [b65ce51ca6ee] [github/master]
68
87
 
69
88
  2012-05-10 Michael Granger <ged@FaerieMUD.org>
70
89
 
data/History.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ == v0.11.1 [2012-09-17] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - [bugfix] Make subscriptions get nodes that were already published
4
+
5
+
1
6
  == v0.11.0 [2012-07-06] Michael Granger <ged@FaerieMUD.org>
2
7
 
3
8
  - Automatically transcode output according to the registered encoding
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.11.0'
28
+ VERSION = '0.11.1'
29
29
 
30
30
  # Version-control revision constant
31
- REVISION = %q$Revision: 92d48ef3085e $
31
+ REVISION = %q$Revision: cca3daa4a649 $
32
32
 
33
33
 
34
34
  ### Get the Inversion version.
@@ -100,8 +100,10 @@ class Inversion::RenderState
100
100
  @destinations = [ @output ]
101
101
  @tag_data = [ {} ]
102
102
 
103
- # Hash of subscribed Nodes, keyed by the subscription key as a Symbol
104
- @subscriptions = Hash.new {|hsh, k| hsh[k] = [] } # Auto-vivify
103
+ # Hash of subscribed Nodes and published data, keyed by the subscription key
104
+ # as a Symbol
105
+ @subscriptions = Hash.new {|hsh, k| hsh[k] = [] } # Auto-vivify to an Array
106
+ @published_nodes = Hash.new {|hsh, k| hsh[k] = [] }
105
107
 
106
108
  end
107
109
 
@@ -122,6 +124,9 @@ class Inversion::RenderState
122
124
  # Subscribe placeholders for publish/subscribe
123
125
  attr_reader :subscriptions
124
126
 
127
+ # Published nodes, keyed by subscription
128
+ attr_reader :published_nodes
129
+
125
130
  # The stack of rendered output destinations, most-recent last.
126
131
  attr_reader :destinations
127
132
 
@@ -313,6 +318,7 @@ class Inversion::RenderState
313
318
  # [ nodes.length, subscriber, subscriber.class ]
314
319
  subscriber.publish( *nodes )
315
320
  end
321
+ self.published_nodes[ key ].concat( nodes )
316
322
  end
317
323
  alias_method :publish_nodes, :publish
318
324
 
@@ -320,7 +326,14 @@ class Inversion::RenderState
320
326
  ### Subscribe the given +node+ to nodes published with the specified +key+.
321
327
  def subscribe( key, node )
322
328
  key = key.to_sym
329
+ self.log.debug "Adding subscription to %p nodes for %p" % [ key, node ]
323
330
  self.subscriptions[ key ] << node
331
+ # self.log.debug " now have subscriptions for: %p" % [ self.subscriptions.keys ]
332
+ if self.published_nodes.key?( key )
333
+ self.log.debug " re-publishing %d %p nodes to late subscriber" %
334
+ [ self.published_nodes[key].length, key ]
335
+ node.publish( *self.published_nodes[key] )
336
+ end
324
337
  end
325
338
 
326
339
 
@@ -54,9 +54,12 @@ class Inversion::Template::PublishTag < Inversion::Template::Tag
54
54
  self.log.debug "Publishing %d nodes as %s" % [ self.subnodes.length, self.key ]
55
55
  rendered_nodes = []
56
56
  renderstate.with_destination( rendered_nodes ) do
57
- self.render_subnodes( renderstate )
57
+ sn = self.render_subnodes( renderstate )
58
+ self.log.debug " subnodes are: %p" % [ sn ]
59
+ sn
58
60
  end
59
61
 
62
+ self.log.debug " rendered nodes are: %p" % [ rendered_nodes ]
60
63
  renderstate.publish( self.key, *rendered_nodes ) unless rendered_nodes.empty?
61
64
 
62
65
  return nil
@@ -41,7 +41,7 @@ describe Inversion::Template::PublishTag do
41
41
  it "raises a parse error if the body isn't a simple attribute" do
42
42
  expect {
43
43
  Inversion::Template::PublishTag.new( 'a.non-identifier' )
44
- }.should raise_exception( Inversion::ParseError, /malformed key/i )
44
+ }.to raise_exception( Inversion::ParseError, /malformed key/i )
45
45
  end
46
46
 
47
47
 
@@ -30,7 +30,7 @@ describe Inversion::Template::SubscribeTag do
30
30
  it "raises a parse error if the key isn't a simple attribute" do
31
31
  expect {
32
32
  Inversion::Template::SubscribeTag.new( 'a.non-identifier' )
33
- }.should raise_exception( Inversion::ParseError, /malformed subscribe/i )
33
+ }.to raise_exception( Inversion::ParseError, /malformed subscribe/i )
34
34
  end
35
35
 
36
36
  it "renders the nodes published by an immediate subtemplate with the same key" do
@@ -42,6 +42,15 @@ describe Inversion::Template::SubscribeTag do
42
42
  template.render.should == '--a style--(subtemplate)'
43
43
  end
44
44
 
45
+ it "renders nodes published by an immediate subtemplate that's rendered before it" do
46
+ template = Inversion::Template.new( '--<?attr subtemplate ?>--<?subscribe stylesheets ?>' )
47
+ subtemplate = Inversion::Template.new( '<?publish stylesheets ?>a style<?end?>(subtemplate)' )
48
+
49
+ template.subtemplate = subtemplate
50
+
51
+ template.render.should == '--(subtemplate)--a style'
52
+ end
53
+
45
54
  it "doesn't render anything if there are no publications with its key" do
46
55
  template = Inversion::Template.new( '--<?subscribe nostylesheets ?>--<?attr subtemplate ?>' )
47
56
  subtemplate = Inversion::Template.new( '<?publish stylesheets ?>a style<?end?>(subtemplate)' )
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.11.0
4
+ version: 0.11.1
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-07-06 00:00:00.000000000 Z
40
+ date: 2012-09-17 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: loggability
metadata.gz.sig CHANGED
Binary file