Class: RemoteRun::Configuration
- Inherits:
-
Object
- Object
- RemoteRun::Configuration
- Defined in:
- lib/remote_run/configuration.rb
Defined Under Namespace
Classes: HostManager, TaskManager
Instance Attribute Summary collapse
-
#after_run ⇒ Object
Returns the value of attribute after_run.
-
#after_task ⇒ Object
Returns the value of attribute after_task.
-
#around_run ⇒ Object
Returns the value of attribute around_run.
-
#around_task ⇒ Object
Returns the value of attribute around_task.
-
#before_run ⇒ Object
Returns the value of attribute before_run.
-
#before_task ⇒ Object
Returns the value of attribute before_task.
-
#exclude ⇒ Object
Returns the value of attribute exclude.
-
#host_manager ⇒ Object
readonly
Returns the value of attribute host_manager.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#known_hosts ⇒ Object
Returns the value of attribute known_hosts.
-
#local_hostname ⇒ Object
readonly
Returns the value of attribute local_hostname.
-
#local_path ⇒ Object
Returns the value of attribute local_path.
-
#login_as ⇒ Object
Returns the value of attribute login_as.
-
#quiet ⇒ Object
Returns the value of attribute quiet.
-
#remote_path ⇒ Object
Returns the value of attribute remote_path.
-
#rsync_options ⇒ Object
Returns the value of attribute rsync_options.
-
#ssh_options ⇒ Object
Returns the value of attribute ssh_options.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#task_manager ⇒ Object
readonly
Returns the value of attribute task_manager.
-
#temp_path ⇒ Object
Returns the value of attribute temp_path.
Instance Method Summary collapse
- #hosts ⇒ Object
- #hosts=(hostnames) ⇒ Object
-
#initialize {|_self| ... } ⇒ Configuration
constructor
A new instance of Configuration.
- #run ⇒ Object
- #tasks ⇒ Object
- #tasks=(shell_commands) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Configuration
Returns a new instance of Configuration.
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 |
# File 'lib/remote_run/configuration.rb', line 8 def initialize @task_manager = TaskManager.new @host_manager = HostManager.new # used in the runner @identifier = `echo $RANDOM`.strip @local_hostname = `hostname`.strip @local_path = Dir.getwd @login_as = ENV["USER"] @remote_path = "/tmp/remote/#{local_hostname}" @exclude = [] @temp_path = "/tmp/remote" @quiet = false @start_time = Time.now @known_hosts = File.("#{ENV['HOME']}/.ssh/known_hosts") @ssh_options = "-o NoHostAuthenticationForLocalhost=yes -o UserKnownHostsFile=#{known_hosts} -o NumberOfPasswordPrompts=0 -o StrictHostKeyChecking=no -o ConnectTimeout=3 -4 " @rsync_options = "--delete --rsh='ssh #{}' --timeout=60 -a" @before_run = Proc.new{} @after_run = Proc.new{} @around_run = Proc.new {|&block| block.call } @before_task = Proc.new{} @after_task = Proc.new{} @around_task = Proc.new {|&block| block.call } $runner = self yield self if block_given? end |
Instance Attribute Details
#after_run ⇒ Object
Returns the value of attribute after_run.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def after_run @after_run end |
#after_task ⇒ Object
Returns the value of attribute after_task.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def after_task @after_task end |
#around_run ⇒ Object
Returns the value of attribute around_run.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def around_run @around_run end |
#around_task ⇒ Object
Returns the value of attribute around_task.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def around_task @around_task end |
#before_run ⇒ Object
Returns the value of attribute before_run.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def before_run @before_run end |
#before_task ⇒ Object
Returns the value of attribute before_task.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def before_task @before_task end |
#exclude ⇒ Object
Returns the value of attribute exclude.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def exclude @exclude end |
#host_manager ⇒ Object (readonly)
Returns the value of attribute host_manager.
6 7 8 |
# File 'lib/remote_run/configuration.rb', line 6 def host_manager @host_manager end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
5 6 7 |
# File 'lib/remote_run/configuration.rb', line 5 def identifier @identifier end |
#known_hosts ⇒ Object
Returns the value of attribute known_hosts.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def known_hosts @known_hosts end |
#local_hostname ⇒ Object (readonly)
Returns the value of attribute local_hostname.
5 6 7 |
# File 'lib/remote_run/configuration.rb', line 5 def local_hostname @local_hostname end |
#local_path ⇒ Object
Returns the value of attribute local_path.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def local_path @local_path end |
#login_as ⇒ Object
Returns the value of attribute login_as.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def login_as @login_as end |
#quiet ⇒ Object
Returns the value of attribute quiet.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def quiet @quiet end |
#remote_path ⇒ Object
Returns the value of attribute remote_path.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def remote_path @remote_path end |
#rsync_options ⇒ Object
Returns the value of attribute rsync_options.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def @rsync_options end |
#ssh_options ⇒ Object
Returns the value of attribute ssh_options.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def @ssh_options end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
5 6 7 |
# File 'lib/remote_run/configuration.rb', line 5 def start_time @start_time end |
#task_manager ⇒ Object (readonly)
Returns the value of attribute task_manager.
6 7 8 |
# File 'lib/remote_run/configuration.rb', line 6 def task_manager @task_manager end |
#temp_path ⇒ Object
Returns the value of attribute temp_path.
3 4 5 |
# File 'lib/remote_run/configuration.rb', line 3 def temp_path @temp_path end |
Instance Method Details
#hosts ⇒ Object
37 38 39 |
# File 'lib/remote_run/configuration.rb', line 37 def hosts @host_manager.hosts end |
#hosts=(hostnames) ⇒ Object
45 46 47 48 49 |
# File 'lib/remote_run/configuration.rb', line 45 def hosts=(hostnames) hostnames.each do |hostname| @host_manager.add(Host.new(hostname, self)) end end |
#run ⇒ Object
57 58 59 60 61 |
# File 'lib/remote_run/configuration.rb', line 57 def run @before_run.call(self) @around_run.call { Runner.new(self).run } @after_run.call(self) end |
#tasks ⇒ Object
41 42 43 |
# File 'lib/remote_run/configuration.rb', line 41 def tasks @task_manager.tasks end |