summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-05-30 03:08:16 +0000
committerLuke Kanies <luke@madstop.com>2005-05-30 03:08:16 +0000
commitd42efbeb2b2772d8286756a2aedb40604a1b7f11 (patch)
tree3dd8f283a6c85e52256bd50d0ee9d3df146557a8 /lib
parent0ab9685383bc21d9903a06d62a01f6cb72d25610 (diff)
downloadpuppet-d42efbeb2b2772d8286756a2aedb40604a1b7f11.tar.gz
puppet-d42efbeb2b2772d8286756a2aedb40604a1b7f11.tar.xz
puppet-d42efbeb2b2772d8286756a2aedb40604a1b7f11.zip
done some more work on making components act like normal objects, but now i need to figure out how to spread events up the tree, rather than just point to point
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@284 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/blink/statechange.rb4
-rw-r--r--lib/blink/transaction.rb1
-rw-r--r--lib/blink/transportable.rb2
-rw-r--r--lib/blink/type.rb1
-rw-r--r--lib/blink/type/component.rb13
-rw-r--r--lib/blink/type/service.rb9
-rw-r--r--lib/blink/type/state.rb4
7 files changed, 21 insertions, 13 deletions
diff --git a/lib/blink/statechange.rb b/lib/blink/statechange.rb
index e5d27cc58..066f4b7b9 100644
--- a/lib/blink/statechange.rb
+++ b/lib/blink/statechange.rb
@@ -25,7 +25,7 @@ module Blink
#---------------------------------------------------------------
def go
if @state.noop
- Blink.notice "%s is noop" % @state
+ #Blink.notice "%s is noop" % @state
return nil
end
@@ -67,7 +67,7 @@ module Blink
#---------------------------------------------------------------
def forward
- Blink.notice "moving change forward"
+ #Blink.notice "moving change forward"
unless defined? @transaction
raise "StateChange '%s' tried to be executed outside of transaction" %
diff --git a/lib/blink/transaction.rb b/lib/blink/transaction.rb
index 7bf0c8557..56d1268b5 100644
--- a/lib/blink/transaction.rb
+++ b/lib/blink/transaction.rb
@@ -74,6 +74,7 @@ class Transaction
# now we have the entire list of objects to notify
else
+ Blink.notice "I'm not top-level"
# these are the objects that need to be refreshed
#return @refresh.uniq
end
diff --git a/lib/blink/transportable.rb b/lib/blink/transportable.rb
index 0834d6c9b..d7ca9d5e3 100644
--- a/lib/blink/transportable.rb
+++ b/lib/blink/transportable.rb
@@ -101,7 +101,7 @@ module Blink
#------------------------------------------------------------
# just a linear container for objects
class TransBucket < Array
- attr_accessor :name
+ attr_accessor :name, :type
def to_type
# this container will contain the equivalent of all objects at
diff --git a/lib/blink/type.rb b/lib/blink/type.rb
index 4f43921d3..57b9e0f3f 100644
--- a/lib/blink/type.rb
+++ b/lib/blink/type.rb
@@ -402,6 +402,7 @@ class Blink::Type < Blink::Element
self.send(("meta" + mname.id2name),value)
elsif stateklass = self.class.validstate(mname)
if value.is_a?(Blink::State)
+ Blink.debug "'%s' got handed a state for '%s'" % [self,mname]
@states[mname] = value
else
if @states.include?(mname)
diff --git a/lib/blink/type/component.rb b/lib/blink/type/component.rb
index c0e13e0ac..d675474f6 100644
--- a/lib/blink/type/component.rb
+++ b/lib/blink/type/component.rb
@@ -10,17 +10,22 @@ require 'blink/type'
require 'blink/transaction'
module Blink
- class Component < Blink::Element
+ class Component < Blink::Type
include Enumerable
@name = :container
+ @namevar = :name
+
+ @states = []
+ @parameters = [:name]
def each
@children.each { |child| yield child }
end
- def initialize
+ def initialize(*args)
@children = []
+ super
end
# now we decide whether a transaction is dumb, and just accepts
@@ -47,5 +52,9 @@ module Blink
child.retrieve
}
end
+
+ def to_s
+ return "component(%s)" % self.name
+ end
end
end
diff --git a/lib/blink/type/service.rb b/lib/blink/type/service.rb
index dbae98d9c..a4c822fc8 100644
--- a/lib/blink/type/service.rb
+++ b/lib/blink/type/service.rb
@@ -16,14 +16,11 @@ module Blink
# this whole thing is annoying
# i should probably just be using booleans, but for now, i'm not...
def should=(should)
- if should == false
+ case should
+ when false,0,"0":
should = 0
- elsif should == true
+ when true,1,"1":
should = 1
- elsif should == "1" or should == 1
- should = 1
- elsif should == "0" or should == 0
- should = 0
else
Blink.warning "%s: interpreting '%s' as false" %
[self.class,should]
diff --git a/lib/blink/type/state.rb b/lib/blink/type/state.rb
index 5b32ccd68..7bc0dfdd7 100644
--- a/lib/blink/type/state.rb
+++ b/lib/blink/type/state.rb
@@ -74,7 +74,7 @@ class Blink::State < Blink::Element
@is = nil
if should.length > 0 # we got passed an argument
- @should = should.shift
+ self.should = should.shift
else # we got passed no argument
# leave @should undefined
end
@@ -124,7 +124,7 @@ class Blink::State < Blink::Element
#---------------------------------------------------------------
def to_s
- return @parent.name.to_s + " -> " + self.name.to_s
+ return "%s(%s)" % [@parent.name,self.name]
end
#---------------------------------------------------------------
end