icon_generator 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/icon_generator/builder.rb +5 -0
- data/lib/icon_generator/thor.rb +3 -1
- data/lib/icon_generator/touch_builder.rb +10 -1
- data/lib/icon_generator/version.rb +1 -1
- data/spec/icon_generator_spec.rb +4 -3
- data/spec/icon_generator_thor_spec.rb +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67161949887cbc3257f007248dc8eaa50928f34f
|
4
|
+
data.tar.gz: 60716edc7d0cb044b53e3ab23c5887a727feb53d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 375d4faf8d4006cc0d18b74642449b4de80b47b7551550a8fc2e23a788bbc104c2bf98f5fa19bb18804a45c88ef6e41a2cbebb31685de4bb060b5af404349043
|
7
|
+
data.tar.gz: 99daa2ecf2285690d844e7de9967a77d200653b8c9a04e1e370aa888e3426c8c3f58cda5a042723cdd4bea1580d6c4f69cff90ab71a5fa352ce8c99d63cf20e3
|
data/README.md
CHANGED
@@ -24,6 +24,11 @@ To generate a set of apple-touch-icons:
|
|
24
24
|
|
25
25
|
$ icon_generator touch my/source/file.png my/output/directory
|
26
26
|
|
27
|
+
To generate a single 152x152 apple-touch-icon-precomposed.png:
|
28
|
+
|
29
|
+
$ icon_generator touch my/source/file.png my/output/directory --single
|
30
|
+
|
31
|
+
|
27
32
|
To generate a multiresolution favicon:
|
28
33
|
|
29
34
|
$ icon_generator favicon my/source/file.png my/output/directory
|
data/lib/icon_generator/thor.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module IconGenerator
|
2
2
|
class Thor < Thor
|
3
3
|
desc 'touch', 'Generate apple-touch-icons'
|
4
|
+
option :single
|
4
5
|
def touch(source, destination)
|
5
|
-
IconGenerator::Builder.new(source, destination)
|
6
|
+
builder = IconGenerator::Builder.new(source, destination)
|
7
|
+
options[:single] ? builder.build_single() : builder.build(:touch)
|
6
8
|
end
|
7
9
|
|
8
10
|
desc 'favicon', 'Generate favicon'
|
@@ -5,7 +5,9 @@ module IconGenerator
|
|
5
5
|
# Initializes the default image sizes.
|
6
6
|
def initialize
|
7
7
|
@sizes = [
|
8
|
+
'152x152',
|
8
9
|
'144x144',
|
10
|
+
'120x120',
|
9
11
|
'114x114',
|
10
12
|
'72x72',
|
11
13
|
'57x57',
|
@@ -22,11 +24,18 @@ module IconGenerator
|
|
22
24
|
build_size(source, size, new_image)
|
23
25
|
if size == '57x57'
|
24
26
|
build_size(source, '57x57', "#{destination}/apple-touch-icon-precomposed.png")
|
25
|
-
build_size(source, '57x57', "#{destination}/apple-touch-icon.png")
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
31
|
+
# Builds a single 152x152 apple-touch-icon-precomposed from the
|
32
|
+
# given source file.
|
33
|
+
#
|
34
|
+
# @param source [String] the source image file
|
35
|
+
# @param destination [String] the output directory
|
36
|
+
def build_single(source, destination)
|
37
|
+
build_size(source, '152x152', "#{destination}/apple-touch-icon-precomposed.png")
|
38
|
+
end
|
30
39
|
|
31
40
|
# Builds a given size of apple-touch-icon.
|
32
41
|
#
|
data/spec/icon_generator_spec.rb
CHANGED
@@ -39,9 +39,10 @@ describe IconGenerator do
|
|
39
39
|
stdout = capture_io { builder.build(:touch) }.to_s
|
40
40
|
|
41
41
|
files = [
|
42
|
-
"#{tmp}/apple-touch-icon.png",
|
43
42
|
"#{tmp}/apple-touch-icon-precomposed.png",
|
43
|
+
"#{tmp}/apple-touch-icon-152x152-precomposed.png",
|
44
44
|
"#{tmp}/apple-touch-icon-144x144-precomposed.png",
|
45
|
+
"#{tmp}/apple-touch-icon-120x120-precomposed.png",
|
45
46
|
"#{tmp}/apple-touch-icon-114x114-precomposed.png",
|
46
47
|
"#{tmp}/apple-touch-icon-72x72-precomposed.png",
|
47
48
|
"#{tmp}/apple-touch-icon-57x57-precomposed.png",
|
@@ -60,7 +61,7 @@ describe IconGenerator do
|
|
60
61
|
stdout_favicon = capture_io { builder.build(:favicon) }.to_s
|
61
62
|
stdout_favicon.must_include "Built #{tmp}/favicon.ico"
|
62
63
|
stdout_touch = capture_io { builder.build(:touch) }.to_s
|
63
|
-
stdout_touch.must_include "Built #{tmp}/apple-touch-icon.png"
|
64
|
+
stdout_touch.must_include "Built #{tmp}/apple-touch-icon-precomposed.png"
|
64
65
|
end
|
65
66
|
|
66
67
|
it "works with gifs as a source file" do
|
@@ -70,6 +71,6 @@ describe IconGenerator do
|
|
70
71
|
stdout_favicon = capture_io { builder.build(:favicon) }.to_s
|
71
72
|
stdout_favicon.must_include "Built #{tmp}/favicon.ico"
|
72
73
|
stdout_touch = capture_io { builder.build(:touch) }.to_s
|
73
|
-
stdout_touch.must_include "Built #{tmp}/apple-touch-icon.png"
|
74
|
+
stdout_touch.must_include "Built #{tmp}/apple-touch-icon-precomposed.png"
|
74
75
|
end
|
75
76
|
end
|
@@ -14,7 +14,14 @@ describe IconGenerator::Thor do
|
|
14
14
|
tempfile = Tempfile.new ['test', '.png']
|
15
15
|
%x[convert -size 1x1 canvas:khaki #{tempfile.path}]
|
16
16
|
stdout = %x[bundle exec bin/icon_generator touch #{tempfile.path} #{tmp}]
|
17
|
-
stdout.must_include "Built #{tmp}/apple-touch-icon.png"
|
17
|
+
stdout.must_include "Built #{tmp}/apple-touch-icon-precomposed.png"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "can generate a single apple-touch-icon-precomposed" do
|
21
|
+
tempfile = Tempfile.new ['test', '.png']
|
22
|
+
%x[convert -size 1x1 canvas:khaki #{tempfile.path}]
|
23
|
+
stdout = %x[bundle exec bin/icon_generator touch #{tempfile.path} #{tmp} --single]
|
24
|
+
stdout.must_equal "\e[32mBuilt #{tmp}/apple-touch-icon-precomposed.png\e[0m\n"
|
18
25
|
end
|
19
26
|
|
20
27
|
it "can take both favicon and touch commands at once" do
|
@@ -24,7 +31,7 @@ describe IconGenerator::Thor do
|
|
24
31
|
%x[convert -size 1x1 canvas:khaki #{favicon.path}]
|
25
32
|
stdout = %x[bundle exec bin/icon_generator generate --touch #{touch.path} --favicon #{favicon.path} #{tmp}]
|
26
33
|
stdout.must_include "Built #{tmp}/favicon.ico"
|
27
|
-
stdout.must_include "Built #{tmp}/apple-touch-icon.png"
|
34
|
+
stdout.must_include "Built #{tmp}/apple-touch-icon-precomposed.png"
|
28
35
|
end
|
29
36
|
|
30
37
|
it "can build either touch or favicon alone from generate" do
|
@@ -33,7 +40,7 @@ describe IconGenerator::Thor do
|
|
33
40
|
%x[convert -size 1x1 canvas:khaki #{touch.path}]
|
34
41
|
%x[convert -size 1x1 canvas:khaki #{favicon.path}]
|
35
42
|
stdout = %x[bundle exec bin/icon_generator generate --touch #{touch.path} #{tmp}]
|
36
|
-
stdout.must_include "Built #{tmp}/apple-touch-icon.png"
|
43
|
+
stdout.must_include "Built #{tmp}/apple-touch-icon-precomposed.png"
|
37
44
|
stdout = %x[bundle exec bin/icon_generator generate --favicon #{favicon.path} #{tmp}]
|
38
45
|
stdout.must_include "Built #{tmp}/favicon.ico"
|
39
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icon_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Bowen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|