Sample manifest:
$ cat examples/foo.rb
class Foo < ShadowPuppet::Manifest
recipe :demo, :text => 'foo'
recipe :some_gems
def some_gems
package 'rails', :ensure => :updated, :provider => :gem
package 'railsmachine', :ensure => '1.0.5', :provider => :gem, :require => package('capistrano')
package 'capistrano', :ensure => :updated, :provider => :gem
end
def demo(options = {})
exec 'sample', :command => "echo '#{options[:text]}' > /tmp/sample.txt"
file '/tmp/sample2.txt', :ensure => :present, :content => Facter.to_hash.inspect
end
end
Executing this manifest:
$ shadow_puppet examples/foo.rb notice: /shadow_puppet:19861340/Exec[foo]/returns: executed successfully $
The shadow_puppet binary parses the given ruby code, which is expected to contain a class named Foo that inherits from ShadowPuppet::Manifest. An instance of this class is created, and the execute method is called. All output is printed to the console.
Required files
- optparse
- rubygems
- shadow_puppet
- active_support/inflector
- active_support/core_ext/string/inflections
- fileutils