Class: Messed::Tasks::Runner

Inherits:
Thor
  • Object
show all
Defined in:
lib/messed/tasks/runner.rb

Instance Method Summary collapse

Instance Method Details

#allObject



39
40
41
42
43
44
45
46
# File 'lib/messed/tasks/runner.rb', line 39

def all
  Messed::Booter.new($root, :detach => options.detach?, :environment => options.environment) do |booter|
    booter.configuration.interfaces.names.each do |name|
      booter.interface_for(name.to_sym).start
    end
    booter.application.start
  end
end

#application(cmd) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/messed/tasks/runner.rb', line 24

def application(cmd)
  case cmd
  when 'start'
    Messed::Booter.new($root, :detach => options.detach?, :environment => options.environment) do |booter|
      application = booter.application
      application.start
    end
  when 'stop'
    Messed::Booter.new($root, :environment => options.environment).application.stop
  end
end

#interface(name, cmd) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/messed/tasks/runner.rb', line 8

def interface(name, cmd)
  case cmd
  when 'start'
    Messed::Booter.new($root, :detach => options.detach?, :environment => options.environment) do |booter|
      interface = booter.interface_for(name.to_sym)
      raise("unable to find an interface with name the `#{name}'") unless interface
      interface.start
    end
  when 'stop'
    Messed::Booter.new($root, :environment => options.environment).interface_for(name.to_sym).stop
  end
end