Class: Upstart::Exporter::ExpandedExporter

Inherits:
Object
  • Object
show all
Includes:
Errors, ExporterHelpers
Defined in:
lib/upstart-exporter/expanded_exporter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Errors

#error

Methods included from ExporterHelpers

#app_cmd, #app_name, #export_cmd_helper, #helper_cmd_conf, #upstart_cmd_conf

Constructor Details

#initialize(options) ⇒ ExpandedExporter

Returns a new instance of ExpandedExporter.



10
11
12
13
14
15
# File 'lib/upstart-exporter/expanded_exporter.rb', line 10

def initialize(options)
  @config = options[:commands]
  @options = options
  @commands = @config['commands']
  @env = @config['env'] || {}
end

Class Method Details

.export(options) ⇒ Object



6
7
8
# File 'lib/upstart-exporter/expanded_exporter.rb', line 6

def self.export(options)
  new(options).export
end

Instance Method Details

#exportObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/upstart-exporter/expanded_exporter.rb', line 17

def export
  @commands.each do |command, cmd_options|
    if count = cmd_options['count']
      count.times do |counter|
        export_cmd("#{command}_#{counter}", cmd_options)
      end
    else
      export_cmd(command, cmd_options)
    end
  end
end