Class: Hieroglyph::CommandLine
- Inherits:
-
Object
- Object
- Hieroglyph::CommandLine
- Defined in:
- lib/hieroglyph/command_line.rb
Constant Summary collapse
- BANNER =
<<-EOS Usage: hieroglyph OPTIONS Run hieroglyph to generate an SVG font from a folder of SVG glyphs. Report any problems here: http://github.com/averyvery/hieroglyph/issues Options: EOS
Instance Method Summary collapse
-
#initialize ⇒ CommandLine
constructor
A new instance of CommandLine.
- #parse_options ⇒ Object
Constructor Details
#initialize ⇒ CommandLine
Returns a new instance of CommandLine.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hieroglyph/command_line.rb', line 19 def initialize @execute = true if @execute font = Hieroglyph.make @options Hieroglyph.success "#{@options[:name]} generated saved to #{File.(@options[:output_folder])}/#{@options[:name]}.svg" Hieroglyph.log "Single characters: #{font.characters.join(',')}" Hieroglyph.log "Unicode characters: #{font.unicode_values.join(',')}" Hieroglyph.log Hieroglyph.log "To create a full set of webfonts, upload to http://www.fontsquirrel.com/fontface/generator" Hieroglyph.log "If you're having trouble uploading SVGs, try converting to a TTF first using http://www.freefontconverter.com" Hieroglyph.log end end |
Instance Method Details
#parse_options ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/hieroglyph/command_line.rb', line 34 def @options = { :name => "MyFont", :output_folder => "./", :glyph_folder => "glyphs" } @option_parser = OptionParser.new do |opts| opts.on("-n", "--name NAME", "name of the font you want generated") do |name| @options[:name] = name end opts.on("-o", "--output OUTPUT_FOLDER", "where to output the generated font") do |output_folder| @options[:output_folder] = output_folder end opts.on("-g", "--glyphs GLYPH_FOLDER", "where to find glyphs to generate from") do |glyph_folder| @options[:glyph_folder] = glyph_folder end opts.on("-e", "--example", "output set of example glyphs") do |output_folder| @execute = false Hieroglyph.log "Example glyphs saved to #{Dir.pwd}/glyphs" glyphs_path = File.join(File.dirname(__FILE__), "assets/glyphs") exec "cp -r #{glyphs_path} ./" end opts.on_tail('-v', '--version', 'display Hieroglyph version') do @execute = false Hieroglyph.log "Hieroglyph version #{Hieroglyph::VERSION}" end end @option_parser. = BANNER @option_parser.parse!(ARGV) end |