hieroglyph 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source :rubygems
3
3
  gemspec
4
4
  gem 'savage'
5
5
  gem 'nokogiri'
6
+ gem 'escape'
6
7
 
7
8
  group :test do
8
9
  gem 'rake'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Hieroglyph 0.1.3
1
+ # Hieroglyph 0.1.4
2
2
 
3
3
  Icon fonts are a great way to add sharp, flexible icons to your website using @font-face. [Chris Coyier thinks they're a good idea](http://css-tricks.com/using-fonts-for-icons/), and you should too.
4
4
 
@@ -78,7 +78,7 @@ If you want to help out, great! As an inexperienced dev, I'd appreciate any help
78
78
 
79
79
  bundle install
80
80
  rake install
81
- rake test
81
+ bundle exec rake
82
82
 
83
83
  ## Thanks
84
84
 
@@ -87,3 +87,20 @@ If you want to help out, great! As an inexperienced dev, I'd appreciate any help
87
87
  - [Jeremy Holland](http://www.jeremypholland.com/), for the [Savage SVG parsing gem.](https://github.com/awebneck/savage)
88
88
  - [Inkscape contributors](https://launchpad.net/inkscape/+topcontributors), who provided the original SVG font tool I used a lot on this project.
89
89
  - [P.J. Onori](http://somerandomdude.com/work/iconic/) for creating the open source Iconic icons, which I use as example icons.
90
+
91
+ ## Version notes
92
+
93
+ **0.1.4**<br>
94
+ Output is less verbose, more colorful
95
+
96
+ **0.1.3**<br>
97
+ Fix applied for older versions of ruby
98
+
99
+ **0.1.2**<br>
100
+ Better logging, more characters supported
101
+
102
+ **0.1.1**<br>
103
+ Officially a ruby gem, character sheet added
104
+
105
+ **0.1**<br>
106
+ Just a .rb script for converting simple SVGs to a font
@@ -26,7 +26,6 @@ module Hieroglyph
26
26
  end
27
27
 
28
28
  def save
29
- Hieroglyph.header 'Character sheet generated'
30
29
  cmd = ['montage']
31
30
  @@montage_args['title'] = @options[:name]
32
31
  @@montage_args.each do |arg, value|
@@ -39,7 +38,7 @@ module Hieroglyph
39
38
  cmd.push @output_path
40
39
  cmd = Escape.shell_command(cmd)
41
40
  system(cmd)
42
- Hieroglyph.log "Saved to #{File.expand_path(@options[:output_folder])}/#{@options[:name]}_characters.svg"
41
+ Hieroglyph.success "Character sheet saved: #{File.expand_path(@options[:output_folder])}/#{@options[:name]}_characters.svg"
43
42
  end
44
43
  end
45
44
 
@@ -21,16 +21,13 @@ Options:
21
21
  parse_options
22
22
  if @execute
23
23
  font = Hieroglyph.make @options
24
- Hieroglyph.header "#{@options[:name]} generated"
25
- Hieroglyph.log "Saved to #{File.expand_path(@options[:output_folder])}/#{@options[:name]}.svg"
26
- Hieroglyph.log "To create a full set of webfonts, upload to:"
27
- Hieroglyph.log "http://www.fontsquirrel.com/fontface/generator"
28
- Hieroglyph.log
29
- Hieroglyph.log "If you're having trouble uploading SVGs, try converting to a TTF first using http://www.freefontconverter.com"
30
- Hieroglyph.log
24
+ Hieroglyph.success "#{@options[:name]} generated saved to #{File.expand_path(@options[:output_folder])}/#{@options[:name]}.svg"
31
25
  Hieroglyph.log "Single characters: #{font.characters.join(',')}"
32
26
  Hieroglyph.log "Unicode characters: #{font.unicode_values.join(',')}"
33
27
  Hieroglyph.log
28
+ Hieroglyph.log "To create a full set of webfonts, upload to http://www.fontsquirrel.com/fontface/generator"
29
+ Hieroglyph.log "If you're having trouble uploading SVGs, try converting to a TTF first using http://www.freefontconverter.com"
30
+ Hieroglyph.log
34
31
  end
35
32
  end
36
33
 
@@ -21,7 +21,7 @@ module Hieroglyph
21
21
  end
22
22
 
23
23
  def setup
24
- Hieroglyph.header "Generating #{@options[:name]}"
24
+ Hieroglyph.header 'Setup:'
25
25
  Hieroglyph.delete @output_path
26
26
  @character_sheet = Hieroglyph.imagemagick_installed? ? CharacterSheet.new(@options) : NoopSheet.new
27
27
  include 'header'
@@ -38,6 +38,7 @@ module Hieroglyph
38
38
  file.puts @contents
39
39
  file.close
40
40
  end
41
+ Hieroglyph.header 'Done!'
41
42
  @character_sheet.save
42
43
  end
43
44
 
@@ -46,7 +47,7 @@ module Hieroglyph
46
47
  end
47
48
 
48
49
  def add_glyphs
49
- Hieroglyph.log
50
+ Hieroglyph.header 'Reading glyphs:'
50
51
  Dir.glob(File.join(@options[:glyph_folder], '*.svg')).each do |file|
51
52
  glyph = Glyph.new(file, @options[:glyph_folder], self)
52
53
  @character_sheet.add file
@@ -27,7 +27,7 @@ module Hieroglyph
27
27
  @font = font
28
28
  set_name(file, source)
29
29
  @contents = Nokogiri::XML(File.new(file))
30
- Hieroglyph.log "#{@name} -> reading...", 4
30
+ Hieroglyph.log "Parsing #{@name}", 2
31
31
  @path = parse_shapes
32
32
  end
33
33
 
@@ -72,19 +72,18 @@ module Hieroglyph
72
72
  end
73
73
 
74
74
  def convert_path(type, content)
75
- Hieroglyph.log 'path found', 9
76
75
  path = Savage::Parser.parse(content['d'])
77
76
  flip(path)
78
77
  end
79
78
 
80
79
  def report_invalid(type, content)
81
- Hieroglyph.log "#{type} found - this shape is invalid!", 9
82
- Hieroglyph.log "'make compound path' in your vector tool to fix", 9
80
+ Hieroglyph.error "#{type} found - this shape is invalid!", 4
81
+ Hieroglyph.error "'make compound path' in your vector tool to fix", 4
83
82
  end
84
83
 
85
84
  def report_too_many
86
85
  unless @too_many
87
- Hieroglyph.log 'too many shapes! your icon might look weird as a result', 9
86
+ Hieroglyph.error 'too many shapes! your icon might look weird as a result', 4
88
87
  @too_many = true
89
88
  end
90
89
  end
@@ -2,7 +2,7 @@ module Hieroglyph
2
2
 
3
3
  class NoopSheet
4
4
  def initialize(*)
5
- Hieroglyph.log "ImageMagick not detected - skipping character sheet"
5
+ Hieroglyph.error "ImageMagick not detected - skipping character sheet"
6
6
  end
7
7
  def add(file)
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Hieroglyph
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
data/lib/hieroglyph.rb CHANGED
@@ -6,10 +6,25 @@ module Hieroglyph
6
6
  puts str.rjust(str.length + pad)
7
7
  end
8
8
 
9
+ def self.colorize(str, color_code, pad)
10
+ Hieroglyph.log("\e[#{color_code}m#{str}\e[0m", pad)
11
+ end
12
+
9
13
  def self.header(str)
10
- puts ""
11
- puts "=== #{str} ==="
12
- puts ""
14
+ Hieroglyph.log
15
+ Hieroglyph.log("\033[1m#{str}\e[22m", 0)
16
+ end
17
+
18
+ def self.status(str, pad=2)
19
+ colorize(str, 33, pad)
20
+ end
21
+
22
+ def self.error(str, pad=2)
23
+ colorize(str, 31, pad)
24
+ end
25
+
26
+ def self.success(str, pad=2)
27
+ colorize(str, 32, pad)
13
28
  end
14
29
 
15
30
  def self.make(options)
@@ -23,7 +38,7 @@ module Hieroglyph
23
38
  def self.delete(file)
24
39
  if File.exist? file
25
40
  trimmed_file = file.gsub(/\.\//, '')
26
- Hieroglyph.log "#{trimmed_file} exists, deleting"
41
+ Hieroglyph.status "#{trimmed_file} exists, deleting"
27
42
  File.delete file
28
43
  end
29
44
  end
@@ -7,8 +7,6 @@ describe Hieroglyph::CharacterSheet do
7
7
  module Hieroglyph
8
8
  def self.log(*)
9
9
  end
10
- def self.header(*)
11
- end
12
10
  end
13
11
  File.delete('/tmp/sheet_characters.png') if File.exists?('/tmp/sheet_characters.png')
14
12
  @character_sheet = Hieroglyph::CharacterSheet.new({:output_folder => '/tmp', :name => 'sheet'})
@@ -8,8 +8,6 @@ describe Hieroglyph::Font do
8
8
  module Hieroglyph
9
9
  def self.log(*)
10
10
  end
11
- def self.header(*)
12
- end
13
11
  end
14
12
 
15
13
  system('rm -rf /tmp/glyphs/')
@@ -7,8 +7,6 @@ describe Hieroglyph::Glyph do
7
7
  module Hieroglyph
8
8
  def self.log(*)
9
9
  end
10
- def self.header(*)
11
- end
12
10
  end
13
11
  system('rm -rf /tmp/glyphs/')
14
12
  system('mkdir /tmp/glyphs/')
@@ -7,8 +7,6 @@ describe Hieroglyph::NoopSheet do
7
7
  module Hieroglyph
8
8
  def log(*)
9
9
  end
10
- def self.header(*)
11
- end
12
10
  end
13
11
  @character_sheet = Hieroglyph::NoopSheet.new({:output_folder => '/tmp', :name => 'sheet'})
14
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hieroglyph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-08 00:00:00.000000000 Z
12
+ date: 2012-05-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70339388858920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
24
+ version_requirements: *70339388858920
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: savage
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &70339388858400 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,15 +32,10 @@ dependencies:
37
32
  version: '0'
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
35
+ version_requirements: *70339388858400
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: escape
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70339388857840 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,12 +43,7 @@ dependencies:
53
43
  version: '0'
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
46
+ version_requirements: *70339388857840
62
47
  description: Generate a web-ready SVG font from a directory of SVG icons
63
48
  email:
64
49
  - dougunderscorenelson@gmail.com
@@ -120,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
105
  version: '0'
121
106
  requirements: []
122
107
  rubyforge_project:
123
- rubygems_version: 1.8.24
108
+ rubygems_version: 1.8.15
124
109
  signing_key:
125
110
  specification_version: 3
126
111
  summary: Icon font creator