<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8077,7 +8077,7 @@ maybe_utc
 write_event
 write_events1
 write_events
-install_prev
+install_pre
 '-wait_nodes/2-fun-0-'
 sync_nodes_optional
 get_sync_optional_nodes
@@ -8616,7 +8616,7 @@ log_terms
 '-table/2-lc$^0/1-0-'
 '-table/2-fun-9-'
 '-qlc_next/2-fun-0-'
-'-qlc_prev/2-fun-0-'
+'-qlc_pre/2-fun-0-'
 '-qlc_select/1-fun-0-'
 '-i/0-fun-0-'
 '-hform/6-lc$^0/1-0-'
@@ -8650,7 +8650,7 @@ default
 n_objects
 traverse
 qlc_select
-qlc_prev
+qlc_pre
 qlc_next
 is_unique_objects
 is_sorted_key
@@ -8661,7 +8661,7 @@ post_fun
 info_fun
 lookup_fun
 first_next
-last_prev
+last_pre
 tabfile_info
 cannot_create_table
 create_tab
@@ -11470,7 +11470,7 @@ safe_fixtable
 rename
 insert_new
 insert
-prev
+pre
 is_key
 member
 match_object</diff>
      <filename>lib/erlang/messenger/ebin/erl_crash.dump</filename>
    </modified>
    <modified>
      <diff>@@ -15,8 +15,8 @@ class Array
   def nice_runnable(quiet=true)
     self.flatten.reject{|e| (e.nil? || e.empty?) }.join(&quot; \n &quot;).chomp.nice_runnable(quiet)
   end
-  def to_string(prev=&quot;&quot;)
-    map {|a| a.to_string(prev)}.join(&quot;\n&quot;)
+  def to_string(pre=&quot;&quot;)
+    map {|a| a.to_string(pre)}.join(&quot;\n&quot;)
   end
   def get_named(str=&quot;&quot;)
     map {|a| a.name == str ? a : nil }.reject {|a| a.nil? }</diff>
      <filename>lib/poolparty/core/array.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,14 +12,28 @@ class Hash
     o.keys.each {|k| self.delete(k) }
     o
   end
+  def append(other_hash)
+    returning Hash.new do |h|
+      h.merge!(self)
+      other_hash.each do |k,v|
+        h[k] = has_key?(k) ? [self[k], v].flatten : v
+      end
+    end
+  end
+  def append!(other_hash)
+    other_hash.each do |k,v|
+      self[k] = has_key?(k) ? [self[k], v].flatten : v
+    end
+    self
+  end
   def safe_merge(other_hash)
     merge(other_hash.delete_if {|k,v| has_key?(k) })
   end
   def safe_merge!(other_hash)
     merge!(other_hash.delete_if {|k,v| has_key?(k) &amp;&amp; !v.nil? })
   end
-  def flush_out(prev=&quot;&quot;, post=&quot;&quot;)
-    map {|k,v| &quot;#{prev}#{k} =&gt; #{v.to_option_string}#{post}&quot;}
+  def flush_out(pre=&quot;&quot;, post=&quot;&quot;)
+    map {|k,v| &quot;#{pre}#{k} =&gt; #{v.to_option_string}#{post}&quot;}
   end
   def to_os
     m={}</diff>
      <filename>lib/poolparty/core/hash.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 class Symbol
-  def to_string(prev=&quot;&quot;)
-    &quot;#{prev}#{self.to_s}&quot;
+  def to_string(pre=&quot;&quot;)
+    &quot;#{pre}#{self.to_s}&quot;
   end
   def sanitize
     self.to_s.sanitize</diff>
      <filename>lib/poolparty/core/symbol.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,10 +7,10 @@ module PoolParty
           print v.pretty_print
         end
       else
-        prev = &quot;\t&quot;
+        pre = &quot;\t&quot;
         clouds.each do |name, cl|
-          puts cl.pretty_name(prev*2, cl)
-          puts cl.pretty_options(prev*2, cl) #cl.pretty_print(&quot;#{prev}\t&quot;)
+          puts cl.pretty_name(pre*2, cl)
+          puts cl.pretty_options(pre*2, cl) #cl.pretty_print(&quot;#{pre}\t&quot;)
         end
       end
 </diff>
      <filename>lib/poolparty/helpers/display.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,20 +1,20 @@
 module PoolParty
   module PrettyPrinter
     
-    def pretty_print(prev=&quot;\t&quot;)
+    def pretty_print(pre=&quot;\t&quot;)
       returning Array.new do |out|
-        out &lt;&lt; pretty_name(prev, self)
-        out &lt;&lt; pretty_options(prev, self)
+        out &lt;&lt; pretty_name(pre, self)
+        out &lt;&lt; pretty_options(pre, self)
         
         if self.respond_to?(:clouds)
           clouds.each do |name, cl|
-            out &lt;&lt; pretty_name(prev*2, cl)
-            out &lt;&lt; pretty_options(prev*2, cl) #cl.pretty_print(&quot;#{prev}\t&quot;)
+            out &lt;&lt; pretty_name(pre*2, cl)
+            out &lt;&lt; pretty_options(pre*2, cl) #cl.pretty_print(&quot;#{pre}\t&quot;)
           end
         end
         if self.respond_to?(:plugins)
-          out &lt;&lt; &quot;#{prev}\t\tPlugins&quot;
-          out &lt;&lt; &quot;#{prev}\t\t&quot; + plugins.map {|a| a}.join(&quot;\n&quot;)
+          out &lt;&lt; &quot;#{pre}\t\tPlugins&quot;
+          out &lt;&lt; &quot;#{pre}\t\t&quot; + plugins.map {|a| a}.join(&quot;\n&quot;)
         end
       end.join(&quot;\n&quot;)
     end
@@ -22,17 +22,17 @@ module PoolParty
     # Gather options on the object
     # Do not print if the option is nil or empty.
     # Also, don't show the option if the option is empty or the default option on the cloud    
-    def pretty_options(prev, o)
+    def pretty_options(pre, o)
       return &quot;&quot; unless o.respond_to?(:options)
       print_options = (o.respond_to?(:parent) &amp;&amp; o.parent &amp;&amp; o.parent.respond_to?(:options)) ? 
         (o.options.delete_if {|k,v| o.parent.options.has_key?(k) &amp;&amp; o.parent.options[k] == o.options[k] &amp;&amp; !o.options[k].nil? } ) : 
         o.options
       print_options = print_options.map {|k,v| [k, o.send(k.to_sym).to_s] }.inject({}) { |r,e| r[e[0]] = e[1] unless o.class.default_options[e[0]] == e[1] || e[1].nil? || e[1].empty?; r }
-      print_options.flush_out(&quot;#{prev}\t&quot;)
+      print_options.flush_out(&quot;#{pre}\t&quot;)
     end
     
-    def pretty_name(prev, o)
-      &quot;#{prev}#{o.class.to_s.top_level_class.capitalize}: #{o.name if o.respond_to?(:name)}&quot;
+    def pretty_name(pre, o)
+      &quot;#{pre}#{o.class.to_s.top_level_class.capitalize}: #{o.name if o.respond_to?(:name)}&quot;
     end
     
   end</diff>
      <filename>lib/poolparty/modules/pretty_printer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,13 +6,13 @@ module PoolParty
       options[:require]
     end
     def requires(str=&quot;&quot;)
-      options.merge!(:require =&gt; str)
+      options.append!(:require =&gt; str)
     end 
     def ensures(str=&quot;running&quot;)
       if %w(absent running).map {|a| self.send a.to_sym}.include?(str)
         str == &quot;absent&quot; ? is_absent : is_present
       else
-        options.merge!(:ensure =&gt; str)
+        options.append!(:ensure =&gt; str)
       end
       str
     end</diff>
      <filename>lib/poolparty/modules/resourcing_dsl.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,11 +22,11 @@ module PoolParty
     class CallFunction &lt; Resource
       def initialize(str=&quot;&quot;, opts={}, parent=self, &amp;block)
         @str = str
-        super(opts, parent, &amp;block)
+        # super(opts, parent, &amp;block)
       end
-      def to_string(prev=&quot;&quot;)
+      def to_string(pre=&quot;&quot;)
         returning Array.new do |arr|
-          arr &lt;&lt; &quot;#{prev}#{@str}&quot;
+          arr &lt;&lt; &quot;#{pre}#{@str}&quot;
         end.join(&quot;\n&quot;)
       end
     end
@@ -42,10 +42,10 @@ module PoolParty
         super(subclass)
       end
       
-      def to_string(prev=&quot;&quot;)
+      def to_string(pre=&quot;&quot;)
         returning Array.new do |output|
-          output &lt;&lt; &quot;#{prev} # Custom Functions\n&quot;
-          output &lt;&lt; self.class.custom_functions_to_string(prev)
+          output &lt;&lt; &quot;#{pre} # Custom Functions\n&quot;
+          output &lt;&lt; self.class.custom_functions_to_string(pre)
         end.join(&quot;\n&quot;)        
       end
     end</diff>
      <filename>lib/poolparty/pool/custom_resource.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,13 +17,13 @@ module PoolParty
       resources[type] ||= []
     end
     
-    def add_resource(type, opts={}, parent=self, &amp;block)
-      resource = get_resource(type, opts[:name])
+    def add_resource(type, opts={}, parent=self, &amp;block)      
+      resource = parent.get_resource(type, opts[:name])
       if resource
         return resource 
       else
         returning &quot;PoolParty::Resources::#{type.to_s.camelize}&quot;.classify.constantize.new(opts, parent, &amp;block) do |o|
-          resource(type) &lt;&lt; o
+          parent.resource(type) &lt;&lt; o
         end
       end
     end
@@ -37,7 +37,7 @@ module PoolParty
       @resources = nil
     end
         
-    def resources_string(prev=&quot;&quot;)
+    def resources_string(pre=&quot;&quot;)
       returning Array.new do |output|        
         output &lt;&lt; resources_string_from_resources(resources)
       end.join(&quot;\n&quot;)
@@ -53,7 +53,7 @@ module PoolParty
       include CloudResourcer
       include Configurable
       
-      extend PoolParty::Resources
+      # extend PoolParty::Resources
       include PoolParty::Resources
       
       def self.inherited(subclass)
@@ -90,12 +90,19 @@ module PoolParty
       # Finally, it uses the parent's options as the lowest priority
       def initialize(opts={}, parent=self, &amp;block)
         # Take the options of the parents
-        @parent = parent
+        set_resource_parent(parent)
         set_vars_from_options(opts) unless opts.empty?
         self.instance_eval &amp;block if block
         loaded(opts)
       end
       
+      def set_resource_parent(parent=nil)
+        if parent
+          @parent = parent
+          requires parent.to_s if parent.is_a?(PoolParty::Resources::Resource) &amp;&amp; parent != self
+        end        
+      end
+      
       # Stub, so you can create virtual resources
       # This is called after the resource is initialized
       # with the options given to it in the init-block
@@ -123,11 +130,11 @@ module PoolParty
         self.class.custom_functions &lt;&lt; str
       end
       
-      def self.custom_functions_to_string(prev=&quot;&quot;)
+      def self.custom_functions_to_string(pre=&quot;&quot;)
         returning Array.new do |output|
           PoolParty::Resources.available_custom_resources.each do |resource|
             resource.custom_functions.each do |func|
-              output &lt;&lt; &quot;#{prev*2}#{func}&quot;
+              output &lt;&lt; &quot;#{pre*2}#{func}&quot;
             end
           end
         end.join(&quot;\n&quot;)
@@ -163,7 +170,7 @@ module PoolParty
       
       # Generic to_s
       # Most Resources won't need to extend this
-      def to_string(prev=&quot;&quot;)
+      def to_string(pre=&quot;&quot;)
         opts = get_modified_options
         returning Array.new do |output|
           unless cancelled?
@@ -176,10 +183,10 @@ module PoolParty
             end
           
             unless virtual_resource?
-              output &lt;&lt; &quot;#{prev}#{class_type_name} {&quot;
-              output &lt;&lt; &quot;#{prev}\&quot;#{self.key}\&quot;:&quot;
-              output &lt;&lt; opts.flush_out(&quot;#{prev*2}&quot;).join(&quot;,\n&quot;)
-              output &lt;&lt; &quot;#{prev}}&quot;            
+              output &lt;&lt; &quot;#{pre}#{class_type_name} {&quot;
+              output &lt;&lt; &quot;#{pre}\&quot;#{self.key}\&quot;:&quot;
+              output &lt;&lt; opts.flush_out(&quot;#{pre*2}&quot;).join(&quot;,\n&quot;)
+              output &lt;&lt; &quot;#{pre}}&quot;            
             end
           
             output &lt;&lt; @poststring || &quot;&quot;</diff>
      <filename>lib/poolparty/pool/resource.rb</filename>
    </modified>
    <modified>
      <diff>@@ -43,19 +43,19 @@ module PoolParty
 
     end
     
-    def resources_string_from_resources(resources, prev=&quot;\t&quot;)
+    def resources_string_from_resources(resources, pre=&quot;\t&quot;)
       @variables = resources.extract! {|name,resource| name == :variable}
       returning Array.new do |str|
         unless @variables.empty?
           str &lt;&lt; &quot;\n# Variables \n&quot;
           @variables.each do |name, variable|
-            str &lt;&lt; variable.to_string(&quot;#{prev}&quot;)
+            str &lt;&lt; variable.to_string(&quot;#{pre}&quot;)
           end          
         end
         
         resources.each do |type, resource|
-          str &lt;&lt; &quot;\n#{prev*2}# #{type}\n&quot;
-          str &lt;&lt; resource.to_string(&quot;#{prev*2}&quot;)
+          str &lt;&lt; &quot;\n#{pre*2}# #{type}\n&quot;
+          str &lt;&lt; resource.to_string(&quot;#{pre*2}&quot;)
         end        
       end.join(&quot;\n&quot;)
     end</diff>
      <filename>lib/poolparty/pool/resources/class_package.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,7 +25,7 @@ module PoolParty
         true
       end
       
-      def to_string(prev=&quot;&quot;)
+      def to_string(pre=&quot;&quot;)
         returning Array.new do |output|
           output &lt;&lt; &quot;# #{name.sanitize}&quot;
           output &lt;&lt; &quot;case #{attribute} {&quot;</diff>
      <filename>lib/poolparty/pool/resources/conditional.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ module PoolParty
         :value =&gt; &quot;&quot;
       })
       
-      def to_string(prev=&quot;\t&quot;)
+      def to_string(pre=&quot;\t&quot;)
         &quot;$#{name} = #{value_string}&quot;
       end
       </diff>
      <filename>lib/poolparty/pool/resources/variable.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1363,7 +1363,7 @@ class Installer
 
   def install_dir_conf(rel)
     # FIXME: should not remove current config files
-    # (rename previous file to .old/.org)
+    # (rename preious file to .old/.org)
     install_files targetfiles(), &quot;#{config('sysconfdir')}/#{rel}&quot;, 0644
   end
 
@@ -1542,12 +1542,12 @@ class Installer
 
     dir = File.basename(rel)
     Dir.mkdir dir unless File.dir?(dir)
-    prevdir = Dir.pwd
+    predir = Dir.pwd
     Dir.chdir dir
     $stderr.puts '---&gt; ' + rel if verbose?
     @currdir = rel
     yield
-    Dir.chdir prevdir
+    Dir.chdir predir
     $stderr.puts '&lt;--- ' + rel if verbose?
     @currdir = File.dirname(rel)
   end</diff>
      <filename>setup.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,7 +30,7 @@ describe &quot;Hash&quot; do
   it &quot;should be able to flush out into a string into an array&quot; do
     @a.flush_out.should == [&quot;a =&gt; '10'&quot;,&quot;b =&gt; '20'&quot;,&quot;c =&gt; '30'&quot;]
   end
-  it &quot;should be able to flush out with prev and posts&quot; do
+  it &quot;should be able to flush out with pre and posts&quot; do
     @a.flush_out(&quot;hi&quot;, &quot;ho&quot;).should == [&quot;hia =&gt; '10'ho&quot;,&quot;hib =&gt; '20'ho&quot;,&quot;hic =&gt; '30'ho&quot;]
   end
   describe &quot;select&quot; do
@@ -60,4 +60,22 @@ describe &quot;Hash&quot; do
       }.should_not raise_error
     end
   end
+  describe &quot;append&quot; do
+    before(:each) do
+      @hash = {:game =&gt; &quot;token&quot;, :required =&gt; &quot;for_play&quot;}
+    end
+    it &quot;should not destroy an option salready on the hash&quot; do
+      @hash.append(:required =&gt; &quot;to_play&quot;)[:game].should == &quot;token&quot;
+    end
+    it &quot;should change the entry to an array if it already exists&quot; do
+      @hash.append(:game =&gt; &quot;coin&quot;)[:game].class.should == Array
+    end
+    it &quot;should append the other hash's key to the end of the array&quot; do
+      @hash.append(:game =&gt; &quot;coin&quot;)[:game][-1].should == &quot;coin&quot;
+    end
+    it &quot;should change the hash with the append(bang) option&quot; do
+      @hash.append!(:game =&gt; &quot;coin&quot;)
+      @hash[:game][-1].should == &quot;coin&quot;
+    end
+  end
 end
\ No newline at end of file</diff>
      <filename>spec/poolparty/core/hash_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -80,11 +80,11 @@ describe &quot;Custom Resource&quot; do
         end
         it &quot;should create a new CallFunction instance when calling call_function with a string&quot; do
           PoolParty::Resources::CallFunction.should_receive(:new).and_return &quot;bunk&quot;
-          add_resource(:call_function, &quot;line&quot;)
+          add_resource(:call_function, :name =&gt; &quot;line&quot;)
         end
         it &quot;should create a call function in the function call array&quot; do
-          add_resource(:call_function, @cloud, &quot;heyyohey&quot;)
-          resource(:call_function).size.should == 1
+          add_resource(:call_function, {:name =&gt; &quot;custom_function&quot;}, @cloud)
+          @cloud.resource(:call_function).size.should == 1
         end
         describe &quot;defining&quot; do
           it &quot;should add the methods to the class through module_eval&quot; do</diff>
      <filename>spec/poolparty/pool/custom_resource_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -131,6 +131,13 @@ describe &quot;Resource&quot; do
     include PoolParty::Resources
     before(:each) do
       reset_resources!
+      @cloud = cloud :command_cloud do; end
+    end
+    it &quot;should call add_resource when creating using the command: file&quot; do
+      @cloud.should_receive(:add_resource).with(:file, {:name =&gt; &quot;frank&quot;}, @cloud)
+      @cloud.instance_eval do
+        file(:name =&gt; &quot;frank&quot;)
+      end
     end
     it &quot;should create the new 'resource' as a resource&quot; do
       resource(:file).class.should == Array
@@ -220,6 +227,29 @@ describe &quot;Resource&quot; do
         @file.parent.tangerine.should == &quot;orange&quot;
       end
     end
+    describe &quot;appending to resource&quot; do
+      before(:each) do
+        @cloud1 = cloud :apples do
+          directory(:name =&gt; &quot;/var/www&quot;) do
+            file(:name =&gt; &quot;/var/www/file.html&quot;)
+          end
+        end        
+        @dir = @cloud1.get_resource(:directory, &quot;/var/www&quot;)
+        @file = @dir.get_resource(:file, &quot;/var/www/file.html&quot;)
+      end
+      it &quot;should say there is 1 resource because the lower-level resources should be contained on the parenting resource&quot; do
+        @cloud1.resources.size.should == 1
+      end
+      it &quot;should say there is one resource on the outer resource&quot; do
+        @dir.resources.size.should == 1
+      end
+      it &quot;should contain the file as a resource&quot; do
+        @dir.resource(:file)[0].to_s.should == @file.to_s
+      end
+      it &quot;should set the parent as the parenting resource&quot; do
+        @file.parent.to_s.should == @dir.to_s
+      end
+    end
     describe &quot;fetching&quot; do
       before(:each) do
         @file = file(:name =&gt; &quot;pancakes&quot;)
@@ -228,7 +258,7 @@ describe &quot;Resource&quot; do
         PoolParty::Resources::File.should_not_receive(:new)
         file(:name =&gt; &quot;pancakes&quot;)
       end
-      it &quot;should return the file previously created&quot; do
+      it &quot;should return the file preiously created&quot; do
         get_resource(:file, &quot;pancakes&quot;).should == @file
       end
       it &quot;should be able to use the helper to grab the file&quot; do</diff>
      <filename>spec/poolparty/pool/resource_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f50be85554986fe9043fb031ecbad8447be8d171</id>
    </parent>
  </parents>
  <author>
    <name>Ari Lerner</name>
    <email>ari.lerner@citrusbyte.com</email>
  </author>
  <url>http://github.com/auser/poolparty/commit/a9661ff27d74c774629fb399e3559e1a2141f713</url>
  <id>a9661ff27d74c774629fb399e3559e1a2141f713</id>
  <committed-date>2008-10-19T15:47:21-07:00</committed-date>
  <authored-date>2008-10-19T15:47:21-07:00</authored-date>
  <message>Updating resourcing DSL</message>
  <tree>fd16d0a9e13b3cc5b5f9b9e86933c81e778f1ccb</tree>
  <committer>
    <name>Ari Lerner</name>
    <email>ari.lerner@citrusbyte.com</email>
  </committer>
</commit>
