Class: Cch::Setup

Inherits:
Object
  • Object
show all
Defined in:
lib/cch/setup.rb

Constant Summary collapse

ATTRIBUTES =
[:watcher_commands, :runners]

Class Method Summary collapse

Class Method Details

.add_runner(runner, options = {}) {|@runners.fetch(runner)| ... } ⇒ Object

Yields:

  • (@runners.fetch(runner))


20
21
22
23
24
# File 'lib/cch/setup.rb', line 20

def add_runner(runner, options = {})
  @runners ||= {}
  @runners[runner] = Runner.new(runner, options)
  yield @runners.fetch(runner) if block_given?
end

.configureObject



7
8
9
10
11
12
13
14
# File 'lib/cch/setup.rb', line 7

def configure
  require 'cch/config/watchers'
  require 'cch/config/runners'

  load_setup
  Cch.logger.debug("setup\n#{inspect}")
  self
end

.inspectObject



16
17
18
# File 'lib/cch/setup.rb', line 16

def inspect
  ATTRIBUTES.map { |f| "     #{f} = #{send(f)}" }.join("\n")
end

.run(runners) ⇒ Object



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

def run(runners)
  Array(runners).each { |runner| @runners.fetch(runner).on = true }
end