Sha256: 377c8e1d21401d0199de3dd8b9f61b2f6d64ae11e04c6b000d638eccc5d0a361

Contents?: true

Size: 1.01 KB

Versions: 20

Compression:

Stored size: 1.01 KB

Contents

module PoolParty
  
  class Script
    
    def self.inflate_file(file)
      inflate open(file).read if file
    end
        
    def self.inflate(script, file="__SCRIPT__")
      apool = new
      apool.instance_eval script, file
      apool.inflate
    end
    
    def inflate
      pools.map {|name,pool| pool.inflate } unless pools.empty?
    end
    
    def self.to_ruby(opts={},&blk)
      blk.to_ruby(opts)
    end
    
    def self.for_save_string
      returning Array.new do |out|
        pools.collect {|n,pl| pl}.each do |pl|
          out << "pool :#{pl.name} do"
          clouds.each do |n,cl|
            out << <<-EOE
  cloud :#{cl.name} do
    #{cl.minimum_runnable_options.map {|o| "#{o} #{cl.send(o).respec_string}"}.join("\n")}
  end
            EOE
          end
          out << "end"
        end
      end.join("\n")
    end
    
    def self.save!(to_file=true)
      write_to_file_in_storage_directory(Base.default_specfile_name, for_save_string) if to_file
      for_save_string
    end
    
  end
  
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
auser-poolparty-0.2.71 lib/poolparty/pool/script.rb
auser-poolparty-0.2.72 lib/poolparty/pool/script.rb
auser-poolparty-0.2.74 lib/poolparty/pool/script.rb
auser-poolparty-0.2.76 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.77 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.78 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.79 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.80 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.81 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.84 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.85 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.88 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.89 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.90 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.91 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.92 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.93 lib/poolparty/poolparty/script.rb
auser-poolparty-0.2.94 lib/poolparty/poolparty/script.rb
auser-poolparty-1.0.0 lib/poolparty/poolparty/script.rb
poolparty-0.2.84 lib/poolparty/poolparty/script.rb