ffavicon 0.1.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 +7 -0
- data/.gitignore +11 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/config/browserconfig.xml +12 -0
- data/config/manifest.json +41 -0
- data/ffavicon.gemspec +26 -0
- data/lib/ffavicon/config.rb +8 -0
- data/lib/ffavicon/railtie.rb +11 -0
- data/lib/ffavicon/tasks.rake +47 -0
- data/lib/ffavicon/version.rb +3 -0
- data/lib/ffavicon/view_helpers.rb +24 -0
- data/lib/ffavicon.rb +4 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fbd188e00110aefb75102d74b3fa24b398c81b77
|
4
|
+
data.tar.gz: 14cc3ce59b216670eefe294cae51609a32a25e81
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e288264a41d763912a449cddd32ced02c5c8a4e5ee50ec5d82d7a60572e8a102f2eb17d9b5ec1ddff50700818b8dda514362d2a148af6a91532fe76a09b4d8f1
|
7
|
+
data.tar.gz: d372844d2a429c9ea72ecae3f16e41ad464e4df4bac5aed340410c1bdc551edbd93b713b2fe45c30c052c1849299c4968dab4fd7a1f60874dab17d9ea3cc2920
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 telray
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# FFavicon Maker for Rails
|
2
|
+
Gem adds a rake task for generating favicons for all major browsers and platforms and add helper for adding all favicons to layout.
|
3
|
+
Use of the [FaviconMaker](https://github.com/follmann/favicon_maker) library.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
Add the following line to your Gemfile:
|
8
|
+
|
9
|
+
gem 'ffavicon'
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
1. Create your PNG favicon* in app/assets/images/favicon.png.
|
14
|
+
2. Type `rake ffavicon` in your terminal.
|
15
|
+
3. Your generated favicons will be output into your public directory.
|
16
|
+
4. Change 'name' in public/manifest.json in your app name
|
17
|
+
5. Add helper from your layout
|
18
|
+
``` ruby
|
19
|
+
<%= ffavicon_tags %>
|
20
|
+
```
|
21
|
+
6. You can add params
|
22
|
+
``` ruby
|
23
|
+
<%= ffavicon_tags ms_color: '#00aba9', theme_color: '#ffffff' %>
|
24
|
+
```
|
25
|
+
ms_color - color background for [Windows 8 - Tile](http://realfavicongenerator.net/faq#windows_8_tile_colors),
|
26
|
+
|
27
|
+
theme_color - color of the task bar in the [switcher Android Chrome](https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android).
|
28
|
+
|
29
|
+
*`I recommend to use the size of 260x260 for optimal results`
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
34
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<browserconfig>
|
3
|
+
<msapplication>
|
4
|
+
<tile>
|
5
|
+
<square70x70logo src="/mstile-70x70.png"/>
|
6
|
+
<square150x150logo src="/mstile-150x150.png"/>
|
7
|
+
<square310x310logo src="/mstile-310x310.png"/>
|
8
|
+
<wide310x150logo src="/mstile-310x150.png"/>
|
9
|
+
<TileColor>#da532c</TileColor>
|
10
|
+
</tile>
|
11
|
+
</msapplication>
|
12
|
+
</browserconfig>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"name": "My app",
|
3
|
+
"icons": [
|
4
|
+
{
|
5
|
+
"src": "\/android-chrome-36x36.png",
|
6
|
+
"sizes": "36x36",
|
7
|
+
"type": "image\/png",
|
8
|
+
"density": "0.75"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"src": "\/android-chrome-48x48.png",
|
12
|
+
"sizes": "48x48",
|
13
|
+
"type": "image\/png",
|
14
|
+
"density": "1.0"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"src": "\/android-chrome-72x72.png",
|
18
|
+
"sizes": "72x72",
|
19
|
+
"type": "image\/png",
|
20
|
+
"density": "1.5"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"src": "\/android-chrome-96x96.png",
|
24
|
+
"sizes": "96x96",
|
25
|
+
"type": "image\/png",
|
26
|
+
"density": "2.0"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"src": "\/android-chrome-144x144.png",
|
30
|
+
"sizes": "144x144",
|
31
|
+
"type": "image\/png",
|
32
|
+
"density": "3.0"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"src": "\/android-chrome-192x192.png",
|
36
|
+
"sizes": "192x192",
|
37
|
+
"type": "image\/png",
|
38
|
+
"density": "4.0"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
data/ffavicon.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ffavicon/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ffavicon"
|
8
|
+
spec.version = FFavicon::VERSION
|
9
|
+
spec.authors = ["telray"]
|
10
|
+
spec.email = ["telrayru@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Generate the favicon for all major browsers and platforms}
|
13
|
+
spec.description = %q{Generate the favicon for all major browsers and platforms}
|
14
|
+
spec.homepage = "https://github.com/telray/ffavicon"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
|
25
|
+
spec.add_dependency("favicon_maker", "= 1.3")
|
26
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'favicon_maker'
|
2
|
+
|
3
|
+
namespace :ffavicon do
|
4
|
+
task :generate do
|
5
|
+
FaviconMaker.generate do
|
6
|
+
setup do
|
7
|
+
template_dir Rails.root.join('app', 'assets', 'images')
|
8
|
+
output_dir Rails.root.join('public')
|
9
|
+
end
|
10
|
+
|
11
|
+
sizes = FFavicon::SIZES
|
12
|
+
|
13
|
+
from 'favicon.png' do
|
14
|
+
icon 'apple-touch-icon-precomposed.png', size: '180x180' #Обрезанные края 180x180
|
15
|
+
|
16
|
+
sizes[:apple].each do |s|
|
17
|
+
icon "apple-touch-icon-#{s}.png"
|
18
|
+
end
|
19
|
+
sizes[:favicon].each do |s|
|
20
|
+
icon "favicon-#{s}.png"
|
21
|
+
end
|
22
|
+
sizes[:android].each do |s|
|
23
|
+
icon "android-chrome-#{s}.png"
|
24
|
+
end
|
25
|
+
sizes[:mstile].each do |s|
|
26
|
+
icon "mstile-#{s}.png"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
each_icon do |filepath|
|
31
|
+
puts filepath # verbose example
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
%w(browserconfig.xml manifest.json).each do |f|
|
37
|
+
source = File.join(Gem.loaded_specs["ffavicon"].full_gem_path, "config", f)
|
38
|
+
target = File.join(Rails.root, "public", f)
|
39
|
+
FileUtils.cp_r source, target
|
40
|
+
puts target
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Generate favicons from single favicon.png source and generate config files'
|
47
|
+
task :ffavicon => 'ffavicon:generate'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module FFavicon
|
2
|
+
module ViewHelpers
|
3
|
+
def ffavicon_tags(ms_color: "#00aba9", theme_color: "#ffffff")
|
4
|
+
sizes = FFavicon::SIZES
|
5
|
+
tags = []
|
6
|
+
|
7
|
+
tags << sizes[:apple].collect do |s|
|
8
|
+
favicon_link_tag("/apple-touch-icon-#{s}.png", size: s, rel: "apple-touch-icon")
|
9
|
+
end
|
10
|
+
|
11
|
+
tags << sizes[:favicon].collect do |s|
|
12
|
+
favicon_link_tag("/favicon-#{s}.png", size: s, rel: "icon", type: "image/png")
|
13
|
+
end
|
14
|
+
|
15
|
+
tags << favicon_link_tag("/android-chrome-192x192.png", size: "192x192", rel: "icon", type: "image/png")
|
16
|
+
tags << favicon_link_tag("/manifest.json", rel: "manifest")
|
17
|
+
tags << tag(:meta, name: "msapplication-TileColor", content: ms_color)
|
18
|
+
tags << tag(:meta, name: "msapplication-TileImage", content: "/mstile-144x144.png")
|
19
|
+
tags << tag(:meta, name: "theme-color", content: theme_color)
|
20
|
+
|
21
|
+
tags.join.html_safe
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/ffavicon.rb
ADDED
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ffavicon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- telray
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: favicon_maker
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
description: Generate the favicon for all major browsers and platforms
|
56
|
+
email:
|
57
|
+
- telrayru@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- config/browserconfig.xml
|
68
|
+
- config/manifest.json
|
69
|
+
- ffavicon.gemspec
|
70
|
+
- lib/ffavicon.rb
|
71
|
+
- lib/ffavicon/config.rb
|
72
|
+
- lib/ffavicon/railtie.rb
|
73
|
+
- lib/ffavicon/tasks.rake
|
74
|
+
- lib/ffavicon/version.rb
|
75
|
+
- lib/ffavicon/view_helpers.rb
|
76
|
+
homepage: https://github.com/telray/ffavicon
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.4.8
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Generate the favicon for all major browsers and platforms
|
100
|
+
test_files: []
|