Sha256: 0c543153686334f4b78e40cb99a70933e643e4cc25bf69c6a9da7e98da13e997

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

module Sprinkle
  module Actors
    class Vlad
      require 'vlad'
      attr_accessor :loaded_recipes

      def initialize(&block)
        self.instance_eval &block if block
      end

      def script(name)
        @loaded_recipes ||= []
        self.load name
        @loaded_recipes << script
      end

      def process(name, commands, roles, suppress_and_return_failures = false)
        commands = commands.join ' && ' if commands.is_a? Array
        t = remote_task(task_sym(name), :roles => roles) { run commands }
        
        begin
          t.invoke
          return true
        rescue ::Vlad::CommandFailedError => e
          return false if suppress_and_return_failures
          
          # Reraise error if we're not suppressing it
          raise
        end
      end

      private

        def task_sym(name)
          "install_#{name.to_task_name}".to_sym
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
auser-sprinkle-0.1.5 lib/sprinkle/actors/vlad.rb