fontello_rails_converter 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +4 -0
- data/CHANGELOG.md +11 -2
- data/Gemfile +1 -0
- data/Rakefile +8 -1
- data/lib/fontello_rails_converter/colorized_output.rb +1 -1
- data/lib/fontello_rails_converter/railtie.rb +4 -5
- data/lib/fontello_rails_converter/version.rb +1 -1
- metadata +3 -3
- data/lib/tasks/fontello_rails_converter.rake +0 -89
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTRhYmE3Yjk3NTEzNDRiOWM5ZGQ4M2Q4NTRlMTU0YzFmNGYyMzI1OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmMxMmZmOGVjYjkwMGQyNjAwMzdhOTVmMDFhMGZjYmViOGYwYmVjNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWViZjFmYjUzNWM0YjkwZTUxY2JkN2YwN2I4Y2NhNjI5MjFkYTQ4OGNhZDJh
|
10
|
+
NjM0YzMxMWRkNmVhMzgzN2EzMjRjMTNiZTk0NDMxYmQ1OWM1NWY2MTY0MDNk
|
11
|
+
M2EwMTgzNzI3Yzg0NWEwZGI5NGY1YTEzNGJhNTBjMmYyMTRjYTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDZjYzIyZDcxNmZiZTc0MGFhNjJlMzRmNmY3MDliM2Q4ZjI3NjZjNTQyY2M3
|
14
|
+
YjYwMDBjZGMwMTM5NDYzM2U3ZDllNTRiYmE1MTUxMjI5ZjM3ZTMxMjQ5YWI0
|
15
|
+
ZDBjNjNmMzY2NTMzZjNmMGJiM2Q0MTA0MmU0MmNjZjEwZjgwNDU=
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 0.2.0
|
4
|
+
|
5
|
+
* removed deprecated rake task
|
6
|
+
* updated railtie integration, so that rails will find and precompile the asset in `vendor/assets/fonts`
|
7
|
+
|
8
|
+
### 0.1.1
|
9
|
+
|
10
|
+
* only an update to the gemspec description
|
11
|
+
|
3
12
|
### 0.1.0
|
4
13
|
|
5
14
|
* convert the gem to a CLI tool with `open` and `convert` commands
|
@@ -8,8 +17,8 @@
|
|
8
17
|
|
9
18
|
### 0.0.2
|
10
19
|
|
11
|
-
updated rubyzip dependency
|
20
|
+
* updated rubyzip dependency
|
12
21
|
|
13
22
|
### 0.0.1
|
14
23
|
|
15
|
-
initial release
|
24
|
+
* initial release
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
module FontelloRailsConverter
|
2
2
|
class Railtie < Rails::Railtie
|
3
|
-
rake_tasks do
|
4
|
-
load File.join(File.dirname(__FILE__), '../tasks/fontello_rails_converter.rake')
|
5
|
-
end
|
6
3
|
|
7
4
|
initializer "fontello_rails_converter.setup" do |app|
|
8
|
-
app.config.assets.paths << Rails.root.join('
|
5
|
+
app.config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
|
6
|
+
app.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/
|
9
7
|
end
|
8
|
+
|
10
9
|
end
|
11
|
-
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontello_rails_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakob Hilden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -120,6 +120,7 @@ extra_rdoc_files: []
|
|
120
120
|
files:
|
121
121
|
- .gitignore
|
122
122
|
- .rspec
|
123
|
+
- .travis.yml
|
123
124
|
- CHANGELOG.md
|
124
125
|
- Gemfile
|
125
126
|
- LICENSE.txt
|
@@ -133,7 +134,6 @@ files:
|
|
133
134
|
- lib/fontello_rails_converter/fontello_api.rb
|
134
135
|
- lib/fontello_rails_converter/railtie.rb
|
135
136
|
- lib/fontello_rails_converter/version.rb
|
136
|
-
- lib/tasks/fontello_rails_converter.rake
|
137
137
|
- spec/dummy/README.rdoc
|
138
138
|
- spec/dummy/Rakefile
|
139
139
|
- spec/dummy/app/assets/images/.keep
|
@@ -1,89 +0,0 @@
|
|
1
|
-
desc "[deprecated] import new zipfile from fontello"
|
2
|
-
task :import_fontello, [:zipfile] => :environment do |t, args|
|
3
|
-
puts "THIS RAKE TASK IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION"
|
4
|
-
|
5
|
-
include FontelloRailsConverter::ColorizedOutput
|
6
|
-
require 'zip'
|
7
|
-
|
8
|
-
fontello_zipfile = args[:zipfile]
|
9
|
-
|
10
|
-
if fontello_zipfile.blank?
|
11
|
-
puts red("you need to specify the path to your fontello .zip file as an argument\ne.g. `rake import_fontello[\"tmp/fontelo-12345678.zip\"]`")
|
12
|
-
next
|
13
|
-
elsif !File.exist? fontello_zipfile
|
14
|
-
puts red("file #{fontello_zipfile} could not be found")
|
15
|
-
next
|
16
|
-
end
|
17
|
-
|
18
|
-
# target directories
|
19
|
-
target_assets_dir = File.join Rails.root, "vendor", "assets"
|
20
|
-
target_stylesheets_dir = File.join target_assets_dir, "stylesheets"
|
21
|
-
target_fonts_dir = File.join target_assets_dir, "fonts"
|
22
|
-
mkdir_p target_stylesheets_dir
|
23
|
-
mkdir_p target_fonts_dir
|
24
|
-
|
25
|
-
def convert_main_stylesheet(content)
|
26
|
-
# asset URLs
|
27
|
-
content.gsub! /\.\.\/font\//, ""
|
28
|
-
content.gsub!(/url\(([^\(]+)\)/) { |m| "url(font-path(#{$1}))" }
|
29
|
-
|
30
|
-
# turn icon base class into placeholder selector
|
31
|
-
content.gsub! /\[class\^="icon-[^\{]+{/m, "%icon-base {"
|
32
|
-
|
33
|
-
# get icons
|
34
|
-
icons = content.scan(/\.(icon-\S+):before/).map(&:first)
|
35
|
-
|
36
|
-
# convert icon classes to placeholder selectors
|
37
|
-
content.gsub!(/^\.(icon-\S+:before) { (.+)$/) { |m| "%#{$1} { @extend %icon-base; #{$2}" }
|
38
|
-
|
39
|
-
# recreate icon classes using the mixins
|
40
|
-
if icons.any?
|
41
|
-
content += "\n\n"
|
42
|
-
icons.each do |icon|
|
43
|
-
content += ".#{icon} { @extend %#{icon}; }\n"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
return content
|
48
|
-
end
|
49
|
-
|
50
|
-
def convert_demo_html(content)
|
51
|
-
content.gsub! /css\//, "/assets/"
|
52
|
-
end
|
53
|
-
|
54
|
-
Zip::File.open(args[:zipfile]) do |zipfile|
|
55
|
-
zipfile.each do |file|
|
56
|
-
filename = file.to_s.split("/").last
|
57
|
-
|
58
|
-
# stylesheets
|
59
|
-
if filename.end_with? '.css'
|
60
|
-
# extract stylesheet to target location
|
61
|
-
target_file = File.join target_stylesheets_dir, "#{filename}.scss"
|
62
|
-
zipfile.extract(file, target_file) { true }
|
63
|
-
puts green("copied #{target_file}")
|
64
|
-
|
65
|
-
if !filename.end_with? "animation.css", "-ie7.css", "-codes.css", "-ie7-codes.css", "-embedded.css"
|
66
|
-
converted_css = convert_main_stylesheet File.read(target_file)
|
67
|
-
File.open(target_file, 'w') { |f| f.write(converted_css) }
|
68
|
-
puts green("converted #{target_file} for Sass & asset pipeline")
|
69
|
-
end
|
70
|
-
|
71
|
-
# font files
|
72
|
-
elsif filename.end_with? ".eot", ".woff", ".ttf", ".svg", "config.json"
|
73
|
-
target_file = File.join target_fonts_dir, filename
|
74
|
-
zipfile.extract(file, target_file) { true }
|
75
|
-
puts green("copied #{target_file}")
|
76
|
-
|
77
|
-
# demo.html
|
78
|
-
elsif filename == 'demo.html'
|
79
|
-
target_file = File.join Rails.root, "public", "fontello-demo.html"
|
80
|
-
zipfile.extract(file, target_file) { true }
|
81
|
-
puts green("copied #{target_file}")
|
82
|
-
|
83
|
-
converted_html = convert_demo_html File.read(target_file)
|
84
|
-
File.open(target_file, 'w') { |f| f.write(converted_html) }
|
85
|
-
puts green("converted #{filename}'s HTML for asset pipeline")
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|