Class: Fontcustom::CLI
- Inherits:
-
Thor
- Object
- Thor
- Fontcustom::CLI
show all
- Includes:
- Utility
- Defined in:
- lib/fontcustom/cli.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Utility
#behavior, #destination_root, #line_break, #methodize_hash, #options, #project_root, #say_changed, #say_message, #say_status, #shell, shell, #source_paths, #symbolize_hash, #write_file
Class Method Details
.source_root ⇒ Object
Required for Thor::Actions#template
52
53
54
|
# File 'lib/fontcustom/cli.rb', line 52
def self.source_root
File.join Fontcustom.gem_lib, "templates"
end
|
Instance Method Details
#compile(input = nil) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/fontcustom/cli.rb', line 57
def compile(input = nil)
Base.new(options.merge(:input => input)).compile
rescue Fontcustom::Error => e
say_status :error, e.message, :red
puts e.backtrace.join("\n") if options[:debug]
end
|
#config(dir = Dir.pwd) ⇒ Object
77
78
79
|
# File 'lib/fontcustom/cli.rb', line 77
def config(dir = Dir.pwd)
template "fontcustom.yml", File.join(dir, "fontcustom.yml")
end
|
#show_help ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/fontcustom/cli.rb', line 83
def show_help
if options[:version]
puts "fontcustom-#{VERSION}"
else
help
end
end
|
#watch(input = nil) ⇒ Object
68
69
70
71
72
73
74
|
# File 'lib/fontcustom/cli.rb', line 68
def watch(input = nil)
say "Font Custom is watching your icons. Press Ctrl + C to stop.", :yellow unless options[:quiet]
opts = options.merge :input => input, :skip_first => !! options[:skip_first]
Watcher.new(opts).watch
rescue Fontcustom::Error => e
say_status :error, e.message, :red
end
|