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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0613b8722ee2db7a6f3ca244a28c5d8b349f23f4
4
- data.tar.gz: 8e1e84f5c1ee35544fae92560b36b1c194a74816
3
+ metadata.gz: 67161949887cbc3257f007248dc8eaa50928f34f
4
+ data.tar.gz: 60716edc7d0cb044b53e3ab23c5887a727feb53d
5
5
  SHA512:
6
- metadata.gz: afaf817015540b557dd529199ce71a5b5865553c39a54ca89124169fba0e8e726eba391a48c8e455c6de7929a70ee793e49ce520a92bd2bdf4a821c89c3f040f
7
- data.tar.gz: 76bef96978bb3cb2c6c5e92f00db209c029050d762c6287134806b0eb429e4e221e672749bf38bfbfde7e913e4ef7acd0dab342c74f47c82a0fa67c72a94a9ea
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
@@ -23,5 +23,10 @@ module IconGenerator
23
23
  IconGenerator::FaviconBuilder.new.build(@source, @destination)
24
24
  end
25
25
  end
26
+
27
+ # Builds a single touch icon.
28
+ def build_single
29
+ IconGenerator::TouchBuilder.new.build_single(@source, @destination)
30
+ end
26
31
  end
27
32
  end
@@ -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).build(:touch)
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
  #
@@ -1,3 +1,3 @@
1
1
  module IconGenerator
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  end
@@ -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.9.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-08-20 00:00:00.000000000 Z
11
+ date: 2013-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler