favicon_maker 1.3 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/favicon_maker.rb +4 -4
- data/lib/favicon_maker/commands/base_command.rb +32 -0
- data/lib/favicon_maker/commands/ico_command.rb +28 -0
- data/lib/favicon_maker/commands/png_command.rb +21 -0
- data/lib/favicon_maker/creator.rb +3 -3
- data/lib/favicon_maker/version.rb +1 -1
- metadata +5 -5
- data/lib/favicon_maker/base_command.rb +0 -30
- data/lib/favicon_maker/ico_command.rb +0 -25
- data/lib/favicon_maker/png_command.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5425fa11731c03a11f38496fe910d7a2480defd7
|
4
|
+
data.tar.gz: f57af314852b7b0d2615a887ecf02e688e4e391b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13b08c0ae6e4c5cced0dbe271087ac7c43bda4dcd75dc65ca3d895d0f19fb3dc471ffcfe4c617714c9be4d86ed712cf7d23b5dc0273141a1d997ae1affcd9c18
|
7
|
+
data.tar.gz: 64879750eaadd6ea7a381e564ae5482b21e3ea64b41f3e7e5ceb87ba89553688ce0d2212a71d05913c1eb897f40d6c878417b7b1df5e3dd7a89e62d610d0ce3c
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
FaviconMaker
|
2
|
-
|
1
|
+
# FaviconMaker
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/favicon_maker.svg)](http://badge.fury.io/rb/favicon_maker)
|
3
|
+
[![Build Status](https://secure.travis-ci.org/follmann/favicon_maker.png)](http://travis-ci.org/follmann/favicon_maker) [![Code Climate](https://codeclimate.com/github/follmann/favicon_maker.png)](https://codeclimate.com/github/follmann/favicon_maker)
|
3
4
|
|
4
5
|
Tired of creating a gazillion different favicons to satisfy all kinds of devices and resolutions in different file formats?
|
5
6
|
|
@@ -68,7 +69,7 @@ end
|
|
68
69
|
In order to integrate the FaviconMaker effortless into your [Middleman](https://github.com/tdreyno/middleman) project use the following gem: [middleman-favicon-maker](https://github.com/follmann/middleman-favicon-maker) with version v3.5 or higher
|
69
70
|
|
70
71
|
## Template Image Guideline
|
71
|
-
Choose the version with the biggest dimension as your base image. Currently the size 152x152 for newer iOS devices marks the upper limit. So just create a PNG with 24 or 32 Bit color depth and 152x152 document size. Downscaling of images always works better than upscaling. Use more than one template file to improve lower resolutions.
|
72
|
+
Choose the version with the biggest dimension as your base image. Currently the size 152x152 for newer iOS devices marks the upper limit. So just create a PNG with 24 or 32 Bit color depth and 152x152 document size or a vector image SVG (since v1.2). Downscaling of images always works better than upscaling. Use more than one template file to improve lower resolutions.
|
72
73
|
|
73
74
|
## Contributing
|
74
75
|
1. Fork it
|
data/lib/favicon_maker.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "favicon_maker/maker_config"
|
2
|
+
require "favicon_maker/input_validator"
|
2
3
|
require "favicon_maker/generator"
|
3
4
|
require "favicon_maker/creator"
|
4
|
-
require "favicon_maker/base_command"
|
5
|
-
require "favicon_maker/ico_command"
|
6
|
-
require "favicon_maker/png_command"
|
7
|
-
require "favicon_maker/input_validator"
|
5
|
+
require "favicon_maker/commands/base_command"
|
6
|
+
require "favicon_maker/commands/ico_command"
|
7
|
+
require "favicon_maker/commands/png_command"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module FaviconMaker
|
2
|
+
module BaseCommand
|
3
|
+
|
4
|
+
def compose(template_file_path, output_file_path, convert_settings, options, format, &block)
|
5
|
+
ico_cmd = [ "convert -background none #{options}".strip ]
|
6
|
+
ico_cmd += [ "\"#{template_file_path}\" #{options_to_args(convert_settings)}" ]
|
7
|
+
ico_cmd += yield([]) if block_given?
|
8
|
+
ico_cmd += [ " #{format}:\"#{output_file_path}\"" ]
|
9
|
+
@command = ico_cmd.join(' ')
|
10
|
+
end
|
11
|
+
|
12
|
+
def options_to_args(options)
|
13
|
+
return nil if options.nil?
|
14
|
+
options.map { |k,v|
|
15
|
+
if [ :xc, :null ].include?(k)
|
16
|
+
"#{k}:#{v}"
|
17
|
+
else
|
18
|
+
"-#{k} #{v}".strip
|
19
|
+
end
|
20
|
+
}.join(' ')
|
21
|
+
end
|
22
|
+
|
23
|
+
def on_windows?
|
24
|
+
(RbConfig::CONFIG['host_os'].match /mswin|mingw|cygwin/)
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_s
|
28
|
+
@command
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module FaviconMaker
|
2
|
+
class IcoCommand
|
3
|
+
|
4
|
+
include BaseCommand
|
5
|
+
|
6
|
+
def initialize(template_file_path, output_file_path, size, options)
|
7
|
+
|
8
|
+
convert_settings = [
|
9
|
+
[ :quiet, nil ],
|
10
|
+
]
|
11
|
+
|
12
|
+
center_settings = [
|
13
|
+
[ :gravity, "center" ],
|
14
|
+
[ :background, "none" ],
|
15
|
+
]
|
16
|
+
|
17
|
+
compose(template_file_path, output_file_path, convert_settings, options, :ico) do |ico_cmd|
|
18
|
+
escapes = "\\" unless on_windows?
|
19
|
+
size.split(',').sort_by{|s| s.split('x')[0].to_i}.each do |s|
|
20
|
+
ico_cmd += [ "#{escapes}( -clone 0 -resize #{s} #{options_to_args(center_settings)} -extent #{s} #{escapes})" ]
|
21
|
+
end
|
22
|
+
ico_cmd += [ "-delete 0" ]
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module FaviconMaker
|
2
|
+
class PngCommand
|
3
|
+
|
4
|
+
include BaseCommand
|
5
|
+
|
6
|
+
def initialize(template_file_path, output_file_path, size, options)
|
7
|
+
|
8
|
+
convert_settings = [
|
9
|
+
[ :define, "png:include-chunk=none,trns,gama" ],
|
10
|
+
[ :format, "png" ],
|
11
|
+
[ :resize, size ],
|
12
|
+
[ :gravity, "center" ],
|
13
|
+
[ :background, "none" ],
|
14
|
+
[ :extent, size ],
|
15
|
+
]
|
16
|
+
|
17
|
+
compose(template_file_path, output_file_path, convert_settings, options, :png)
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -20,7 +20,7 @@ module FaviconMaker
|
|
20
20
|
im_version = fetch_image_magick_version
|
21
21
|
|
22
22
|
if im_version
|
23
|
-
print_image_magick_ancient_version_warning
|
23
|
+
print_image_magick_ancient_version_warning(im_version) if im_version < RECENT_IM_VERSION
|
24
24
|
else
|
25
25
|
print_image_magick_no_version_warning
|
26
26
|
end
|
@@ -78,8 +78,8 @@ module FaviconMaker
|
|
78
78
|
end.to_s
|
79
79
|
end
|
80
80
|
|
81
|
-
def print_image_magick_ancient_version_warning
|
82
|
-
puts "FaviconMaker: WARNING! Your installed ImageMagick version #{
|
81
|
+
def print_image_magick_ancient_version_warning(im_version)
|
82
|
+
puts "FaviconMaker: WARNING! Your installed ImageMagick version #{im_version} is not up-to-date and might produce suboptimal output!"
|
83
83
|
end
|
84
84
|
|
85
85
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: favicon_maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Follmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docile
|
@@ -75,13 +75,13 @@ files:
|
|
75
75
|
- README.md
|
76
76
|
- favicon_maker.gemspec
|
77
77
|
- lib/favicon_maker.rb
|
78
|
-
- lib/favicon_maker/base_command.rb
|
78
|
+
- lib/favicon_maker/commands/base_command.rb
|
79
|
+
- lib/favicon_maker/commands/ico_command.rb
|
80
|
+
- lib/favicon_maker/commands/png_command.rb
|
79
81
|
- lib/favicon_maker/creator.rb
|
80
82
|
- lib/favicon_maker/generator.rb
|
81
|
-
- lib/favicon_maker/ico_command.rb
|
82
83
|
- lib/favicon_maker/input_validator.rb
|
83
84
|
- lib/favicon_maker/maker_config.rb
|
84
|
-
- lib/favicon_maker/png_command.rb
|
85
85
|
- lib/favicon_maker/version.rb
|
86
86
|
- spec/favicon_maker_spec.rb
|
87
87
|
- spec/input_validator_spec.rb
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module BaseCommand
|
2
|
-
|
3
|
-
def run_convert(template_file_path, output_file_path, convert_settings, options, format, &block)
|
4
|
-
ico_cmd = [ "convert -background none #{options}".strip ]
|
5
|
-
ico_cmd += [ "\"#{template_file_path}\" #{options_to_args(convert_settings)}" ]
|
6
|
-
ico_cmd += yield([]) if block_given?
|
7
|
-
ico_cmd += [ " #{format}:\"#{output_file_path}\"" ]
|
8
|
-
@command = ico_cmd.join(' ')
|
9
|
-
end
|
10
|
-
|
11
|
-
def options_to_args(options)
|
12
|
-
return nil if options.nil?
|
13
|
-
options.map { |k,v|
|
14
|
-
if [ :xc, :null ].include?(k)
|
15
|
-
"#{k}:#{v}"
|
16
|
-
else
|
17
|
-
"-#{k} #{v}".strip
|
18
|
-
end
|
19
|
-
}.join(' ')
|
20
|
-
end
|
21
|
-
|
22
|
-
def on_windows?
|
23
|
-
(RbConfig::CONFIG['host_os'].match /mswin|mingw|cygwin/)
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_s
|
27
|
-
@command
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class IcoCommand
|
2
|
-
|
3
|
-
include ::BaseCommand
|
4
|
-
|
5
|
-
def initialize(template_file_path, output_file_path, size, options)
|
6
|
-
|
7
|
-
convert_settings = [
|
8
|
-
[ :quiet, nil ],
|
9
|
-
]
|
10
|
-
|
11
|
-
center_settings = [
|
12
|
-
[ :gravity, "center" ],
|
13
|
-
[ :background, "none" ],
|
14
|
-
]
|
15
|
-
|
16
|
-
run_convert(template_file_path, output_file_path, convert_settings, options, :ico) do |ico_cmd|
|
17
|
-
escapes = "\\" unless on_windows?
|
18
|
-
size.split(',').sort_by{|s| s.split('x')[0].to_i}.each do |s|
|
19
|
-
ico_cmd += [ "#{escapes}( -clone 0 -resize #{s} #{options_to_args(center_settings)} -extent #{s} #{escapes})" ]
|
20
|
-
end
|
21
|
-
ico_cmd += [ "-delete 0" ]
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class PngCommand
|
2
|
-
|
3
|
-
include ::BaseCommand
|
4
|
-
|
5
|
-
def initialize(template_file_path, output_file_path, size, options)
|
6
|
-
|
7
|
-
convert_settings = [
|
8
|
-
[ :define, "png:include-chunk=none,trns,gama" ],
|
9
|
-
[ :format, "png" ],
|
10
|
-
[ :resize, size ],
|
11
|
-
[ :gravity, "center" ],
|
12
|
-
[ :background, "none" ],
|
13
|
-
[ :extent, size ],
|
14
|
-
]
|
15
|
-
|
16
|
-
run_convert(template_file_path, output_file_path, convert_settings, options, :png)
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|