class Really::Task
Attributes
dependencies[RW]
name[R]
options[RW]
Public Class Methods
new(name, options = {}, &block)
click to toggle source
# File lib/really/task.rb, line 9 def initialize(name, options = {}, &block) @name = name @options = options @block = block @dependencies = [] @commands = [] dependencies = options[:depends_on] || [] @dependencies += [dependencies].flatten end
Public Instance Methods
commands()
click to toggle source
Internal public API
# File lib/really/task.rb, line 34 def commands instance_eval &@block if @block && @commands.empty? @commands end
eql?(task)
click to toggle source
# File lib/really/task.rb, line 20 def eql?(task) @name == task.name end
hash()
click to toggle source
# File lib/really/task.rb, line 24 def hash @name.hash end
to_s()
click to toggle source
# File lib/really/task.rb, line 28 def to_s "<#{self.class} #{@name}>" end
Protected Instance Methods
_add_command(command, options = {})
click to toggle source
Internal API for modules that add methods to Really::Task
# File lib/really/task.rb, line 43 def _add_command(command, options = {}) @commands << Command.new(command, options) end
_add_file_transfer(source_path, destination_path, options = {})
click to toggle source
# File lib/really/task.rb, line 47 def _add_file_transfer(source_path, destination_path, options = {}) filename = File.basename destination_path tmp_path = "/tmp/_really_#{filename}" @commands << FileTransferCommand.new(source_path, tmp_path, options) _add_command "mv '#{tmp_path}' '#{destination_path}'", options _add_command "chown #{'-R ' if options[:recursive]}#{options[:user]}:#{options[:user]} #{destination_path}", options if options[:user] _add_command "chmod #{'-R ' if options[:recursive]}#{options[:mode]} #{destination_path}", options if options[:mode] end