agric 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/README.md +1 -1
  2. data/{lib → app}/assets/fonts/agric.eot +0 -0
  3. data/app/assets/fonts/agric.svg +389 -0
  4. data/{lib → app}/assets/fonts/agric.ttf +0 -0
  5. data/{lib → app}/assets/fonts/agric.woff +0 -0
  6. data/{lib/agric/compass/stylesheets/agric/_core.scss → app/assets/stylesheets/agric/core.scss} +6 -6
  7. data/{lib/agric/compass/stylesheets/agric/_mixins.scss → app/assets/stylesheets/agric/mixins.scss} +6 -0
  8. data/app/assets/stylesheets/agric/paths.scss +11 -0
  9. data/lib/agric/version.rb +1 -1
  10. data/lib/agric.rb +0 -19
  11. metadata +39 -33
  12. data/.gitignore +0 -21
  13. data/Gemfile +0 -4
  14. data/Rakefile +0 -2
  15. data/agric.gemspec +0 -25
  16. data/lib/agric/compass/stylesheets/agric/_paths.scss +0 -11
  17. data/lib/agric/compiler/convert.pe +0 -7
  18. data/lib/agric/compiler/reference.yml +0 -379
  19. data/lib/agric/compiler/svgo.yml +0 -58
  20. data/lib/agric/compiler.rb +0 -234
  21. data/lib/agric/compiler_tasks.rb +0 -8
  22. data/lib/assets/fonts/agric.svg +0 -389
  23. data/lib/assets/stylesheets/agric.css.scss +0 -5
  24. data/src/002-agri/config.yml +0 -5
  25. data/src/002-agri/font.svg +0 -594
  26. data/src/003-ekylibre/config.yml +0 -5
  27. data/src/003-ekylibre/font.svg +0 -104
  28. data/src/004-ergolis/config.yml +0 -5
  29. data/src/004-ergolis/font.svg +0 -88
  30. /data/{lib/agric/compass/stylesheets/agric/_extras.scss → app/assets/stylesheets/agric/extras.scss} +0 -0
  31. /data/{lib/agric/compass/stylesheets/agric/_icons.scss → app/assets/stylesheets/agric/icons.scss} +0 -0
  32. /data/{lib/agric/compass/stylesheets/agric/_list.scss → app/assets/stylesheets/agric/list.scss} +0 -0
  33. /data/{lib/agric/compass/stylesheets/agric/_variables.scss → app/assets/stylesheets/agric/variables.scss} +0 -0
  34. /data/{lib/agric/compass/stylesheets/_agric.scss → app/assets/stylesheets/agric.scss} +0 -0
@@ -1,58 +0,0 @@
1
- # replace default config
2
- full: true
3
-
4
- plugins:
5
-
6
- # - name
7
- #
8
- # or:
9
- # - name: false
10
- # - name: true
11
- #
12
- # or:
13
- # - name:
14
- # param1: 1
15
- # param2: 2
16
-
17
- - removeDoctype
18
- - removeXMLProcInst
19
- - removeComments
20
- - removeMetadata
21
- - removeEditorsNSData
22
- - cleanupAttrs
23
- - convertStyleToAttrs
24
- - removeRasterImages
25
- - cleanupNumericValues
26
- - convertColors
27
- - removeUnknownsAndDefaults
28
- - removeNonInheritableGroupAttrs
29
- - removeUselessStrokeAndFill
30
- - removeViewBox
31
- - cleanupEnableBackground
32
- - removeHiddenElems
33
- - removeEmptyText
34
- - moveElemsAttrsToGroup
35
- - collapseGroups
36
- - moveGroupAttrsToElems
37
- - convertTransform
38
- - convertPathData:
39
-
40
- applyTransforms: true
41
- lineShorthands: true
42
- curveSmoothShorthands: true
43
- removeUseless: true
44
- collapseRepeated: true
45
- leadingZero: true
46
- negativeExtraSpace: true
47
-
48
- # override defaults
49
- floatPrecision: 0
50
- straightCurves: false
51
-
52
- - removeEmptyAttrs
53
- - removeEmptyContainers
54
- - mergePaths
55
- - cleanupIDs
56
- - removeUnusedNS
57
-
58
- #- transformsWithOnePath:
@@ -1,234 +0,0 @@
1
- require 'rubygems'
2
- require 'fileutils'
3
- require 'yaml'
4
- require 'nokogiri'
5
- require 'agric'
6
-
7
- module Agric
8
- module Compiler
9
-
10
- class << self
11
-
12
- def command(cmds)
13
- puts "$ " + cmds
14
- system(cmds)
15
- end
16
-
17
- SVG_NAMESPACES = {
18
- :dc => "http://purl.org/dc/elements/1.1/",
19
- :cc => "http://creativecommons.org/ns#",
20
- :rdf => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
21
- :svg => "http://www.w3.org/2000/svg",
22
- :sodipodi => "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",
23
- :inkscape => "http://www.inkscape.org/namespaces/inkscape"
24
- }
25
-
26
- META = {
27
- :filename => "agric",
28
- :family => "Agric",
29
- :version => Agric::VERSION,
30
- :name => "agric"
31
- }
32
-
33
- def compile!(options = {})
34
- root = Agric.root
35
- sources = root.join("src")
36
- lib = root.join("lib")
37
- assets = lib.join("assets")
38
- compiler_dir = Pathname.new(File.expand_path(__FILE__)).dirname.join("compiler")
39
- convert_script = compiler_dir.join("convert.pe")
40
-
41
- output_font_file = assets.join("fonts", "#{META[:filename]}.svg")
42
- font_awesome_dir = Pathname.new(Dir.home).join(".font-awesome")
43
- glyphs = root.join("tmp", "glyphs")
44
-
45
- # Get latest Font-Awesome
46
- FileUtils.mkdir_p(font_awesome_dir.dirname)
47
- if font_awesome_dir.join(".git").exist?
48
- Dir.chdir(font_awesome_dir) do
49
- command("git pull")
50
- end
51
- else
52
- command("git clone git@github.com:FortAwesome/Font-Awesome.git #{font_awesome_dir}")
53
- end
54
-
55
- unless options[:explode].is_a?(FalseClass)
56
-
57
- # Normalize Font-Awesome
58
- awesome_dir = sources.join("001-awesome")
59
- FileUtils.rm_rf(awesome_dir)
60
- FileUtils.mkdir_p(awesome_dir)
61
- # FileUtils.cp(font_awesome_dir.join("build", "icons.yml"), awesome_dir.join("config.yml"))
62
- File.open(awesome_dir.join("config.yml"), "wb") do |f|
63
- icons = YAML.load_file(font_awesome_dir.join("src", "icons.yml"))
64
- # raise icons.inspect
65
- config = {"glyphs" => icons["icons"].collect{|h| {"css" => h["id"], "from" => "0x" + h["unicode"]} } }
66
- f.write(config.to_yaml)
67
- end
68
-
69
- forgotten_names = {
70
- "_279" => "info",
71
- "_283" => "eraser",
72
- "_303" => "rss_sign",
73
- "_312" => "external_link_sign",
74
- "_317" => "expand",
75
- "_329" => "sort_by_alphabet_alt",
76
- "_334" => "thumbs_up",
77
- "_335" => "thumbs_down",
78
- "_366" => "moon",
79
- "f0fe" => "plus_sign_alt",
80
- "f171" => "bitbucket"
81
- }
82
-
83
- # FileUtils.cp(font_awesome_dir.join("build", "assets", "font-awesome", "font", "fontawesome-webfont.svg"), awesome_dir.join("font.svg"))
84
- source = font_awesome_dir.join("src", "assets", "font-awesome", "font", "FontAwesome.otf")
85
- command("fontforge -script #{convert_script} #{source.to_s} svg")
86
- interm = source.dirname.join("FontAwesome.svg")
87
- File.open(interm) do |i|
88
- doc = Nokogiri::XML(i) do |config|
89
- config.nonet.strict.noblanks
90
- end
91
- doc.root.xpath("//glyph[@d]").each do |glyph|
92
- name = glyph.attr("glyph-name")
93
- name = forgotten_names[name] || name
94
- puts " !Weird name: #{name}" unless name =~ /^[a-z0-9]+((\_|\-)[a-z0-9]+)*$/
95
- name.gsub!(/[^a-z0-9]+/, '-')
96
- glyph["glyph-name"] = name
97
- end
98
- doc.root.default_namespace = SVG_NAMESPACES[:svg]
99
- for name, url in SVG_NAMESPACES
100
- doc.root.add_namespace(name.to_s, url)
101
- end
102
- File.open(awesome_dir.join("font.svg"), "wb") do |f|
103
- f.write doc.to_s
104
- end
105
- end
106
-
107
- puts "-" * 80
108
-
109
- # Explodes all font characters in one dir
110
- FileUtils.rm_rf(glyphs)
111
- FileUtils.mkdir_p(glyphs)
112
- Dir.chdir(sources) do
113
- for font_fullname in Dir["*"].sort
114
- font_dir = sources.join(font_fullname)
115
- font_name = font_fullname.split("-")[1..-1].join("-")
116
- font_file = font_dir.join("font.svg")
117
- config_file = font_dir.join("config.yml")
118
- if font_file.exist? and config_file.exist?
119
- command("svg-font-dump -n -c #{config_file} -f -i #{font_file} -o #{glyphs} ")
120
- end
121
- end
122
- end
123
-
124
- end
125
-
126
-
127
- config_file = compiler_dir.join('config.yml')
128
- config = {
129
- "font" => {
130
- "version" => META[:version],
131
- "fontname" => META[:name],
132
- "fullname" => "#{META[:family]} (#{META[:name]})",
133
- "familyname" => META[:family],
134
- "copyright" => "Copyright (C) 2013 by #{META[:family]}",
135
- "ascent" => 850,
136
- "descent" => 150,
137
- "weight" => "Regular"
138
- }
139
- }
140
-
141
- reference_file = compiler_dir.join('reference.yml')
142
- FileUtils.cp(reference_file, root.join("tmp", "reference-#{Date.today}-#{rand(1000).to_s(36)}.yml"))
143
- reference = YAML.load_file(reference_file)
144
- reference = {} unless reference.is_a?(Hash)
145
-
146
- icons = {}
147
-
148
- Dir.chdir(glyphs) do
149
- Dir.glob("*.svg").sort.collect do |cf|
150
- name = cf.split(/\./).first.to_s
151
- unless reference.has_key?(name)
152
- reference[name] = (reference.values.sort.last || "efff").to_i(16).succ.to_s(16)
153
- end
154
- icons[name] = reference[name]
155
- end
156
- end
157
-
158
- # Removes undefined glyphs from reference
159
- for ref in reference.keys
160
- reference.delete(ref) unless icons.keys.include?(ref)
161
- end
162
-
163
- File.open(reference_file, "wb") do |f|
164
- f.write "# Auto-updated. Nothing to touch.\n"
165
- for name, code in reference
166
- f.write "'#{name}': '#{code}'\n"
167
- end
168
- end
169
-
170
- # Build glyphs
171
- config["glyphs"] = icons.sort{|a,b| a[1] <=> b[1]}.collect do |name, unicode|
172
- {"css" => name, "code" => unicode.to_i(16)}
173
- end
174
-
175
- File.open(config_file, "wb") do |f|
176
- f.write config.to_yaml
177
- end
178
-
179
- # Recompose font
180
- command("svg-font-create -c #{config_file} -s #{compiler_dir.join('svgo.yml')} -i #{glyphs} -o #{output_font_file}")
181
-
182
- puts "-" * 80
183
-
184
-
185
- # Convert SVG font to all needed format
186
- command("fontforge -script #{convert_script} #{output_font_file} ttf")
187
- command("fontforge -script #{convert_script} #{output_font_file} woff")
188
- command("fontforge -script #{convert_script} #{output_font_file} eot")
189
- command("rm -f #{output_font_file.dirname.join('*.afm')}")
190
-
191
- # Write SCSS file to manage list of icons
192
- File.open(lib.join("agric", "compass", "stylesheets", "agric", "_paths.scss"), "wb") do |f|
193
- f.write "/* Auto-generated. Nothing to touch */\n"
194
- f.write "@font-face {\n"
195
- f.write " font-family: '#{META[:family]}';\n"
196
- f.write " font-weight: normal;\n"
197
- f.write " font-style: normal;\n"
198
- f.write " src: font-url('#{META[:filename]}.eot?v=#{META[:version]}');\n"
199
- f.write " src: font-url('#{META[:filename]}.eot?#iefix&v=#{META[:version]}') format('embedded-opentype'),\n"
200
- f.write " font-url('#{META[:filename]}.woff?v=#{META[:version]}') format('woff'),\n"
201
- f.write " font-url('#{META[:filename]}.ttf?v=#{META[:version]}') format('truetype'),\n"
202
- f.write " font-url('#{META[:filename]}.svg?v=#{META[:version]}') format('svg');\n"
203
- f.write "}\n"
204
- end
205
-
206
- File.open(lib.join("agric", "compass", "stylesheets", "agric", "_list.scss"), "wb") do |f|
207
- f.write "/* Auto-generated. Nothing to touch */\n"
208
- f.write "$agric-icons: ("
209
- f.write icons.map{ |name, code| "(#{name} \"\\#{code}\")" }.join(" ")
210
- f.write ")\n"
211
- end
212
-
213
-
214
- File.open(lib.join("agric", "compass", "stylesheets", "agric", "_icons.scss"), "wb") do |f|
215
- f.write "/* Auto-generated. Nothing to touch */\n"
216
- for name, code in icons
217
- f.write "$agric-icons-#{name}: \"\\#{code}\";\n"
218
- end
219
- f.write "\n"
220
- for name, code in icons
221
- f.write ".icon-#{name}:before { content: $agric-icons-#{name} };\n"
222
- end
223
- # f.write "$agric-icons: (" + icons.collect{|k,v| "(#{k} \"\\#{v}\")"}.join(" ") + ");\n"
224
- # f.write "@mixin icon-agric(): (" + icons.keys.join(" ") + ");\n"
225
- end
226
-
227
- end
228
-
229
-
230
-
231
- end
232
-
233
- end
234
- end
@@ -1,8 +0,0 @@
1
- require 'agric/compiler'
2
-
3
- desc "Compile font Agric #{Agric::VERSION}"
4
- task :compile do
5
- Agric::Compiler.compile!
6
- end
7
-
8
- # task :build => :compile