Class: Upstart::Exporter

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

Defined Under Namespace

Modules: Errors, Options Classes: Error, Templates

Constant Summary

VERSION =
"0.1.0"

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from Errors

#error

Constructor Details

- (Exporter) initialize(command_line_args)

A new instance of Exporter



13
14
15
16
17
18
# File 'lib/upstart-exporter.rb', line 13

def initialize(command_line_args)
  global_options = Options::Global.new
  command_line_options = Options::CommandLine.new(command_line_args)
  @options = global_options.merge(command_line_options)
  ensure_dirs
end

Instance Attribute Details

- (Object) options (readonly)

Returns the value of attribute options



11
12
13
# File 'lib/upstart-exporter.rb', line 11

def options
  @options
end

Instance Method Details

- (Object) clear



28
29
30
31
32
33
34
35
36
# File 'lib/upstart-exporter.rb', line 28

def clear
  FileUtils.rm(upstart_conf) if FileTest.file?(upstart_conf)
  Dir[upstart_cmd_conf('*')].each do |f|
    FileUtils.rm(f)
  end
  Dir[helper_cmd_conf('*')].each do |f|
    FileUtils.rm(f)
  end
end

- (Object) export



20
21
22
23
24
25
26
# File 'lib/upstart-exporter.rb', line 20

def export
  clear
  export_app
  options[:commands].each do |cmd_name, cmd|
    export_command(cmd_name, cmd)
  end
end