Class: Rctl::Ctl
- Inherits:
-
Object
- Object
- Rctl::Ctl
- Defined in:
- lib/rctl.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
Instance Method Summary collapse
-
#generate(command = :start, services = {}) ⇒ Object
launch command on selected services.
-
#initialize(options = {}) ⇒ Ctl
constructor
A new instance of Ctl.
Constructor Details
#initialize(options = {}) ⇒ Ctl
Returns a new instance of Ctl.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rctl.rb', line 8 def initialize( = {}) if([:config]) @commands = YAML.load_file([:config]) else if(!File.exists? "~/.rctl.rc.yml") @commands = YAML.load_file(Pathname(__FILE__) + '../rctl/default_config.yml') File.open(File.("~/.rctl.rc.yml"), 'w') do |file| YAML.dump(@commands, file) end else @commands = YAML.load_file("~/.rctl.rc.yml") end end @start_order = define_start_order end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
6 7 8 |
# File 'lib/rctl.rb', line 6 def commands @commands end |
Instance Method Details
#generate(command = :start, services = {}) ⇒ Object
launch command on selected services. return 0 if everything went ok.
26 27 28 |
# File 'lib/rctl.rb', line 26 def generate(command = :start, services = {}) generate_command(command, services) end |