Class: Fontcustom::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject

Required for Thor::Actions#template



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

def self.source_root
  File.join Fontcustom::Util.gem_lib_path, "templates"
end

Instance Method Details

#compile(input) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/fontcustom/cli.rb', line 27

def compile(input)
  opts = options.merge :input => input
  opts = Fontcustom::Util.collect_options opts
  Fontcustom::Generator::Font.start [opts]
  Fontcustom::Generator::Template.start [opts]
rescue Fontcustom::Error => e
  puts "ERROR: #{e.message}"
end

#config(input) ⇒ Object



47
48
49
# File 'lib/fontcustom/cli.rb', line 47

def config(input)
  template "fontcustom.yml", File.join(input, "fontcustom.yml")
end

#versionObject



52
53
54
# File 'lib/fontcustom/cli.rb', line 52

def version
  puts "fontcustom-#{Fontcustom::VERSION}"
end

#watch(input) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/fontcustom/cli.rb', line 38

def watch(input)
  opts = options.merge :input => input, :skip_first => !! options[:skip_first]
  opts = Fontcustom::Util.collect_options opts
  Fontcustom::Watcher.new(opts).watch
rescue Fontcustom::Error => e
  puts "ERROR: #{e.message}"
end