fontello_rails_converter 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTE3MGVjOTU4YTgwODQ2NTgzMDgzNDhmNWZhYTRlN2UyOTM5YTEyMw==
4
+ NTRhYmE3Yjk3NTEzNDRiOWM5ZGQ4M2Q4NTRlMTU0YzFmNGYyMzI1OQ==
5
5
  data.tar.gz: !binary |-
6
- MmM3MTk2ZDNmNWY5OGI0YzZiNjJhMjA1NTcwNjBlYmQ1MDJjMjhkZQ==
6
+ NmMxMmZmOGVjYjkwMGQyNjAwMzdhOTVmMDFhMGZjYmViOGYwYmVjNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjM0YTAwMTk5MjMxNzIwY2Q2ZmUxNjE4NjQwNWVjYTk2N2YwNTNkZjJlYjhk
10
- MmZmMGQwZGQ5YTAwYjNkOTJkYjc0OTk2YTQzNGJmMjNjNGQzMzUzZmZmNWVl
11
- MGY4MGRlNzAzZWM0MGFiZjU1ZWJkNWY3ZGU5ZTk4N2I0ODU4MGI=
9
+ ZWViZjFmYjUzNWM0YjkwZTUxY2JkN2YwN2I4Y2NhNjI5MjFkYTQ4OGNhZDJh
10
+ NjM0YzMxMWRkNmVhMzgzN2EzMjRjMTNiZTk0NDMxYmQ1OWM1NWY2MTY0MDNk
11
+ M2EwMTgzNzI3Yzg0NWEwZGI5NGY1YTEzNGJhNTBjMmYyMTRjYTU=
12
12
  data.tar.gz: !binary |-
13
- OGM2ZDBjZjQ1MGJlMjU5NGNiYjQwMzU2NDcxYjRmZGIzYmFjZDBlM2Y3MGIx
14
- MWZkMzNlMzI5YzU3MmRhZjg5MDNlN2MzMGU3M2FhYTgzYTNkZDA2NjkxNDdk
15
- YzhiYWQ4YjEyNzMxYjQ0ZWNmODgyOWY0YmE1Yzk0NzJjNzIyNWQ=
13
+ NDZjYzIyZDcxNmZiZTc0MGFhNjJlMzRmNmY3MDliM2Q4ZjI3NjZjNTQyY2M3
14
+ YjYwMDBjZGMwMTM5NDYzM2U3ZDllNTRiYmE1MTUxMjI5ZjM3ZTMxMjQ5YWI0
15
+ ZDBjNjNmMzY2NTMzZjNmMGJiM2Q0MTA0MmU0MmNjZjEwZjgwNDU=
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
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
@@ -4,4 +4,5 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'rails-dummy'
7
+ gem 'rails'
7
8
  gem 'sqlite3' # dummy app dependency
data/Rakefile CHANGED
@@ -1,2 +1,9 @@
1
1
  require 'bundler/gem_tasks'
2
- require 'rails/dummy/tasks'
2
+ require 'rails/dummy/tasks'
3
+
4
+ task :default => [:spec]
5
+
6
+ desc 'run Rspec specs'
7
+ task :spec do
8
+ sh 'rspec spec'
9
+ end
@@ -1,5 +1,5 @@
1
1
  module FontelloRailsConverter
2
- # for colorized output in the rake task
2
+ # for colorized output
3
3
  module ColorizedOutput
4
4
  def colorize(text, color_code)
5
5
  "\033[#{color_code}m#{text}\033[0m"
@@ -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('app', 'assets', 'fonts')
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
@@ -1,3 +1,3 @@
1
1
  module FontelloRailsConverter
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  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.1.1
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-10-24 00:00:00.000000000 Z
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