Class: CloudRunner::DigitalOcean::Cli::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud_runner/digital_ocean/cli/base.rb

Direct Known Subclasses

New, Over

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cloud_runner/digital_ocean/cli/base.rb', line 12

def initialize(opts={})
  @options = opts.clone.freeze

  raise "Client id must be specified" \
    unless @client_id = options[:client_id]

  raise "Api key must be specified" \
    unless @api_key = options[:api_key]

  raise "Script must be specified" \
    unless @script_path = options[:script]

  @script_path = File.realpath(@script_path)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/cloud_runner/digital_ocean/cli/base.rb', line 10

def options
  @options
end

Instance Method Details

#run_script(out, err) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/cloud_runner/digital_ocean/cli/base.rb', line 27

def run_script(out, err)
  @out, @err = out, err

  set_up
  execute_script
ensure
  clean_up
end