12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/buttonize/cli.rb', line 12
def generate(buttonset)
options = self.options.inject({}){|mem,h| mem[h[0].to_sym] = h[1]; mem}
target_path = options[:target_path]
if !target_path
target_path = File.join(Dir.pwd,"buttons")
FileUtils.mkdir_p(target_path) if !File.directory?(target_path)
end
options[:target_path] ||= target_path
Buttonize.run_in_cli!
require buttonset
raise "Are you sure #{buttonset} is a buttonset file?" if !ButtonSet.current
if !ButtonSet.current.options[:style_file]
require EXAMPLE_STYLE_FILE
end
puts "Generating buttons...."
ButtonSet.current.send(:generate_buttons,options)
end
|