Module: Cadenza::Cli

Defined in:
lib/cadenza/cli.rb,
lib/cadenza/cli/options.rb

Defined Under Namespace

Classes: Options

Class Method Summary collapse

Class Method Details

.run!(path, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cadenza/cli.rb', line 8

def self.run!(path, options={})

  load_paths =
    if options[:root]
      [options[:root]]
    elsif options.key?(:load_paths) && [:load_paths].any?
      options[:load_paths]
    else
      [Dir.pwd]
    end

  load_paths.each do |load_path|
    Cadenza::BaseContext.add_load_path load_path
  end

  Cadenza::BaseContext.whiny_template_loading = true

  Cadenza.render_template path, options[:context]

end