Module: Chloe

Defined in:
lib/chloe.rb,
lib/chloe/cli.rb,
lib/chloe/task.rb,
lib/chloe/tasks.rb,
lib/chloe/modules.rb,
lib/chloe/version.rb,
lib/chloe/executable.rb,
lib/chloe/modules/service.rb,
lib/chloe/modules/vagrant.rb,
lib/chloe/tasks/initialize.rb

Defined Under Namespace

Modules: Modules, Tasks Classes: CLI, Executable, Task

Constant Summary collapse

VERSION =
'0.0.4'

Class Method Summary collapse

Class Method Details

.bootstrap(name) ⇒ Object



16
17
18
19
20
# File 'lib/chloe.rb', line 16

def bootstrap(name)
  executable = define_executable(name)
  require_tasks(executable)
  executable.start
end

.define_executable(name) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/chloe.rb', line 30

def define_executable(name)
  module_eval <<-EVAL
    module ::#{name}
      module CLI
        class Executable < ::Chloe::Executable
        end
      end
    end
  EVAL
  "::#{name}::CLI::Executable".constantize
end

.include(task) ⇒ Object



22
23
24
# File 'lib/chloe.rb', line 22

def include(task)
  modules << task
end

.modulesObject



26
27
28
# File 'lib/chloe.rb', line 26

def modules
  @modules ||= []
end

.require_tasks(executable) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/chloe.rb', line 42

def require_tasks(executable)
  modules.each do |mod|
    "::Chloe::Modules::#{mod}".constantize.bootstrap(executable)
  end
  Dir.glob('./.chloe/**/*.rb') do |file|
    require file
  end
end