icon_generator 0.8.1 → 0.9.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: 6fd55e81501e3d69f09714856de6621e390954b3
4
- data.tar.gz: c1d2a7023ad65497252f5bc861c4e8191ad44654
3
+ metadata.gz: 0613b8722ee2db7a6f3ca244a28c5d8b349f23f4
4
+ data.tar.gz: 8e1e84f5c1ee35544fae92560b36b1c194a74816
5
5
  SHA512:
6
- metadata.gz: 93256fb28455b40d33c82a130fc0443472eaf1eedc3202465329c57ed51e3819191d55791887949f9e6e7f7e2e06ea55cf0b3ba206dc5dfa7e412017f2a76ac6
7
- data.tar.gz: 2a5bd66d56b478f46460491370bb28bea1735dc962beb7f5c188f4df776c147720fc03e12bd19ffd544d61a523f2b2a51086d49b176a28d9858dd76706e87af5
6
+ metadata.gz: afaf817015540b557dd529199ce71a5b5865553c39a54ca89124169fba0e8e726eba391a48c8e455c6de7929a70ee793e49ce520a92bd2bdf4a821c89c3f040f
7
+ data.tar.gz: 76bef96978bb3cb2c6c5e92f00db209c029050d762c6287134806b0eb429e4e221e672749bf38bfbfde7e913e4ef7acd0dab342c74f47c82a0fa67c72a94a9ea
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/icon_generator.png)](http://badge.fury.io/rb/icon_generator)
4
4
  [![Code Climate](https://codeclimate.com/github/adamnbowen/icon_generator.png)](https://codeclimate.com/github/adamnbowen/icon_generator)
5
5
  [![Build Status](https://travis-ci.org/adamnbowen/icon_generator.png)](https://travis-ci.org/adamnbowen/icon_generator)
6
+ [![Dependency Status](https://gemnasium.com/adamnbowen/icon_generator.png)](https://gemnasium.com/adamnbowen/icon_generator)
6
7
 
7
8
  Generates Apple Touch Icons or a multiresolution (32x32 and 16x16)
8
9
  favicon given a square image.
@@ -19,8 +20,23 @@ favicon given a square image.
19
20
 
20
21
  ## Usage
21
22
 
23
+ To generate a set of apple-touch-icons:
24
+
22
25
  $ icon_generator touch my/source/file.png my/output/directory
23
26
 
27
+ To generate a multiresolution favicon:
28
+
29
+ $ icon_generator favicon my/source/file.png my/output/directory
30
+
31
+ To generate both at once:
32
+
33
+ $ icon_generator generate --favicon my/source/favicon.png --touch my/source/touch.png my/output/directory
34
+
35
+ The generic `generate` task will work whether both `--favicon` and
36
+ `--touch` are present or not:
37
+
38
+ $ icon_generator generate --favicon my/source/favicon.png my/output/directory
39
+
24
40
  ## Testing
25
41
 
26
42
  $ rake test
@@ -9,5 +9,13 @@ module IconGenerator
9
9
  def favicon(source, destination)
10
10
  IconGenerator::Builder.new(source, destination).build(:favicon)
11
11
  end
12
+
13
+ desc 'generate', 'Generate both a favicon and a touch icon'
14
+ option :touch
15
+ option :favicon
16
+ def generate(destination)
17
+ favicon(options[:favicon], destination) if options[:favicon]
18
+ touch(options[:touch], destination) if options[:touch]
19
+ end
12
20
  end
13
21
  end
@@ -1,3 +1,3 @@
1
1
  module IconGenerator
2
- VERSION = "0.8.1"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe IconGenerator::Thor do
4
+ let (:tmp) { Dir.tmpdir }
5
+
6
+ it "generates a favicon" do
7
+ tempfile = Tempfile.new ['test', '.png']
8
+ %x[convert -size 1x1 canvas:khaki #{tempfile.path}]
9
+ stdout = %x[bundle exec bin/icon_generator favicon #{tempfile.path} #{tmp}]
10
+ stdout.must_include "Built #{tmp}/favicon.ico"
11
+ end
12
+
13
+ it "generates apple-touch-icons" do
14
+ tempfile = Tempfile.new ['test', '.png']
15
+ %x[convert -size 1x1 canvas:khaki #{tempfile.path}]
16
+ stdout = %x[bundle exec bin/icon_generator touch #{tempfile.path} #{tmp}]
17
+ stdout.must_include "Built #{tmp}/apple-touch-icon.png"
18
+ end
19
+
20
+ it "can take both favicon and touch commands at once" do
21
+ touch = Tempfile.new ['touch', '.png']
22
+ favicon = Tempfile.new ['favicon', '.png']
23
+ %x[convert -size 1x1 canvas:khaki #{touch.path}]
24
+ %x[convert -size 1x1 canvas:khaki #{favicon.path}]
25
+ stdout = %x[bundle exec bin/icon_generator generate --touch #{touch.path} --favicon #{favicon.path} #{tmp}]
26
+ stdout.must_include "Built #{tmp}/favicon.ico"
27
+ stdout.must_include "Built #{tmp}/apple-touch-icon.png"
28
+ end
29
+
30
+ it "can build either touch or favicon alone from generate" do
31
+ touch = Tempfile.new ['touch', '.png']
32
+ favicon = Tempfile.new ['favicon', '.png']
33
+ %x[convert -size 1x1 canvas:khaki #{touch.path}]
34
+ %x[convert -size 1x1 canvas:khaki #{favicon.path}]
35
+ stdout = %x[bundle exec bin/icon_generator generate --touch #{touch.path} #{tmp}]
36
+ stdout.must_include "Built #{tmp}/apple-touch-icon.png"
37
+ stdout = %x[bundle exec bin/icon_generator generate --favicon #{favicon.path} #{tmp}]
38
+ stdout.must_include "Built #{tmp}/favicon.ico"
39
+ end
40
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'minitest/pride'
1
2
  require 'minitest/spec'
2
3
  require 'minitest/autorun'
3
4
  require 'thor'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icon_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Bowen
@@ -77,6 +77,7 @@ files:
77
77
  - lib/icon_generator/validator.rb
78
78
  - lib/icon_generator/version.rb
79
79
  - spec/icon_generator_spec.rb
80
+ - spec/icon_generator_thor_spec.rb
80
81
  - spec/spec_helper.rb
81
82
  homepage: ''
82
83
  licenses:
@@ -105,5 +106,6 @@ specification_version: 4
105
106
  summary: Make apple-touch-icons and favicon.ico files
106
107
  test_files:
107
108
  - spec/icon_generator_spec.rb
109
+ - spec/icon_generator_thor_spec.rb
108
110
  - spec/spec_helper.rb
109
111
  has_rdoc: