Class: Katte

Inherits:
Object
  • Object
show all
Defined in:
lib/katte.rb,
lib/katte/config.rb,
lib/katte/driver.rb,
lib/katte/filter.rb,
lib/katte/recipe.rb,
lib/katte/runner.rb,
lib/katte/command.rb,
lib/katte/version.rb,
lib/katte/environment.rb,
lib/katte/thread_pool.rb

Defined Under Namespace

Modules: Node, Plugins, Recipe Classes: Command, Config, Driver, Environment, Filter, Runner, ThreadPool

Constant Summary collapse

VERSION =
"0.0.1.3"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Katte

Returns a new instance of Katte.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/katte.rb', line 17

def initialize(options = {})
  @env     = Environment.new(options)
  @options = options
  @config  = Katte::Config.config

  @logger = if STDOUT.tty?
              Logger.new(STDOUT)
            else
              Logger.new(File.join(@config.log_root, 'katte.log'), 'daily')
            end
  @logger.level = Logger::WARN if config.mode == 'test'
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



13
14
15
# File 'lib/katte.rb', line 13

def config
  @config
end

#envObject (readonly)

Returns the value of attribute env.



12
13
14
# File 'lib/katte.rb', line 12

def env
  @env
end

#loggerObject (readonly)

Returns the value of attribute logger.



14
15
16
# File 'lib/katte.rb', line 14

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



15
16
17
# File 'lib/katte.rb', line 15

def options
  @options
end

Class Method Details

.app(params = {}) ⇒ Object



8
9
10
# File 'lib/katte.rb', line 8

def self.app(params = {})
  @instance ||= new(params)
end

.new(params = {}) ⇒ Object



5
6
7
# File 'lib/katte.rb', line 5

def self.new(params = {})
  @instance ||= super(params)
end

Instance Method Details

#exec(recipe_path) ⇒ Object



34
35
36
37
38
39
# File 'lib/katte.rb', line 34

def exec(recipe_path)
  node_factory = config.factory || Katte::Recipe::NodeFactory.new
  node = node_factory.load(recipe_path)

  node.file_type.execute(node)
end

#runObject



30
31
32
# File 'lib/katte.rb', line 30

def run
  (@runner ||= Katte::Runner.new).run
end