lib/poolparty/base.rb in poolparty-1.3.4 vs lib/poolparty/base.rb in poolparty-1.3.6
- old
+ new
@@ -35,10 +35,11 @@
# - self
# - instance_eval block
# - stack
def run_in_context(o={}, &block)
proc = Proc.new do
+ set_vars_from_options(:name => o[:name]) if o.has_key?(:name) # Name MUST be set first
set_vars_from_options(o)
instance_eval &block if block
end
super(&proc)
end
@@ -125,25 +126,25 @@
# Add all the resources in order and their resources as well
# and then create the graph from the rest of the resources
# to create edges on the graph
def resources_graph(force=false)
return @resources_graph if @resources_graph && !force
- result = Digraph.new
+ result = Digraph.new
- add_ordered_resources_to_result(resources, result)
-
create_graph(resources, nil, result)
+ add_ordered_resources_to_result(resources, result)
+
@resources_graph = result
end
# Add all the resources as edges of each other
def add_ordered_resources_to_result(resources, result)
arr_of_resources = resources.zip_offset(1)
arr_of_resources.each do |first, second|
- result.add_edge!(first, second)
+ result.add_edge!(first, second) unless result.edge?(first, second) or result.edge?(second, first)
add_ordered_resources_to_result(first.resources, result)
end
end
# Create the graph of resources. Blow up if a resource isn't found
@@ -198,12 +199,12 @@
resources_graph.write_to_graphic_file(fmt, dotfile, p)
end
# The clouds.rb file
def clouds_dot_rb_file(n=nil); self.class.clouds_dot_rb_file(n); end
- def self.clouds_dot_rb_file(n=nil)
- Pool.clouds_dot_rb_file(n)
- end
+ def self.clouds_dot_rb_file(n=nil);Pool.clouds_dot_rb_file(n);end
+ def clouds_dot_rb_dir(n=nil); self.class.clouds_dot_rb_dir(n);end
+ def self.clouds_dot_rb_dir(n=nil); Pool.clouds_dot_rb_dir(n);end
# If the method is missing from ourself, check the Default
# class for the corresponding method.
# If the Default class has the method, inquire from the Default
# class, otherwise, call super
\ No newline at end of file