├── .gitignore
├── .rspec
├── .travis.yml
├── CHANGELOG.md
├── Gemfile
├── LICENSE.txt
├── README.md
├── Rakefile
├── bin
└── fontello
├── fontello_rails_converter.gemspec
├── lib
├── fontello_rails_converter.rb
└── fontello_rails_converter
│ ├── cli.rb
│ ├── colorized_output.rb
│ ├── fontello_api.rb
│ ├── railtie.rb
│ └── version.rb
└── spec
├── cli_spec.rb
├── dummy_rails_root
├── public
│ └── fontello-demo.html
└── vendor
│ └── assets
│ ├── fonts
│ ├── config.json
│ ├── test.eot
│ ├── test.svg
│ ├── test.ttf
│ └── test.woff
│ └── stylesheets
│ ├── animation.css
│ ├── test-codes.css
│ ├── test-embedded.scss
│ ├── test-ie7-codes.css
│ ├── test-ie7.css
│ └── test.scss
├── fixtures
├── converted
│ └── fontello-demo.html
├── empty_name_config.json
├── fontello-demo.html
├── fontello
│ ├── LICENSE.txt
│ ├── README.txt
│ ├── config.json
│ ├── css
│ │ ├── animation.css
│ │ ├── test-codes.css
│ │ ├── test-embedded.css
│ │ ├── test-ie7-codes.css
│ │ ├── test-ie7.css
│ │ └── test.css
│ ├── demo.html
│ └── font
│ │ ├── test.eot
│ │ ├── test.svg
│ │ ├── test.ttf
│ │ └── test.woff
├── fontello_session_id_changing
├── fontello_session_id_empty
├── fontello_session_id_persisted
└── minimal-config.json
├── fontello_api_spec.rb
└── spec_helper.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | *.gem
2 | *.rbc
3 | .bundle
4 | .config
5 | .yardoc
6 | Gemfile.lock
7 | InstalledFiles
8 | _yardoc
9 | coverage
10 | doc/
11 | lib/bundler/man
12 | pkg
13 | rdoc
14 | spec/reports
15 | test/tmp
16 | test/version_tmp
17 | tmp
18 |
--------------------------------------------------------------------------------
/.rspec:
--------------------------------------------------------------------------------
1 | --color
2 | --format progress
3 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 2.2
4 | bundler_args: --without development
5 | before_install:
6 | - gem install bundler -v '~> 1.10'
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 0.4.6
2 |
3 | * [feature] added new `--webpack` option to convert stylesheets for use with webpack. #45
4 | * [bugfix] fixed compatibility with Rails 5 #44
5 |
6 | # 0.4.5
7 |
8 | * [bugfix] embedded base64 fonts (using `url()`) were not decoded correctly #43
9 |
10 | # 0.4.4
11 |
12 | * added .woff2 support #41
13 |
14 | # 0.4.2
15 |
16 | * [enhancement] embedded stylesheet (e.g. `fontello-embedded.css`) will also be converted to Sass #32
17 | * [bugfix] the .css source version of a stylesheet will be deleted on conversion, because having both a fontello.css and fontello.scss was creating problems #33
18 |
19 | # 0.4.1
20 |
21 | * [bugfix] for case where font name in `config.json` is empty #30
22 |
23 | # 0.4.0
24 |
25 | * added new `copy` command for cases where you don't want to convert assets
26 | * gem now depends on Ruby 2.x
27 |
28 | # 0.3.3
29 |
30 | * [improvement] changed default stylesheet file extension from `.css.scss` to `.scss` because of recent change in `sass-rails` (see #26)
31 | * [bugfix] fixed stylesheet extension option parsing #25
32 |
33 | # 0.3.2
34 |
35 | * [bugfix] the `config.json` wasn't being copied anymore
36 |
37 | # 0.3.1
38 |
39 | * allow configuration (and automatic creation) of icon guide directory (/rails_root/public/fontello-demo.html), fixes #19
40 | * more verbose/helpful CLI output
41 | * add `-v`/`--version` switch to CLI for printing out the current version
42 |
43 | # 0.3.0
44 |
45 | * allow setting global options using a .yml file (e.g. /rails_root/config/fontello_rails_converter.yml)
46 | * allow configuration of the stylesheet extension for the SCSS files (`.css.scss` or `.scss`)
47 | * fail gracefully when there is no config file yet (90ec5942383cc5558a097aa78c4adcc809ab6a0e)
48 | * fixes for 2 encoding issues #11 and #12 by @hqm42
49 |
50 | # 0.2.0
51 |
52 | * removed deprecated rake task
53 | * updated railtie integration, so that rails will find and precompile the asset in `vendor/assets/fonts`
54 |
55 | # 0.1.1
56 |
57 | * only an update to the gemspec description
58 |
59 | # 0.1.0
60 |
61 | * convert the gem to a CLI tool with `open` and `convert` commands
62 | * deprecated rake task
63 | * make use of the fontello API
64 |
65 | # 0.0.2
66 |
67 | * updated rubyzip dependency
68 |
69 | # 0.0.1
70 |
71 | * initial release
72 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Specify your gem's dependencies in fontello_rails_converter.gemspec
4 | gemspec
5 |
6 | group :test do
7 | gem 'rake'
8 | gem 'rspec'
9 | gem 'rails-dummy'
10 | gem 'rails', '~> 4.0'
11 | gem 'sqlite3' # dummy app dependency
12 | gem 'bundler', '~> 1.10'
13 | end
14 |
15 | group :development do
16 | gem 'pry-byebug'
17 | end
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 Jakob Hilden
2 |
3 | MIT License
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## fontello_rails_converter
2 |
3 | [](https://travis-ci.org/railslove/fontello_rails_converter)
4 |
5 | CLI gem for comfortably working with icon fonts from [http://fontello.com](http://fontello.com) for usage in Rails apps.
6 |
7 | Main features:
8 |
9 | * **Open** up your current fontello font in the browser from the command line
10 | * **Copy & convert** files from the zip into rails app (inclusively [Sass enhancements](#sass-enhacements))
11 |
12 |
13 | ## Initial usage
14 |
15 | #### Rails app setup
16 |
17 | Add the gem to your Gemfile `gem 'fontello_rails_converter'` and run `bundle install`
18 |
19 | Read the [note](https://github.com/railslove/fontello_rails_converter#gemfile-environment) below to decide whether to put the gem into the `production` or `development` group in your Gemfile.
20 |
21 | #### Get your icon font
22 |
23 | 1. Download your initial `.zip` file from [http://fontello.com](http://fontello.com) and save it to `myapp/tmp/fontello.zip`
24 |
25 | 1. Run `bundle exec fontello convert --no-download` inside your app's root directory
26 |
27 | It will copy all the assets from the `fontello.zip` file into the appropiate places in your app's `vendor/assets/` directory.
28 |
29 | #### Use the font in your app
30 |
31 | To use your font in your app you will need to `@import` the main stylesheet `vendor/assets/stylesheets/fontname.css.scss` in your `application.css.sass` using `@import 'fontname'`.
32 |
33 | You can check if the icon font is working correctly by visiting [http://localhost:3000/fontello-demo.html](http://localhost:3000/fontello-demo.html).
34 |
35 |
36 | ## Updating your existing fontello font
37 |
38 | When you want to add new icons to your existing fontello font you can open it in the browser by using `fontello open` and select all the additional icons you want to add.
39 |
40 | Next you click the 'Save session' button on the fontello website. After that you can download, copy and convert the changed font by running `bundle exec fontello convert` (it has persisted the session id in `tmp/fontello_session_id` and will used that to pull down your changed font).
41 |
42 | Alternatively, you can download & save the `.zip` file just like in the initial setp and run `bundle exec fontello convert --no-download` to use the manually downloaded file instead of pulling it down from fontello.
43 |
44 | ## Options
45 |
46 | * `--webpack` [command: `convert`]: generate the stylesheets for use with webpack, prefixing the font file names with the tilde (~). Es: `src: url('~fontello.eot?99999999');`. See [Webpack](#webpack).
47 |
48 | ## More help
49 |
50 | For more help run `fontello --help`
51 |
52 | ## Sass enhacements
53 |
54 | The conversion process will do a couple of things to make working with the main fontello stylesheet easier in Rails/Sass:
55 |
56 | * It will convert font paths to use `font-url` (unless you use the `--webpack` option)
57 | * It will create [Sass placeholder selectors](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#placeholder_selectors_) (e.g. `%icon-foo` for all the icons) so you have the choice to use the CSS classes in your markup or to `@extend` the placeholders in your Sass code
58 |
59 | ## Webpack
60 |
61 | You can convert the fontello stylesheets for use with Webpack instead of Sprockets.
62 |
63 | If you have not alreday done it, you must
64 |
65 | * add the vendor paths to the resolve roots of Webpack
66 |
67 | ```javascript
68 | [...]
69 | const path = require("path")
70 | const railsRoot = path.join(__dirname, ".")
71 | [...]
72 | module.exports = {
73 | [...]
74 | resolve: {
75 | root: [
76 | [...]
77 | path.join(railsRoot, './vendor/assets/javascripts'),
78 | path.join(railsRoot, './vendor/assets/stylesheets'),
79 | path.join(railsRoot, './vendor/assets/fonts'),
80 | ],
81 | },
82 |
83 | ```
84 |
85 | * add optional parameters to the `test` key for the loader of the fonts files
86 |
87 | ```javascript
88 | test: /\.(png|woff|woff2|eot|ttf|svg)(\?[a-z0-9=.]+)?$/,
89 | ```
90 |
91 | ## Misc
92 |
93 | #### Additional fontello stylesheets
94 |
95 | Besides the main stylesheet (`fontname.css.scss`) fontello also provides a couple of additional stylesheets that you might want to `@import` in your app for special use cases: `fontname-ie7-codes.css.scss`, `fontname-embedded.css.scss`, `animation.css.scss`, `fontname-ie7.css.scss`, `fontname-codes.css.scss`
96 |
97 | #### Gemfile environment
98 |
99 | If you don't want to load this gem in your app's production environment to save a tiny bit of memory, you can also just add it to the `:development` group in your Gemfile. The only thing you might need to change is to tell rails to add `vendor/assets/fonts` to the precompile load paths see: https://github.com/railslove/fontello_rails_converter/blob/master/lib/fontello_rails_converter/railtie.rb
100 |
101 | #### Configuration file
102 |
103 | By default the gem will look in `Rails.root.join("config", "fontello_rails_converter.yml")` for configuration options. You can use this to set default options for the tool.
104 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require 'bundler/gem_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
--------------------------------------------------------------------------------
/bin/fontello:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'optparse'
4 | require 'yaml'
5 | require "fontello_rails_converter"
6 | command = ARGV[0]
7 |
8 | if ARGV[0].nil?
9 | puts "Run fontello --help for help"
10 | exit
11 | end
12 |
13 | def set_options_based_on_rails_root(options)
14 | options[:asset_dir] = "#{options[:rails_root_dir]}/vendor/assets"
15 | options.merge!({
16 | stylesheet_dir: "#{options[:asset_dir]}/stylesheets",
17 | font_dir: "#{options[:asset_dir]}/fonts",
18 | icon_guide_dir: "#{options[:rails_root_dir]}/public",
19 | zip_file: "#{options[:rails_root_dir]}/tmp/fontello.zip",
20 | config_file: "#{options[:asset_dir]}/fonts/config.json",
21 | fontello_session_id_file: "#{options[:rails_root_dir]}/tmp/fontello_session_id",
22 | options_file: "#{options[:rails_root_dir]}/config/fontello_rails_converter.yml"
23 | })
24 | end
25 |
26 | def set_options_from_file(options)
27 | if File.exist?(options[:options_file])
28 | puts "Loading options from #{options[:options_file]}"
29 | options_from_file = YAML.load_file options[:options_file]
30 | options_from_file.each do |key, value|
31 | options[key.to_sym] = value if options.keys.include?(key.to_sym)
32 | end
33 | end
34 | end
35 |
36 | # defaults
37 | options = {
38 | rails_root_dir: '.',
39 | stylesheet_extension: '.scss'
40 | }
41 | set_options_based_on_rails_root(options)
42 | set_options_from_file(options)
43 |
44 | OptionParser.new do |opts|
45 | opts.banner = "Usage: fontello COMMAND [options]\n\n"
46 |
47 | opts.separator "Available commands: open, convert, copy, download\n\n"
48 |
49 | opts.separator "Global options:"
50 |
51 | opts.on("-o", "--options-file [PATH]", "options .yml file (default: /rails_root/config/fontello_rails_converter.yml)") do |opt|
52 | options[:options_file] = opt
53 | set_options_from_file(options)
54 | end
55 |
56 | opts.on("-i", "--fontello-session-id [ID]", "Pass in session ID from fontello.com (e.g. fb235ab72cad01d2b46aaa023ab4abbd) otherwise it will be taken from session-id-file\n\n") do |opt|
57 | options[:fontello_session_id] = opt
58 | end
59 |
60 | opts.separator "`open` options:"
61 |
62 | opts.on("-e", "--open-existing", "Doesn't open fontello based on config.json, but based on passed in or persisted sesssion id\n\n") do |opt|
63 | options[:open_existing] = true
64 | end
65 |
66 | opts.separator "`convert` options:"
67 |
68 | opts.on("-n", "--no-download", "Converts existing .zip file without automatically downloading a new one") do |opt|
69 | options[:no_download] = true
70 | end
71 |
72 | opts.on("--stylesheet-extension [EXTENSION]", "Pick between e.g. '.css.scss' or '.scss'\n\n") do |opt|
73 | options[:stylesheet_extension] = opt
74 | end
75 |
76 | opts.on("--webpack", "Generate for webpack") do |opt|
77 | options[:webpack] = true
78 | end
79 |
80 | opts.separator "`download` options:"
81 |
82 | opts.on("-u", "--use-config", "Uses existing config.json instead of persisted or passed in fontello session ID\n\n") do |opt|
83 | options[:use_config] = true
84 | end
85 |
86 | opts.separator "Path options:"
87 |
88 | opts.on("-r", "--rails-root [PATH]", "Rails root path (default: current location)") do |opt|
89 | options[:rails_root_dir] = opt
90 | set_options_based_on_rails_root(options)
91 | end
92 |
93 | opts.on("-c", "--config-file [PATH]", "config.json file (default: /rails_root/vendor/assets/fonts/config.json)") do |opt|
94 | options[:config_file] = opt
95 | end
96 |
97 | opts.on("-z", "--zip-file [PATH]", "Downloaded zip file (default: /rails_root/tmp/fontello.zip)") do |opt|
98 | options[:zip_file] = opt
99 | end
100 |
101 | opts.on("-a", "--asset-dir [PATH]", "Target asset directory (default: /rails_root/vendor/assets)") do |opt|
102 | options[:asset_dir] = opt
103 | end
104 |
105 | opts.on("-s", "--stylesheet-dir [PATH]", "Target stylesheet directory (default: /rails_root/vendor/assets/stylesheets)") do |opt|
106 | options[:stylesheet_dir] = opt
107 | end
108 |
109 | opts.on("-f", "--font-dir [PATH]", "Target font directory (default: /rails_root/vendor/assets/fonts)") do |opt|
110 | options[:font_dir] = opt
111 | end
112 |
113 | opts.on("--icon-guide-dir [PATH]", "Target icon guide (fontello-demo.html) directory (default: /rails_root/public)") do |opt|
114 | options[:icon_guide_dir] = opt
115 | end
116 |
117 | opts.on("-p", "--session-id-file [PATH]", "File to persist fontello session ID (default: /rails_root/tmp/fontello_session_id)") do |opt|
118 | options[:fontello_session_id_file] = opt
119 | end
120 |
121 | opts.on_tail("-v", "--version", "Show version") do
122 | puts FontelloRailsConverter::VERSION
123 | exit
124 | end
125 |
126 | opts.separator "\nExamples:\n"\
127 | " fontello open -r /path/to/railsapp\n"\
128 | " fontello convert\n"\
129 | " fontello download -e -i fb235ab72cad01d2b46aaa023ab4abbd\n"
130 | end.parse!
131 |
132 |
133 | unless ["open", "download", "convert", "copy"].include?(command)
134 | puts "available commands: open, download, convert, copy"
135 | exit
136 | end
137 |
138 | FontelloRailsConverter::Cli.new(options).send(command)
139 |
--------------------------------------------------------------------------------
/fontello_rails_converter.gemspec:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | lib = File.expand_path('../lib', __FILE__)
3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4 | require 'fontello_rails_converter/version'
5 |
6 | Gem::Specification.new do |spec|
7 | spec.name = "fontello_rails_converter"
8 | spec.version = FontelloRailsConverter::VERSION
9 | spec.authors = ["Jakob Hilden"]
10 | spec.email = ["jakobhilden@gmail.com"]
11 | spec.description = %q{Gem for opening up your current fontello font in the browser from the command line and copying & converting the files for your Rails app (inclusively Sass enhancements).}
12 | spec.summary = %q{CLI gem for comfortably working with custom icon fonts from fontello.com in your Rails apps}
13 | spec.homepage = "https://github.com/railslove/fontello_rails_converter"
14 | spec.license = "MIT"
15 |
16 | spec.files = `git ls-files`.split($/)
17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19 | spec.require_paths = ["lib"]
20 |
21 | spec.required_ruby_version = '~> 2.0'
22 |
23 | spec.add_runtime_dependency "rubyzip", "~> 1.0"
24 | spec.add_runtime_dependency "launchy"
25 | spec.add_runtime_dependency "rest-client"
26 | spec.add_runtime_dependency "activesupport"
27 | end
28 |
--------------------------------------------------------------------------------
/lib/fontello_rails_converter.rb:
--------------------------------------------------------------------------------
1 | require 'active_support/core_ext/string'
2 |
3 | require "fontello_rails_converter/version"
4 | require "fontello_rails_converter/colorized_output"
5 | require "fontello_rails_converter/fontello_api"
6 | require "fontello_rails_converter/cli"
7 | require "fontello_rails_converter/railtie" if defined?(Rails)
8 |
9 | module FontelloRailsConverter
10 | end
11 |
--------------------------------------------------------------------------------
/lib/fontello_rails_converter/cli.rb:
--------------------------------------------------------------------------------
1 | require 'fileutils'
2 | require 'launchy'
3 | require 'zip'
4 |
5 | module FontelloRailsConverter
6 | class Cli
7 | include ColorizedOutput
8 |
9 | def initialize(options)
10 | @options = options
11 | @fontello_api = FontelloApi.new @options
12 | end
13 |
14 | def open
15 | puts "---- open ----"
16 | if config_file_exists?
17 | @fontello_api.new_session_from_config unless @options[:open_existing] == true
18 | Launchy.open @fontello_api.session_url
19 | end
20 | end
21 |
22 | def download
23 | puts "---- download ----"
24 |
25 | if config_file_exists? && @options[:use_config] == true
26 | puts "Using '#{options[:config_file]}' to create new fontello session"
27 | @fontello_api.new_session_from_config
28 | end
29 |
30 | File.open(@options[:zip_file], "w+") do |file|
31 | file.write @fontello_api.download_zip_body
32 | end
33 | puts green "Downloaded '#{@options[:zip_file]}' from fontello (#{@fontello_api.session_url})"
34 | end
35 |
36 | def copy
37 | if @options[:no_download] == true
38 | puts "Use existing '#{@options[:zip_file]}' file due to `--no-download` switch"
39 | else
40 | download
41 | end
42 |
43 | puts "---- copy -----"
44 | prepare_directories
45 |
46 | if zip_file_exists?
47 | Zip::File.open(@options[:zip_file]) do |zipfile|
48 | grouped_files = zipfile.group_by{ |file| file.to_s.split("/")[1] }
49 |
50 | copy_stylesheets(zipfile, grouped_files['css'])
51 | copy_font_files(zipfile, grouped_files['font'])
52 | copy_config_json(zipfile, grouped_files['config.json'].first)
53 | copy_icon_guide(zipfile, grouped_files['demo.html'].first)
54 | end
55 | end
56 | end
57 |
58 | def convert
59 | copy
60 |
61 | puts "---- convert -----"
62 | convert_stylesheets(@options[:webpack])
63 | convert_icon_guide
64 |
65 | end
66 |
67 | private
68 |
69 | def prepare_directories
70 | FileUtils.mkdir_p @options[:font_dir]
71 | FileUtils.mkdir_p @options[:stylesheet_dir]
72 | FileUtils.mkdir_p @options[:asset_dir]
73 | FileUtils.mkdir_p @options[:icon_guide_dir]
74 | end
75 |
76 | def convert_stylesheets(webpack)
77 | ['', '-embedded'].each do |stylesheet_postfix|
78 | source_file = stylesheet_file(postfix: stylesheet_postfix)
79 | content = File.read(source_file).encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
80 |
81 | content = sass_enhance(content)
82 | puts "enhancing with Sass placeholder selectors"
83 |
84 | if webpack
85 | content = convert_for_webpack(content)
86 | puts "converting for webpack"
87 | else
88 | content = convert_for_asset_pipeline(content)
89 | puts "converting for asset pipeline"
90 | end
91 |
92 | target_file = stylesheet_file(postfix: stylesheet_postfix, extension: @options[:stylesheet_extension])
93 | File.open(target_file, 'w') { |f| f.write(content) }
94 | puts green("Write converted #{target_file}")
95 |
96 | File.delete(source_file)
97 | puts "Removed #{source_file} in favor of the #{@options[:stylesheet_extension]}"
98 | end
99 | end
100 |
101 | def convert_for_asset_pipeline(content)
102 | # asset URLs
103 | content.gsub! /\.\.\/font\//, ""
104 | content.gsub!(/url\(([^\(]+)\)/) do |m|
105 | $1.include?("application/octet-stream") ? "url(#{$1})" : "font-url(#{$1})"
106 | end
107 | end
108 |
109 | def convert_for_webpack(content)
110 | content.gsub! /\.\.\/font\//, ""
111 | content.gsub!(/url\(([^\(]+)\)/) do |m|
112 | replace = if $1[0] == "'"
113 | "'~#{$1[1..-1]}"
114 | else
115 | "~#{$1}"
116 | end
117 | $1.include?("application/octet-stream") ? "url(#{$1})" : "url(#{replace})"
118 | end
119 | end
120 |
121 | def sass_enhance(content)
122 | # turn icon base class into placeholder selector
123 | content.gsub! /\[class\^="icon-[^\{]+{/m, "%icon-base {"
124 |
125 | # get icons
126 | icons = content.scan(/\.(icon-\S+):before/).map(&:first)
127 |
128 | # convert icon classes to placeholder selectors
129 | content.gsub!(/^\.(icon-\S+:before) { (.+)$/) { |m| "%#{$1} { @extend %icon-base; #{$2}" }
130 |
131 | # recreate icon classes using the mixins
132 | if icons.any?
133 | content += "\n\n"
134 | icons.each do |icon|
135 | content += ".#{icon} { @extend %#{icon}; }\n"
136 | end
137 | end
138 |
139 | content
140 | end
141 |
142 | def copy_font_files(zipfile, files)
143 | puts "font files:"
144 | files.select{ |file| file.to_s.end_with?(".eot", ".woff", ".woff2", ".ttf", ".svg") }.each do |file|
145 | filename = file.to_s.split("/").last
146 |
147 | target_file = File.join @options[:font_dir], filename
148 | zipfile.extract(file, target_file) { true }
149 | puts green("Copied #{target_file}")
150 | end
151 | end
152 |
153 | def copy_config_json(zipfile, config_file)
154 | puts "config file:"
155 | zipfile.extract(config_file, @options[:config_file]) { true }
156 | puts green("Copied #{@options[:config_file]}")
157 | end
158 |
159 | def copy_stylesheets(zipfile, files)
160 | puts "stylesheets:"
161 | files.select{ |file| file.to_s.end_with?('.css') }.each do |file|
162 | filename = file.to_s.split("/").last
163 |
164 | # extract stylesheet to target location
165 | target_file = File.join @options[:stylesheet_dir], filename
166 | zipfile.extract(file, target_file) { true }
167 | puts green("Copied #{target_file}")
168 | end
169 | end
170 |
171 | def copy_icon_guide(zipfile, demo_file)
172 | puts "icon guide (demo.html):"
173 |
174 | zipfile.extract(demo_file, icon_guide_target_file) { true }
175 | puts green("Copied #{icon_guide_target_file}")
176 | end
177 |
178 | def convert_icon_guide
179 | content = File.read(icon_guide_target_file)
180 | File.open(icon_guide_target_file, 'w') do |f|
181 | f.write self.class.convert_icon_guide_html(content)
182 | end
183 | puts green("Converted demo.html for asset pipeline: #{icon_guide_target_file}")
184 | end
185 |
186 | def self.convert_icon_guide_html(content)
187 | content.gsub! /css\//, "/assets/"
188 | content.gsub! "url('./font/", "url('/assets/"
189 | end
190 |
191 | def config_file_exists?
192 | if @options[:config_file] && File.exist?(@options[:config_file])
193 | true
194 | else
195 | puts red("missing config file: #{@options[:config_file]}")
196 | puts red("follow these instructions: https://github.com/railslove/fontello_rails_converter#initial-usage")
197 | puts red("to setup your project")
198 | false
199 | end
200 | end
201 |
202 | def zip_file_exists?
203 | if File.exist?(@options[:zip_file])
204 | true
205 | else
206 | puts red("missing zip file: #{@options[:zip_file]}")
207 | false
208 | end
209 | end
210 |
211 | def icon_guide_target_file
212 | @_icon_guide_target_file ||= File.join(@options[:icon_guide_dir], "fontello-demo.html")
213 | end
214 |
215 | def stylesheet_file(postfix: '', extension: '.css')
216 | if fontello_name.present? && @options[:stylesheet_dir].present?
217 | File.join(@options[:stylesheet_dir], "#{fontello_name}#{postfix}#{extension}")
218 | end
219 | end
220 |
221 | def fontello_name
222 | @_fontello_name ||= if config_file_exists?
223 | JSON.parse(File.read(@options[:config_file]))['name'].presence || 'fontello'
224 | end
225 | end
226 | end
227 | end
228 |
--------------------------------------------------------------------------------
/lib/fontello_rails_converter/colorized_output.rb:
--------------------------------------------------------------------------------
1 | module FontelloRailsConverter
2 | # for colorized output
3 | module ColorizedOutput
4 | def colorize(text, color_code)
5 | "\033[#{color_code}m#{text}\033[0m"
6 | end
7 |
8 | {
9 | :black => 30,
10 | :red => 31,
11 | :green => 32,
12 | :yellow => 33,
13 | :blue => 34,
14 | :magenta => 35,
15 | :cyan => 36,
16 | :white => 37
17 | }.each do |key, color_code|
18 | define_method key do |text|
19 | colorize(text, color_code)
20 | end
21 | end
22 | end
23 | end
--------------------------------------------------------------------------------
/lib/fontello_rails_converter/fontello_api.rb:
--------------------------------------------------------------------------------
1 | require 'rest_client'
2 | require 'json'
3 |
4 | module FontelloRailsConverter
5 | class FontelloApi
6 | FONTELLO_HOST = "https://fontello.com"
7 |
8 | def initialize(options)
9 | @config_file = options[:config_file]
10 | @session_id = options[:fontello_session_id]
11 | @fontello_session_id_file = options[:fontello_session_id_file]
12 | end
13 |
14 | # creates a new fontello session from config.json
15 | def new_session_from_config
16 | @session_id = RestClient.post FONTELLO_HOST, config: File.new(@config_file, 'rb')
17 | persist_session
18 | @session_id
19 | end
20 |
21 | def session_url
22 | "#{FONTELLO_HOST}/#{session_id}"
23 | end
24 |
25 | def download_zip_body
26 | response = RestClient.get "#{session_url}/get"
27 | response.body.force_encoding("UTF-8")
28 | end
29 |
30 | private
31 |
32 | def session_id
33 | @session_id ||= read_or_create_session
34 | end
35 |
36 | def read_or_create_session
37 | if @fontello_session_id_file && File.exist?(@fontello_session_id_file)
38 | @session_id = File.read(@fontello_session_id_file)
39 | return @session_id unless @session_id == ""
40 | end
41 |
42 | new_session_from_config
43 | end
44 |
45 | def persist_session
46 | File.open(@fontello_session_id_file, 'w+') { |f| f.write @session_id }
47 | end
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/lib/fontello_rails_converter/railtie.rb:
--------------------------------------------------------------------------------
1 | module FontelloRailsConverter
2 | class Railtie < Rails::Railtie
3 |
4 | initializer "fontello_rails_converter.setup" do |app|
5 | if app.config.respond_to? (:assets)
6 | app.config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
7 | app.config.assets.precompile << /\.(?:svg|eot|woff|woff2|ttf)$/
8 | end
9 | end
10 |
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/lib/fontello_rails_converter/version.rb:
--------------------------------------------------------------------------------
1 | module FontelloRailsConverter
2 | VERSION = "0.4.6"
3 | end
4 |
--------------------------------------------------------------------------------
/spec/cli_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe FontelloRailsConverter::Cli do
4 | let(:cli) { described_class.new({
5 | config_file: 'spec/fixtures/fontello/config.json',
6 | stylesheet_dir: 'vendor/assets/stylesheets'
7 | })
8 | }
9 |
10 | describe '.convert_icon_guide_html' do
11 | let(:content) { File.read('spec/fixtures/fontello-demo.html') }
12 | let(:converted_content) { File.read('spec/fixtures/converted/fontello-demo.html') }
13 |
14 | specify do
15 | expect(described_class.convert_icon_guide_html(content)).to eql converted_content
16 | end
17 | end
18 |
19 | describe '#stylesheet_file' do
20 | specify do
21 | expect(cli.send(:stylesheet_file)).to eql 'vendor/assets/stylesheets/test.css'
22 | end
23 |
24 | context '.scss extension' do
25 | specify do
26 | expect(cli.send(:stylesheet_file, extension: '.scss')).to eql 'vendor/assets/stylesheets/test.scss'
27 | end
28 | end
29 |
30 | context 'with postfix' do
31 | specify do
32 | expect(cli.send(:stylesheet_file, postfix: '-embedded', extension: '.scss')).to eql 'vendor/assets/stylesheets/test-embedded.scss'
33 | end
34 | end
35 | end
36 |
37 | describe '#convert_for_asset_pipeline' do
38 | specify do
39 | expect(cli.send(:convert_for_asset_pipeline, "url(/this/is/a/link)")).to eql 'font-url(/this/is/a/link)'
40 | end
41 |
42 | specify do
43 | expect(cli.send(:convert_for_webpack, "url(/this/is/a/link)")).to eql 'url(~/this/is/a/link)'
44 | end
45 |
46 | specify do
47 | expect(cli.send(:convert_for_webpack, "url('/this/is/a/link')")).to eql %q[url('~/this/is/a/link')]
48 | end
49 |
50 | specify do
51 | expect(cli.send(:convert_for_webpack, "url(data:application/octet-stream;base64,FFF)")).to eql 'url(data:application/octet-stream;base64,FFF)'
52 | end
53 |
54 | specify do
55 | expect(cli.send(:convert_for_asset_pipeline, "url(data:application/octet-stream;base64,FFF)")).to eql 'url(data:application/octet-stream;base64,FFF)'
56 | end
57 | end
58 |
59 |
60 | describe '#fontello_name' do
61 | context 'no config_file specified' do
62 | let(:cli) { described_class.new({}) }
63 | specify do
64 | expect(cli.send(:fontello_name)).to eql nil
65 | end
66 | end
67 |
68 | context 'specified config file doesnt exist' do
69 | let(:cli) { described_class.new(config_file: 'foo') }
70 | specify do
71 | expect(cli.send(:fontello_name)).to eql nil
72 | end
73 | end
74 |
75 | context 'name is empty' do
76 | let(:cli) { described_class.new(config_file: 'spec/fixtures/empty_name_config.json') }
77 | it 'should fall back to "fontello"' do
78 | expect(cli.send(:fontello_name)).to eql 'fontello'
79 | end
80 | end
81 |
82 | context 'correct config file' do
83 | specify do
84 | expect(cli.send(:fontello_name)).to eql 'test'
85 | end
86 | end
87 | end
88 |
89 | describe '#copy_config_json' do
90 | let(:zipfile) { instance_double('FontelloZipfile') }
91 | let(:config_file_path) { 'test/config.json' }
92 |
93 | subject {
94 | cli.send(:copy_config_json, zipfile, config_file_path)
95 | }
96 |
97 | specify do
98 | expect(zipfile).to receive(:extract).with(config_file_path, 'spec/fixtures/fontello/config.json')
99 | subject
100 | end
101 | end
102 | end
103 |
--------------------------------------------------------------------------------
/spec/dummy_rails_root/public/fontello-demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
278 |
279 |
291 |
292 |
293 |
302 |
303 |
304 |
icon-glass 0xe800
305 |
306 |
307 |
308 |
309 |
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/fonts/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test",
3 | "css_prefix_text": "icon-",
4 | "css_use_suffix": false,
5 | "hinting": true,
6 | "units_per_em": 1000,
7 | "ascent": 850,
8 | "glyphs": [
9 | {
10 | "uid": "cfaa8fbbdcc7bb8d636cb974aad1f9b9",
11 | "css": "glass",
12 | "code": 59392,
13 | "src": "fontawesome"
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/fonts/test.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/railslove/fontello_rails_converter/2bc7e117256e1ac969853e12a6ae45021455126e/spec/dummy_rails_root/vendor/assets/fonts/test.eot
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/fonts/test.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Copyright (C) 2015 by original authors @ fontello.com
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/fonts/test.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/railslove/fontello_rails_converter/2bc7e117256e1ac969853e12a6ae45021455126e/spec/dummy_rails_root/vendor/assets/fonts/test.ttf
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/fonts/test.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/railslove/fontello_rails_converter/2bc7e117256e1ac969853e12a6ae45021455126e/spec/dummy_rails_root/vendor/assets/fonts/test.woff
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/stylesheets/animation.css:
--------------------------------------------------------------------------------
1 | /*
2 | Animation example, for spinners
3 | */
4 | .animate-spin {
5 | -moz-animation: spin 2s infinite linear;
6 | -o-animation: spin 2s infinite linear;
7 | -webkit-animation: spin 2s infinite linear;
8 | animation: spin 2s infinite linear;
9 | display: inline-block;
10 | }
11 | @-moz-keyframes spin {
12 | 0% {
13 | -moz-transform: rotate(0deg);
14 | -o-transform: rotate(0deg);
15 | -webkit-transform: rotate(0deg);
16 | transform: rotate(0deg);
17 | }
18 |
19 | 100% {
20 | -moz-transform: rotate(359deg);
21 | -o-transform: rotate(359deg);
22 | -webkit-transform: rotate(359deg);
23 | transform: rotate(359deg);
24 | }
25 | }
26 | @-webkit-keyframes spin {
27 | 0% {
28 | -moz-transform: rotate(0deg);
29 | -o-transform: rotate(0deg);
30 | -webkit-transform: rotate(0deg);
31 | transform: rotate(0deg);
32 | }
33 |
34 | 100% {
35 | -moz-transform: rotate(359deg);
36 | -o-transform: rotate(359deg);
37 | -webkit-transform: rotate(359deg);
38 | transform: rotate(359deg);
39 | }
40 | }
41 | @-o-keyframes spin {
42 | 0% {
43 | -moz-transform: rotate(0deg);
44 | -o-transform: rotate(0deg);
45 | -webkit-transform: rotate(0deg);
46 | transform: rotate(0deg);
47 | }
48 |
49 | 100% {
50 | -moz-transform: rotate(359deg);
51 | -o-transform: rotate(359deg);
52 | -webkit-transform: rotate(359deg);
53 | transform: rotate(359deg);
54 | }
55 | }
56 | @-ms-keyframes spin {
57 | 0% {
58 | -moz-transform: rotate(0deg);
59 | -o-transform: rotate(0deg);
60 | -webkit-transform: rotate(0deg);
61 | transform: rotate(0deg);
62 | }
63 |
64 | 100% {
65 | -moz-transform: rotate(359deg);
66 | -o-transform: rotate(359deg);
67 | -webkit-transform: rotate(359deg);
68 | transform: rotate(359deg);
69 | }
70 | }
71 | @keyframes spin {
72 | 0% {
73 | -moz-transform: rotate(0deg);
74 | -o-transform: rotate(0deg);
75 | -webkit-transform: rotate(0deg);
76 | transform: rotate(0deg);
77 | }
78 |
79 | 100% {
80 | -moz-transform: rotate(359deg);
81 | -o-transform: rotate(359deg);
82 | -webkit-transform: rotate(359deg);
83 | transform: rotate(359deg);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/stylesheets/test-codes.css:
--------------------------------------------------------------------------------
1 |
2 | .icon-glass:before { content: '\e800'; } /* '' */
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/stylesheets/test-embedded.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'test';
3 | src: font-font-url('test.eot?73396368');
4 | src: font-font-url('test.eot?73396368#iefix') format('embedded-opentype'),
5 | font-font-url('test.svg?73396368#test') format('svg');
6 | font-weight: normal;
7 | font-style: normal;
8 | }
9 | @font-face {
10 | font-family: 'test';
11 | src: font-font-url('data:application/octet-stream;base64,d09GRgABAAAAAApUAA4AAAAAElgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABRAAAAEQAAABWPihJMGNtYXAAAAGIAAAAOAAAAUrQERm3Y3Z0IAAAAcAAAAAKAAAACgAAAABmcGdtAAABzAAABZQAAAtwiJCQWWdhc3AAAAdgAAAACAAAAAgAAAAQZ2x5ZgAAB2gAAABsAAAAbJLKmadoZWFkAAAH1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LLA2KyEjICA8sAQjQiM4sSsBFCuwBEMusCsrLbBELLAAFSBHsAAjQrIAAQEVFBMusDEqLbBFLLAAFSBHsAAjQrIAAQEVFBMusDEqLbBGLLEAARQTsDIqLbBHLLA0Ki2wSCywABZFIyAuIEaKI2E4sSsBFCstsEkssAgjQrBIKy2wSiyyAABBKy2wSyyyAAFBKy2wTCyyAQBBKy2wTSyyAQFBKy2wTiyyAABCKy2wTyyyAAFCKy2wUCyyAQBCKy2wUSyyAQFCKy2wUiyyAAA+Ky2wUyyyAAE+Ky2wVCyyAQA+Ky2wVSyyAQE+Ky2wViyyAABAKy2wVyyyAAFAKy2wWCyyAQBAKy2wWSyyAQFAKy2wWiyyAABDKy2wWyyyAAFDKy2wXCyyAQBDKy2wXSyyAQFDKy2wXiyyAAA/Ky2wXyyyAAE/Ky2wYCyyAQA/Ky2wYSyyAQE/Ky2wYiywNysusSsBFCstsGMssDcrsDsrLbBkLLA3K7A8Ky2wZSywABawNyuwPSstsGYssDgrLrErARQrLbBnLLA4K7A7Ky2waCywOCuwPCstsGkssDgrsD0rLbBqLLA5Ky6xKwEUKy2wayywOSuwOystsGwssDkrsDwrLbBtLLA5K7A9Ky2wbiywOisusSsBFCstsG8ssDorsDsrLbBwLLA6K7A8Ky2wcSywOiuwPSstsHIsswkEAgNFWCEbIyFZQiuwCGWwAyRQeLABFTAtAEu4AMhSWLEBAY5ZsAG5CAAIAGNwsQAFQrEAACqxAAVCsQAIKrEABUKxAAgqsQAFQrkAAAAJKrEABUK5AAAACSqxAwBEsSQBiFFYsECIWLEDZESxJgGIUVi6CIAAAQRAiGNUWLEDAERZWVlZsQAMKrgB/4WwBI2xAgBEAA==') format('truetype');
13 | }
14 | /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
15 | /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
16 | /*
17 | @media screen and (-webkit-min-device-pixel-ratio:0) {
18 | @font-face {
19 | font-family: 'test';
20 | src: font-font-url('test.svg?73396368#test') format('svg');
21 | }
22 | }
23 | */
24 |
25 | %icon-base {
26 | font-family: "test";
27 | font-style: normal;
28 | font-weight: normal;
29 | speak: none;
30 |
31 | display: inline-block;
32 | text-decoration: inherit;
33 | width: 1em;
34 | margin-right: .2em;
35 | text-align: center;
36 | /* opacity: .8; */
37 |
38 | /* For safety - reset parent styles, that can break glyph codes*/
39 | font-variant: normal;
40 | text-transform: none;
41 |
42 | /* fix buttons height, for twitter bootstrap */
43 | line-height: 1em;
44 |
45 | /* Animation center compensation - margins should be symmetric */
46 | /* remove if not needed */
47 | margin-left: .2em;
48 |
49 | /* you can be more comfortable with increased icons size */
50 | /* font-size: 120%; */
51 |
52 | /* Uncomment for 3D effect */
53 | /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
54 | }
55 | %icon-glass:before { @extend %icon-base; content: '\e800'; } /* '' */
56 |
57 | .icon-glass { @extend %icon-glass; }
58 |
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/stylesheets/test-ie7-codes.css:
--------------------------------------------------------------------------------
1 |
2 | .icon-glass { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/stylesheets/test-ie7.css:
--------------------------------------------------------------------------------
1 | [class^="icon-"], [class*=" icon-"] {
2 | font-family: 'test';
3 | font-style: normal;
4 | font-weight: normal;
5 |
6 | /* fix buttons height */
7 | line-height: 1em;
8 |
9 | /* you can be more comfortable with increased icons size */
10 | /* font-size: 120%; */
11 | }
12 |
13 | .icon-glass { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
--------------------------------------------------------------------------------
/spec/dummy_rails_root/vendor/assets/stylesheets/test.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'test';
3 | src: font-font-url('test.eot?76076393');
4 | src: font-font-url('test.eot?76076393#iefix') format('embedded-opentype'),
5 | font-font-url('test.woff?76076393') format('woff'),
6 | font-font-url('test.ttf?76076393') format('truetype'),
7 | font-font-url('test.svg?76076393#test') format('svg');
8 | font-weight: normal;
9 | font-style: normal;
10 | }
11 | /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
12 | /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
13 | /*
14 | @media screen and (-webkit-min-device-pixel-ratio:0) {
15 | @font-face {
16 | font-family: 'test';
17 | src: font-font-url('test.svg?76076393#test') format('svg');
18 | }
19 | }
20 | */
21 |
22 | %icon-base {
23 | font-family: "test";
24 | font-style: normal;
25 | font-weight: normal;
26 | speak: none;
27 |
28 | display: inline-block;
29 | text-decoration: inherit;
30 | width: 1em;
31 | margin-right: .2em;
32 | text-align: center;
33 | /* opacity: .8; */
34 |
35 | /* For safety - reset parent styles, that can break glyph codes*/
36 | font-variant: normal;
37 | text-transform: none;
38 |
39 | /* fix buttons height, for twitter bootstrap */
40 | line-height: 1em;
41 |
42 | /* Animation center compensation - margins should be symmetric */
43 | /* remove if not needed */
44 | margin-left: .2em;
45 |
46 | /* you can be more comfortable with increased icons size */
47 | /* font-size: 120%; */
48 |
49 | /* Font smoothing. That was taken from TWBS */
50 | -webkit-font-smoothing: antialiased;
51 | -moz-osx-font-smoothing: grayscale;
52 |
53 | /* Uncomment for 3D effect */
54 | /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
55 | }
56 |
57 | %icon-glass:before { @extend %icon-base; content: '\e800'; } /* '' */
58 |
59 | .icon-glass { @extend %icon-glass; }
60 |
--------------------------------------------------------------------------------
/spec/fixtures/converted/fontello-demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
278 |
279 |
291 |
292 |
293 |
302 |
303 |
304 |
icon-mail-alt 0xe800
305 |
icon-search 0xe801
306 |
icon-star 0xe802
307 |
icon-star-empty 0xe803
308 |
309 |
310 |
icon-star-half 0xe804
311 |
icon-star-half-alt 0xe805
312 |
icon-play 0xe806
313 |
icon-facebook-squared 0xe807
314 |
315 |
316 |
icon-basket 0xe808
317 |
icon-pinterest-squared 0xe809
318 |
icon-up-open-big 0xe80a
319 |
icon-play-circled2 0xe80b
320 |
321 |
322 |
icon-check 0xe80c
323 |
icon-left-open 0xe80d
324 |
icon-right-open 0xe80e
325 |
icon-right-big 0xe80f
326 |
327 |
328 |
icon-twitter-squared 0xe810
329 |
icon-cancel 0xe811
330 |
icon-eye 0xe812
331 |
icon-eye-off 0xe813
332 |
333 |
334 |
icon-female 0xe814
335 |
icon-male 0xe815
336 |
icon-down-dir 0xe816
337 |
icon-comment-empty 0xe817
338 |
339 |
340 |
icon-attach 0xe818
341 |
icon-upload-cloud 0xe819
342 |
icon-heart 0xe81a
343 |
icon-resize-small 0xe81b
344 |
345 |
346 |
icon-menu 0xe81c
347 |
icon-chat-empty 0xe81d
348 |
icon-camera 0xe81e
349 |
icon-cancel-circled 0xe81f
350 |
351 |
352 |
icon-plus 0xe820
353 |
icon-info-circled 0xe821
354 |
icon-heart-empty 0xe822
355 |
icon-download-cloud 0xe823
356 |
357 |
358 |
icon-trash 0xe824
359 |
icon-pencil 0xe825
360 |
icon-ok 0xe826
361 |
icon-left-dir 0xe827
362 |
363 |
364 |
icon-icon_play-01 0xe828
365 |
icon-right-dir 0xe829
366 |
icon-down-open-big 0xe82a
367 |
icon-to-start 0xe82b
368 |
369 |
370 |
icon-to-end 0xe82c
371 |
icon-link 0xe82d
372 |
icon-bleach 0xe82e
373 |
icon-clorine_bleach 0xe82f
374 |
375 |
376 |
icon-dry_clean 0xe830
377 |
icon-dry_flat 0xe831
378 |
icon-extra_gentle_wash_ninety_five_degrees 0xe832
379 |
icon-extra_gentle_wash_fourty_degrees 0xe833
380 |
381 |
382 |
icon-extra_gentle_wash_sixty_degrees 0xe834
383 |
icon-tumble_dry_medium_heat 0xe835
384 |
icon-wash_fourty_degrees 0xe836
385 |
icon-wash_ninety_five_degrees 0xe837
386 |
387 |
388 |
icon-wash_sixty_degrees 0xe838
389 |
icon-wash_thrity_degrees 0xe839
390 |
icon-wet_cleaning 0xe83a
391 |
icon-iron_high_heat 0xe83b
392 |
393 |
394 |
icon-iron_low_heat 0xe83c
395 |
icon-iron_medium_heat 0xe83d
396 |
icon-non_clorine_bleach 0xe83e
397 |
icon-do_not_bleach 0xe83f
398 |
399 |
400 |
icon-do_not_dry_clean 0xe840
401 |
icon-do_not_iron 0xe841
402 |
icon-do_not_tumble_dry 0xe842
403 |
icon-do_not_wash 0xe843
404 |
405 |
406 |
icon-perchloroethylene_solvent 0xe844
407 |
icon-tumble_dry 0xe845
408 |
icon-tumble_dry_high_heat 0xe846
409 |
icon-tumble_dry_low_heat 0xe847
410 |
411 |
412 |
icon-extra_gentle_wash_thrity_degrees 0xe848
413 |
icon-general_dry 0xe849
414 |
icon-gentle_hydrocarbon_solvent 0xe84a
415 |
icon-gentle_perchloroethylene_solvent 0xe84b
416 |
417 |
418 |
icon-gentle_wash_fourty_degrees 0xe84c
419 |
icon-gentle_wash_ninety_five_degrees 0xe84d
420 |
icon-gentle_wash_sixty_degrees 0xe84e
421 |
icon-gentle_wash_thrity_degrees 0xe84f
422 |
423 |
424 |
icon-gentle_wet_cleaning 0xe850
425 |
icon-hand_wash 0xe851
426 |
icon-hydrocarbon_solvent 0xe852
427 |
icon-iron 0xe853
428 |
429 |
430 |
431 |
432 |
--------------------------------------------------------------------------------
/spec/fixtures/empty_name_config.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": ""
3 | }
--------------------------------------------------------------------------------
/spec/fixtures/fontello-demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
278 |
279 |
291 |
292 |
293 |
302 |
303 |
304 |
icon-mail-alt 0xe800
305 |
icon-search 0xe801
306 |
icon-star 0xe802
307 |
icon-star-empty 0xe803
308 |
309 |
310 |
icon-star-half 0xe804
311 |
icon-star-half-alt 0xe805
312 |
icon-play 0xe806
313 |
icon-facebook-squared 0xe807
314 |
315 |
316 |
icon-basket 0xe808
317 |
icon-pinterest-squared 0xe809
318 |
icon-up-open-big 0xe80a
319 |
icon-play-circled2 0xe80b
320 |
321 |
322 |
icon-check 0xe80c
323 |
icon-left-open 0xe80d
324 |
icon-right-open 0xe80e
325 |
icon-right-big 0xe80f
326 |
327 |
328 |
icon-twitter-squared 0xe810
329 |
icon-cancel 0xe811
330 |
icon-eye 0xe812
331 |
icon-eye-off 0xe813
332 |
333 |
334 |
icon-female 0xe814
335 |
icon-male 0xe815
336 |
icon-down-dir 0xe816
337 |
icon-comment-empty 0xe817
338 |
339 |
340 |
icon-attach 0xe818
341 |
icon-upload-cloud 0xe819
342 |
icon-heart 0xe81a
343 |
icon-resize-small 0xe81b
344 |
345 |
346 |
icon-menu 0xe81c
347 |
icon-chat-empty 0xe81d
348 |
icon-camera 0xe81e
349 |
icon-cancel-circled 0xe81f
350 |
351 |
352 |
icon-plus 0xe820
353 |
icon-info-circled 0xe821
354 |
icon-heart-empty 0xe822
355 |
icon-download-cloud 0xe823
356 |
357 |
358 |
icon-trash 0xe824
359 |
icon-pencil 0xe825
360 |
icon-ok 0xe826
361 |
icon-left-dir 0xe827
362 |
363 |
364 |
icon-icon_play-01 0xe828
365 |
icon-right-dir 0xe829
366 |
icon-down-open-big 0xe82a
367 |
icon-to-start 0xe82b
368 |
369 |
370 |
icon-to-end 0xe82c
371 |
icon-link 0xe82d
372 |
icon-bleach 0xe82e
373 |
icon-clorine_bleach 0xe82f
374 |
375 |
376 |
icon-dry_clean 0xe830
377 |
icon-dry_flat 0xe831
378 |
icon-extra_gentle_wash_ninety_five_degrees 0xe832
379 |
icon-extra_gentle_wash_fourty_degrees 0xe833
380 |
381 |
382 |
icon-extra_gentle_wash_sixty_degrees 0xe834
383 |
icon-tumble_dry_medium_heat 0xe835
384 |
icon-wash_fourty_degrees 0xe836
385 |
icon-wash_ninety_five_degrees 0xe837
386 |
387 |
388 |
icon-wash_sixty_degrees 0xe838
389 |
icon-wash_thrity_degrees 0xe839
390 |
icon-wet_cleaning 0xe83a
391 |
icon-iron_high_heat 0xe83b
392 |
393 |
394 |
icon-iron_low_heat 0xe83c
395 |
icon-iron_medium_heat 0xe83d
396 |
icon-non_clorine_bleach 0xe83e
397 |
icon-do_not_bleach 0xe83f
398 |
399 |
400 |
icon-do_not_dry_clean 0xe840
401 |
icon-do_not_iron 0xe841
402 |
icon-do_not_tumble_dry 0xe842
403 |
icon-do_not_wash 0xe843
404 |
405 |
406 |
icon-perchloroethylene_solvent 0xe844
407 |
icon-tumble_dry 0xe845
408 |
icon-tumble_dry_high_heat 0xe846
409 |
icon-tumble_dry_low_heat 0xe847
410 |
411 |
412 |
icon-extra_gentle_wash_thrity_degrees 0xe848
413 |
icon-general_dry 0xe849
414 |
icon-gentle_hydrocarbon_solvent 0xe84a
415 |
icon-gentle_perchloroethylene_solvent 0xe84b
416 |
417 |
418 |
icon-gentle_wash_fourty_degrees 0xe84c
419 |
icon-gentle_wash_ninety_five_degrees 0xe84d
420 |
icon-gentle_wash_sixty_degrees 0xe84e
421 |
icon-gentle_wash_thrity_degrees 0xe84f
422 |
423 |
424 |
icon-gentle_wet_cleaning 0xe850
425 |
icon-hand_wash 0xe851
426 |
icon-hydrocarbon_solvent 0xe852
427 |
icon-iron 0xe853
428 |
429 |
430 |
431 |
432 |
--------------------------------------------------------------------------------
/spec/fixtures/fontello/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Font license info
2 |
3 |
4 | ## Font Awesome
5 |
6 | Copyright (C) 2012 by Dave Gandy
7 |
8 | Author: Dave Gandy
9 | License: SIL ()
10 | Homepage: http://fortawesome.github.com/Font-Awesome/
11 |
12 |
13 |
--------------------------------------------------------------------------------
/spec/fixtures/fontello/README.txt:
--------------------------------------------------------------------------------
1 | This webfont is generated by http://fontello.com open source project.
2 |
3 |
4 | ================================================================================
5 | Please, note, that you should obey original font licences, used to make this
6 | webfont pack. Details available in LICENSE.txt file.
7 |
8 | - Usually, it's enough to publish content of LICENSE.txt file somewhere on your
9 | site in "About" section.
10 |
11 | - If your project is open-source, usually, it will be ok to make LICENSE.txt
12 | file publically available in your repository.
13 |
14 | - Fonts, used in Fontello, don't require a clickable link on your site.
15 | But any kind of additional authors crediting is welcome.
16 | ================================================================================
17 |
18 |
19 | Comments on archive content
20 | ---------------------------
21 |
22 | - /font/* - fonts in different formats
23 |
24 | - /css/* - different kinds of css, for all situations. Should be ok with
25 | twitter bootstrap. Also, you can skip style and assign icon classes
26 | directly to text elements, if you don't mind about IE7.
27 |
28 | - demo.html - demo file, to show your webfont content
29 |
30 | - LICENSE.txt - license info about source fonts, used to build your one.
31 |
32 | - config.json - keeps your settings. You can import it back into fontello
33 | anytime, to continue your work
34 |
35 |
36 | Why so many CSS files ?
37 | -----------------------
38 |
39 | Because we like to fit all your needs :)
40 |
41 | - basic file, .css - is usually enough, it contains @font-face
42 | and character code definitions
43 |
44 | - *-ie7.css - if you need IE7 support, but still don't wish to put char codes
45 | directly into html
46 |
47 | - *-codes.css and *-ie7-codes.css - if you like to use your own @font-face
48 | rules, but still wish to benefit from css generation. That can be very
49 | convenient for automated asset build systems. When you need to update font -
50 | no need to manually edit files, just override old version with archive
51 | content. See fontello source code for examples.
52 |
53 | - *-embedded.css - basic css file, but with embedded WOFF font, to avoid
54 | CORS issues in Firefox and IE9+, when fonts are hosted on the separate domain.
55 | We strongly recommend to resolve this issue by `Access-Control-Allow-Origin`
56 | server headers. But if you ok with dirty hack - this file is for you. Note,
57 | that data url moved to separate @font-face to avoid problems with
2 |
3 |
4 |
278 |
279 |
291 |
292 |
293 |
302 |
303 |
304 |
icon-glass 0xe800
305 |
306 |
307 |
308 |
309 |
--------------------------------------------------------------------------------
/spec/fixtures/fontello/font/test.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/railslove/fontello_rails_converter/2bc7e117256e1ac969853e12a6ae45021455126e/spec/fixtures/fontello/font/test.eot
--------------------------------------------------------------------------------
/spec/fixtures/fontello/font/test.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Copyright (C) 2015 by original authors @ fontello.com
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/spec/fixtures/fontello/font/test.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/railslove/fontello_rails_converter/2bc7e117256e1ac969853e12a6ae45021455126e/spec/fixtures/fontello/font/test.ttf
--------------------------------------------------------------------------------
/spec/fixtures/fontello/font/test.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/railslove/fontello_rails_converter/2bc7e117256e1ac969853e12a6ae45021455126e/spec/fixtures/fontello/font/test.woff
--------------------------------------------------------------------------------
/spec/fixtures/fontello_session_id_changing:
--------------------------------------------------------------------------------
1 | MYID
--------------------------------------------------------------------------------
/spec/fixtures/fontello_session_id_empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/railslove/fontello_rails_converter/2bc7e117256e1ac969853e12a6ae45021455126e/spec/fixtures/fontello_session_id_empty
--------------------------------------------------------------------------------
/spec/fixtures/fontello_session_id_persisted:
--------------------------------------------------------------------------------
1 | MYPERSISTEDSESSION
--------------------------------------------------------------------------------
/spec/fixtures/minimal-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "makerist",
3 | "css_prefix_text": "icon-",
4 | "css_use_suffix": false,
5 | "hinting": true,
6 | "glyphs": [
7 | {
8 | "uid": "9dd9e835aebe1060ba7190ad2b2ed951",
9 | "css": "search",
10 | "code": 59393,
11 | "src": "fontawesome"
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/spec/fontello_api_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe FontelloRailsConverter::FontelloApi do
4 | context 'no persistence' do
5 | subject { described_class.new config_file: File.expand_path('../fixtures/minimal-config.json', __FILE__), fontello_session_id_file: File.expand_path('../fixtures/fontello_session_id_persisted', __FILE__) }
6 |
7 | before do
8 | allow(subject).to receive(:persist_session)
9 | end
10 |
11 | describe '#new_session_from_config' do
12 | before do
13 | expect(RestClient).to receive(:post).and_return 'NEWIDFROMCONFIG'
14 | end
15 |
16 | specify do
17 | expect(subject).to receive(:persist_session)
18 | expect(subject.new_session_from_config).to eql 'NEWIDFROMCONFIG'
19 | end
20 | end
21 |
22 | describe '#session_url' do
23 | before do
24 | expect(subject).to receive(:session_id).and_return "12345"
25 | end
26 |
27 | specify do
28 | expect(subject.session_url).to eql 'https://fontello.com/12345'
29 | end
30 | end
31 |
32 | describe '#download_zip_body' do
33 | before do
34 | subject.new_session_from_config # from config
35 | end
36 | it 'should be a long string with the body of the zip file' do
37 | zip_body = subject.download_zip_body
38 | expect(zip_body).to be_instance_of String
39 | expect(zip_body).to include "makerist.ttf"
40 | end
41 | end
42 |
43 | describe '#session_id' do
44 | context 'session_id NOT set on initialization' do
45 | specify do
46 | expect(subject).to receive(:read_or_create_session).and_return 'foo'
47 | expect(subject.send(:session_id)).to eql 'foo'
48 | end
49 | end
50 |
51 | context 'session_id set on initialization' do
52 | subject { described_class.new fontello_session_id: '0192837465' }
53 |
54 | specify do
55 | expect(subject.send(:session_id)).to eql '0192837465'
56 | end
57 | end
58 | end
59 |
60 | describe '#read_or_create_session' do
61 | context 'read from existing file' do
62 | specify do
63 | expect(subject).not_to receive(:new_session_from_config)
64 | expect(subject.send(:read_or_create_session)).to eql 'MYPERSISTEDSESSION'
65 | end
66 | end
67 |
68 | context 'file does NOT exist' do
69 | before do
70 | subject.instance_variable_set :@fontello_session_id_file, '/does/not/exist'
71 | end
72 |
73 | specify do
74 | expect(subject).to receive(:new_session_from_config).and_return 'NEWSESSION'
75 | expect(subject.send(:read_or_create_session)).to eql 'NEWSESSION'
76 | end
77 | end
78 |
79 | context 'file is empty' do
80 | before do
81 | subject.instance_variable_set :@fontello_session_id_file, File.expand_path('../fixtures/fontello_session_id_empty', __FILE__)
82 | end
83 |
84 | specify do
85 | expect(subject).to receive(:new_session_from_config).and_return 'NEWSESSION'
86 | expect(subject.send(:read_or_create_session)).to eql 'NEWSESSION'
87 | end
88 | end
89 | end
90 | end
91 |
92 | context 'with persistence' do
93 | subject { described_class.new fontello_session_id: 'MYID', fontello_session_id_file: File.expand_path('../fixtures/fontello_session_id_changing', __FILE__) }
94 |
95 | describe '#persist_session' do
96 | specify do
97 | subject.send(:persist_session)
98 | expect(subject.send(:read_or_create_session)).to eql 'MYID'
99 | end
100 | end
101 | end
102 | end
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'bundler/setup'
3 |
4 | require 'fontello_rails_converter'
5 |
6 | RSpec.configure do |config|
7 | config.run_all_when_everything_filtered = true
8 | config.filter_run :focus
9 | config.raise_errors_for_deprecations!
10 |
11 | config.order = 'random'
12 | end
13 |
--------------------------------------------------------------------------------