Class: Hocho::Runner
- Inherits:
-
Object
- Object
- Hocho::Runner
- Defined in:
- lib/hocho/runner.rb
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
readonly
Returns the value of attribute base_dir.
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#initializers ⇒ Object
readonly
Returns the value of attribute initializers.
Instance Method Summary collapse
-
#initialize(host, driver: nil, check_ssh_port: false, base_dir: '.', initializers: [], driver_options: {}) ⇒ Runner
constructor
A new instance of Runner.
- #run(dry_run: false) ⇒ Object
-
#ssh ⇒ Object
def check_ssh_port return unless @check_ssh_port end.
Constructor Details
#initialize(host, driver: nil, check_ssh_port: false, base_dir: '.', initializers: [], driver_options: {}) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/hocho/runner.rb', line 5 def initialize(host, driver: nil, check_ssh_port: false, base_dir: '.', initializers: [], driver_options: {}) @host = host @driver = driver && driver.to_sym @check_ssh_port = check_ssh_port @base_dir = base_dir @initializers = initializers @driver_options = @bundler_support = nil end |
Instance Attribute Details
#base_dir ⇒ Object (readonly)
Returns the value of attribute base_dir.
16 17 18 |
# File 'lib/hocho/runner.rb', line 16 def base_dir @base_dir end |
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
16 17 18 |
# File 'lib/hocho/runner.rb', line 16 def driver @driver end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
16 17 18 |
# File 'lib/hocho/runner.rb', line 16 def host @host end |
#initializers ⇒ Object (readonly)
Returns the value of attribute initializers.
16 17 18 |
# File 'lib/hocho/runner.rb', line 16 def initializers @initializers end |
Instance Method Details
#run(dry_run: false) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/hocho/runner.rb', line 18 def run(dry_run: false) puts "=> Running on #{host.name} using #{best_driver_name}" = @driver_options[best_driver_name] || {} driver = best_driver.new(host, base_dir: base_dir, initializers: initializers, **) driver.run(dry_run: dry_run) ensure driver.finalize if driver end |
#ssh ⇒ Object
def check_ssh_port
return unless @check_ssh_port
end
31 32 33 |
# File 'lib/hocho/runner.rb', line 31 def ssh host.ssh_connection end |