icon_generator 0.8.1 → 0.9.0
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.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/icon_generator/thor.rb +8 -0
- data/lib/icon_generator/version.rb +1 -1
- data/spec/icon_generator_thor_spec.rb +40 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0613b8722ee2db7a6f3ca244a28c5d8b349f23f4
|
4
|
+
data.tar.gz: 8e1e84f5c1ee35544fae92560b36b1c194a74816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afaf817015540b557dd529199ce71a5b5865553c39a54ca89124169fba0e8e726eba391a48c8e455c6de7929a70ee793e49ce520a92bd2bdf4a821c89c3f040f
|
7
|
+
data.tar.gz: 76bef96978bb3cb2c6c5e92f00db209c029050d762c6287134806b0eb429e4e221e672749bf38bfbfde7e913e4ef7acd0dab342c74f47c82a0fa67c72a94a9ea
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
[](http://badge.fury.io/rb/icon_generator)
|
4
4
|
[](https://codeclimate.com/github/adamnbowen/icon_generator)
|
5
5
|
[](https://travis-ci.org/adamnbowen/icon_generator)
|
6
|
+
[](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
|
data/lib/icon_generator/thor.rb
CHANGED
@@ -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
|
@@ -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
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.
|
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:
|