Class: Diecut::KindCli

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/diecut/cli.rb

Instance Method Summary collapse

Instance Method Details

#generate(target_dir) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/diecut/cli.rb', line 10

def generate(target_dir)
  self.destination_root = target_dir

  mill = Mill.new(self.class.kind)
  mill.activate_plugins {|name| options["with-#{name}"] }

  ui = mill.user_interface
  options.delete_if{|_, value| value.nil?}
  ui.from_hash(options)

  mill.churn(ui) do |path, contents|
    create_file(path, contents)
  end
end

#lintObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/diecut/cli.rb', line 27

def lint
  require 'diecut/linter'
  mill = Mill.new(self.class.kind)
  if options["all_on"]
    mill.activate_plugins{ true }
  else
    mill.activate_plugins {|name| options["with-#{name}"] }
  end

  puts Linter.new(mill).report
end