Sha256: 5620ad42bdceed064418af2f9a5a315c9d3af4755528bfeaedbd913282f67222

Contents?: true

Size: 1.58 KB

Versions: 28

Compression:

Stored size: 1.58 KB

Contents

=begin rdoc
== Script
  Execute a script using the specified interpreter. Includes actions/attributes available to Execute resources. Predefined available script interpreters are bash, csh, perl, python and ruby.

== Usage
  has_script "install_something" do
    interpreter "bash"
    user "root"
    cwd "/tmp"
    code <<-EOH 
wget http://www.example.com/tarball.tar.gz
tar -zxf tarball.tar.gz
cd tarball
./configure
make
make install
EOH
  end
  
== Options
* <tt>code</tt> Quoted script of code to execute.
* <tt>interpreter</tt> The interpreter to use to run the script
  
=end
module PoolParty
  module Resources
    
    class Script < Exec
            
      default_options(
        :code => nil,
        :interpreter => nil,
        # Exec
        :path => ["/usr/bin:/bin:/usr/local/bin:$PATH"],
        :command => nil,
        :creates => nil,
        :cwd => nil,
        :environment => nil,
        :group => nil,
        :returns => nil,
        :user => nil
      )
            
      def print_to_chef
str = 'script "<%= name %>" do
  code "<%= code %>"
'
      str << "  interpreter <%= print_variable(interpreter) %>\n" if interpreter
      str << "  creates <%= print_variable(creates) %>\n" if creates
      str << "  cwd <%= print_variable(cwd) %>\n" if cwd
      str << "  environment <%= print_variable(environment) %>\n" if environment
      str << "  group <%= print_variable(group) %>\n" if group
      str << "  returns <%= print_variable(returns) %>\n" if returns
      str << "  user <%= print_variable(user) %>\n" if user

      str << "end"
      end
      
    end
    
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.1 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.10 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.11 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.12 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.13 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.14 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.15 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.16 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.17 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.2 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.3 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.4 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.5 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.6 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.7 lib/dependency_resolvers/chef/resources/script.rb
auser-poolparty-1.3.8 lib/dependency_resolvers/chef/resources/script.rb
fairchild-poolparty-1.3.17 lib/dependency_resolvers/chef/resources/script.rb
fairchild-poolparty-1.3.5 lib/dependency_resolvers/chef/resources/script.rb
poolparty-1.3.15 lib/dependency_resolvers/chef/resources/script.rb