public
Description: Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails, or Sinatra stack on a brand new slice directly after its been created
Homepage: http://github.com/crafterm/sprinkle
Clone URL: git://github.com/crafterm/sprinkle.git
Click here to lend your support to: sprinkle and make a donation at www.pledgie.com !
sprinkle / lib / sprinkle / actors / local.rb
100644 38 lines (34 sloc) 1.109 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module Sprinkle
  module Actors
    # = Local Delivery Method
    #
    # This actor implementation performs any given commands on your local system, as
    # opposed to other implementations that generally run commands on a remote system
    # via the network.
    #
    # This is useful if you'd like to use Sprinkle to provision your local machine.
    # To enable this actor, in your Sprinkle script specify the :local delivery mechanism.
    #
    # deployment do
    # delivery :local
    # end
    #
    # Note, your local machine will be assumed to be a member of all roles when applying policies
    #
    class Local
      
      def process(name, commands, roles, suppress_and_return_failures = false) #:nodoc:
        commands.each do |command|
          system command
          return false if $?.to_i != 0
        end
        return true
      end
      
def transfer(name, source, destination, roles, recursive = true, suppress_and_return_failures = false)
if recursive
flags = "-R "
end
 
system "cp #{flags}#{source} #{destination}"
end
    end
  end
end