Class: Fontcustom::CLI
- Inherits:
-
Thor
- Object
- Thor
- Fontcustom::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/fontcustom/cli.rb
Class Method Summary collapse
-
.source_root ⇒ Object
Required for Thor::Actions#template.
Instance Method Summary collapse
- #compile(input = nil) ⇒ Object
- #config(dir = Dir.pwd) ⇒ Object
- #show_help ⇒ Object
- #watch(input = nil) ⇒ Object
Class Method Details
.source_root ⇒ Object
Required for Thor::Actions#template
54 55 56 |
# File 'lib/fontcustom/cli.rb', line 54 def self.source_root File.join Fontcustom.gem_lib, "templates" end |
Instance Method Details
#compile(input = nil) ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/fontcustom/cli.rb', line 59 def compile(input = nil) opts = .merge :input => input opts = Options.new(opts) Generator::Font.start [opts] Generator::Template.start [opts] rescue Fontcustom::Error => e opts. :error, e., :red end |
#config(dir = Dir.pwd) ⇒ Object
82 83 84 |
# File 'lib/fontcustom/cli.rb', line 82 def config(dir = Dir.pwd) template "fontcustom.yml", File.join(dir, "fontcustom.yml") end |
#show_help ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/fontcustom/cli.rb', line 88 def show_help if [:version] puts "fontcustom-#{VERSION}" else help end end |
#watch(input = nil) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/fontcustom/cli.rb', line 72 def watch(input = nil) say "Font Custom is watching your icons. Press Ctrl + C to stop.", :yellow unless [:quiet] opts = .merge :input => input, :skip_first => !! [:skip_first] opts = Options.new(opts) Watcher.new(opts).watch rescue Fontcustom::Error => e opts. :error, e., :red end |