favicon_maker 0.0.7 → 0.0.8
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.
- data/README.md +7 -7
- data/lib/favicon_maker/generator.rb +10 -9
- data/lib/favicon_maker/version.rb +1 -1
- data/spec/favicon_maker_spec.rb +9 -9
- metadata +17 -7
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
FaviconMaker [](http://travis-ci.org/[follmann]/[favicon_maker])
|
2
2
|
============
|
3
3
|
|
4
|
-
Tired of creating a gazillion different favicons to satisfy all kinds of devices and resolutions in different file formats?
|
4
|
+
Tired of creating a gazillion different favicons to satisfy all kinds of devices and resolutions in different file formats?
|
5
5
|
|
6
6
|
I know I was, so I created FaviconMaker to ease the tedious process of creating multiple versions of your favicon.
|
7
7
|
|
@@ -47,13 +47,13 @@ In order to integrate the FaviconMaker effortless into your [Middleman](https://
|
|
47
47
|
### Simple
|
48
48
|
require "rubygems"
|
49
49
|
require "favicon_maker"
|
50
|
-
|
50
|
+
|
51
51
|
FaviconMaker::Generator.create_versions
|
52
52
|
|
53
53
|
Uses the following defaults:
|
54
54
|
|
55
55
|
options = {
|
56
|
-
:versions => [:apple_114, :apple_72, :apple_57, :apple_pre, :apple, :fav_png, :fav_ico],
|
56
|
+
:versions => [:apple_144, :apple_114, :apple_72, :apple_57, :apple_pre, :apple, :fav_png, :fav_ico],
|
57
57
|
:custom_versions => {},
|
58
58
|
:root_dir => File.dirname(__FILE__),
|
59
59
|
:input_dir => "favicons",
|
@@ -62,11 +62,11 @@ Uses the following defaults:
|
|
62
62
|
:copy => false
|
63
63
|
}
|
64
64
|
|
65
|
-
### Advanced
|
65
|
+
### Advanced
|
66
66
|
(untested attempted Rails integration, using all available options. Could be used in a Rake task or Capistrano recipe)
|
67
67
|
|
68
68
|
options = {
|
69
|
-
:versions => [:apple_114, :apple_57, :apple, :fav_png, :fav_ico],
|
69
|
+
:versions => [:apple_144, :apple_114, :apple_57, :apple, :fav_png, :fav_ico],
|
70
70
|
:custom_versions => {:apple_extreme_retina => {:filename => "apple-touch-icon-228x228-precomposed.png", :dimensions => "228x228", :format => "png"}},
|
71
71
|
:root_dir => Rails.root,
|
72
72
|
:input_dir => File.join("app", "assets", "public"),
|
@@ -74,11 +74,11 @@ Uses the following defaults:
|
|
74
74
|
:output_dir => "public",
|
75
75
|
:copy => true
|
76
76
|
}
|
77
|
-
|
77
|
+
|
78
78
|
FaviconMaker::Generator.create_versions(options) do |filepath|
|
79
79
|
puts "Created favicon: #{filepath}"
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
## Base Image Guideline
|
83
83
|
Choose the version with the biggest dimension as your base image. Currently the size 114x114 for newer iOS devices marks the upper limit. So just create a PNG with 24 or 32 Bit color depth and 114x114 document size. Downscaling of images always works better than upscaling.
|
84
84
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module FaviconMaker
|
2
2
|
require "mini_magick"
|
3
3
|
require 'fileutils'
|
4
|
-
|
4
|
+
|
5
5
|
class Generator
|
6
|
-
|
6
|
+
|
7
7
|
ICON_VERSIONS = {
|
8
|
+
:apple_144 => {:filename => "apple-touch-icon-144x144-precomposed.png", :dimensions => "144x144", :format => "png"},
|
8
9
|
:apple_114 => {:filename => "apple-touch-icon-114x114-precomposed.png", :dimensions => "114x114", :format => "png"},
|
9
10
|
:apple_72 => {:filename => "apple-touch-icon-72x72-precomposed.png", :dimensions => "72x72", :format => "png"},
|
10
11
|
:apple_57 => {:filename => "apple-touch-icon-57x57-precomposed.png", :dimensions => "57x57", :format => "png"},
|
@@ -13,9 +14,9 @@ module FaviconMaker
|
|
13
14
|
:fav_png => {:filename => "favicon.png", :dimensions => "16x16", :format => "png"},
|
14
15
|
:fav_ico => {:filename => "favicon.ico", :dimensions => "16x16", :format => "ico"}
|
15
16
|
}
|
16
|
-
|
17
|
+
|
17
18
|
class << self
|
18
|
-
|
19
|
+
|
19
20
|
def create_versions(options={}, &block)
|
20
21
|
options = {
|
21
22
|
:versions => ICON_VERSIONS.keys,
|
@@ -26,17 +27,17 @@ module FaviconMaker
|
|
26
27
|
:output_dir => "favicons_output",
|
27
28
|
:copy => false
|
28
29
|
}.merge(options)
|
29
|
-
|
30
|
+
|
30
31
|
raise ArgumentError unless options[:versions].is_a? Array
|
31
32
|
base_path = File.join(options[:root_dir], options[:input_dir])
|
32
33
|
input_path = File.join(base_path, options[:base_image])
|
33
|
-
|
34
|
+
|
34
35
|
icon_versions = ICON_VERSIONS.merge(options[:custom_versions])
|
35
36
|
(options[:versions] + options[:custom_versions].keys).uniq.each do |version|
|
36
37
|
version = icon_versions[version]
|
37
38
|
composed_path = File.join(base_path, version[:filename])
|
38
39
|
output_path = File.join(options[:root_dir], options[:output_dir], version[:filename])
|
39
|
-
|
40
|
+
|
40
41
|
created = false
|
41
42
|
# check for self composed icon file
|
42
43
|
if File.exist?(composed_path)
|
@@ -51,13 +52,13 @@ module FaviconMaker
|
|
51
52
|
image.write output_path
|
52
53
|
created = true
|
53
54
|
end
|
54
|
-
|
55
|
+
|
55
56
|
if block_given? && created
|
56
57
|
yield output_path
|
57
58
|
end
|
58
59
|
end
|
59
60
|
end
|
60
|
-
|
61
|
+
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
data/spec/favicon_maker_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
describe FaviconMaker, '#create_versions' do
|
3
|
-
|
3
|
+
|
4
4
|
before(:all) do
|
5
5
|
@versions = []
|
6
6
|
options = {
|
7
|
-
:versions => [:apple_114, :apple_57, :apple, :fav_png, :fav_ico],
|
7
|
+
:versions => [:apple_144, :apple_114, :apple_57, :apple, :fav_png, :fav_ico],
|
8
8
|
:custom_versions => {:apple_extreme_retina => {:filename => "apple-touch-icon-228x228-precomposed.png", :dimensions => "228x228", :format => "png"}},
|
9
9
|
:root_dir => File.join(Dir.pwd, "spec"),
|
10
10
|
:input_dir => "support",
|
@@ -12,25 +12,25 @@ describe FaviconMaker, '#create_versions' do
|
|
12
12
|
:output_dir => "generated",
|
13
13
|
:copy => true
|
14
14
|
}
|
15
|
-
|
15
|
+
|
16
16
|
@generated_dir = File.join(options[:root_dir], options[:output_dir])
|
17
17
|
Dir.mkdir(@generated_dir)
|
18
|
-
|
18
|
+
|
19
19
|
FaviconMaker::Generator.create_versions(options) do |filepath|
|
20
20
|
@versions << filepath
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
it "creates
|
25
|
-
@versions.size.should eql(
|
23
|
+
|
24
|
+
it "creates 7 different versions" do
|
25
|
+
@versions.size.should eql(7)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "creates
|
28
|
+
it "creates 7 files" do
|
29
29
|
@versions.each do |file|
|
30
30
|
File.exists?(file).should be_true
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
after(:all) do
|
35
35
|
@versions.each do |file|
|
36
36
|
File.delete(file)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: favicon_maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mini_magick
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: 2.6.0
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.6.0
|
36
46
|
description: Create favicon files in various sizes from a base image
|
37
47
|
email:
|
38
48
|
executables: []
|
@@ -72,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
82
|
version: '0'
|
73
83
|
requirements: []
|
74
84
|
rubyforge_project:
|
75
|
-
rubygems_version: 1.8.
|
85
|
+
rubygems_version: 1.8.23
|
76
86
|
signing_key:
|
77
87
|
specification_version: 3
|
78
88
|
summary: Create favicon files in various sizes from a base image
|