Class: Buttonize::CLI
- Inherits:
-
Thor
- Object
- Thor
- Buttonize::CLI
- Defined in:
- lib/buttonize/cli.rb
Instance Method Summary collapse
Instance Method Details
#button(text, outfile = nil) ⇒ Object
36 37 38 39 40 |
# File 'lib/buttonize/cli.rb', line 36 def (text,outfile=nil) = {"style_file" => File.join(File.dirname(__FILE__),"../../examples/default/styles.rb"), "style_set" => :default}.update(self.) style = get_style(["style_file"],["style_set"],["style"]) Buttonize::Button.new(style).generate(text,outfile) end |
#generate(buttonset) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/buttonize/cli.rb', line 11 def generate() = self..inject({}){|mem,h| mem[h[0].to_sym] = h[1]; mem} target_path = [:target_path] if !target_path target_path = File.join(Dir.pwd,"buttons") FileUtils.mkdir_p(target_path) if !File.directory?(target_path) end [:target_path] ||= target_path Buttonize.run_in_cli! # Load the buttonset require raise "Are you sure #{buttonset} is a buttonset file?" if !ButtonSet.current puts "Generating buttons...." ButtonSet.current.send(:generate_buttons,) end |