Top Level Namespace

Defined Under Namespace

Modules: Rake, Vlad Classes: String

Instance Method Summary collapse

Instance Method Details

#host(host_name, *roles) ⇒ Object

Declare a remote host and its roles. Equivalent to role, but shorter for multiple roles.



37
38
39
# File 'lib/rake_remote_task.rb', line 37

def host host_name, *roles
  Rake::RemoteTask.host host_name, *roles
end

#nowObject

used by update, out here so we can ensure all threads have the same value



5
6
7
# File 'lib/vlad/core.rb', line 5

def now
  @now ||= Time.now.utc.strftime("%Y%m%d%H%M.%S")
end

#remote_task(name, options = {}, &b) ⇒ Object

Declare a Vlad task that will execute on all hosts by default. To limit that task to specific roles, use:

remote_task :example, :roles => [:app, :web] do


46
47
48
# File 'lib/rake_remote_task.rb', line 46

def remote_task name, options = {}, &b
  Rake::RemoteTask.remote_task name, options, &b
end

#role(role_name, host, args = {}) ⇒ Object

Declare a role and assign a remote host to it. Equivalent to the host method; provided for capistrano compatibility.



53
54
55
# File 'lib/rake_remote_task.rb', line 53

def role role_name, host, args = {}
  Rake::RemoteTask.role role_name, host, args
end

#rsync(local, remote) ⇒ Object

rsync the given files to target_host.



65
66
67
# File 'lib/rake_remote_task.rb', line 65

def rsync local, remote
  Thread.current[:task].rsync local, remote
end

#run(*args, &b) ⇒ Object

Execute the given command on the target_host for the current task.



60
61
62
# File 'lib/rake_remote_task.rb', line 60

def run *args, &b
  Thread.current[:task].run(*args, &b)
end

#set(name, val = nil, &b) ⇒ Object

Declare a variable called name and assign it a value. A globally-visible method with the name of the variable is defined. If a block is given, it will be called when the variable is first accessed. Subsequent references to the variable will always return the same value. Raises ArgumentError if the name would conflict with an existing method.



75
76
77
# File 'lib/rake_remote_task.rb', line 75

def set name, val = nil, &b
  Rake::RemoteTask.set name, val, &b
end

#target_hostObject

Returns the name of the host that the current task is executing on. target_host can uniquely identify a particular task/host combination.



82
83
84
# File 'lib/rake_remote_task.rb', line 82

def target_host
  Thread.current[:task].target_host
end