appicon_generate 0.1.1 → 0.1.2
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/.travis.yml +0 -1
- data/README.md +3 -3
- data/appicon_generate.gemspec +3 -4
- data/bin/appicon_generate +2 -2
- data/lib/appicon_generate/version.rb +1 -1
- data/lib/appicon_generate.rb +38 -32
- data/spec/appicon_generate_spec.rb +34 -52
- data/spec/spec_helper.rb +3 -3
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b613832f44a75b2d4445e5bab7ad67c33e2ab55
|
4
|
+
data.tar.gz: 8773135da4faad06f28335335770cdfc5b1ae028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dae1e7937f07230a7936ab896ff8c3aa3bf3124c22b793b235984fc32effcbcef562fd1868c6cce8bacdafb6a4ce4284d947813b983b16ec12d3366efa66f7be
|
7
|
+
data.tar.gz: 1c0476f2c5e8da1a35d7a41108b089de5094efdbe45fefadc7a279e278ee7a57764c9e1108f0891207d4c287b2534d5a5270d45798dbf40b946dc3acdd4bb576
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
[](https://coveralls.io/r/midnightSuyama/appicon_generate)
|
7
7
|
[](https://codeclimate.com/github/midnightSuyama/appicon_generate)
|
8
8
|
|
9
|
-
Generate icon
|
9
|
+
Generate icon for iOS, Android
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -28,8 +28,8 @@ Or install it yourself as:
|
|
28
28
|
|
29
29
|
### Options
|
30
30
|
|
31
|
-
* `-i`, `--ios` Generate icon
|
32
|
-
* `-a`, `--android` Generate icon
|
31
|
+
* `-i`, `--ios` Generate icon for iOS
|
32
|
+
* `-a`, `--android` Generate icon for Android
|
33
33
|
|
34
34
|
## Contributing
|
35
35
|
|
data/appicon_generate.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = AppiconGenerate::VERSION
|
9
9
|
spec.authors = ["midnightSuyama"]
|
10
10
|
spec.email = ["midnightSuyama@gmail.com"]
|
11
|
-
spec.summary = "Generate icon
|
12
|
-
spec.description = "Generate icon
|
11
|
+
spec.summary = "Generate icon for iOS, Android"
|
12
|
+
spec.description = "Generate icon for iOS, Android"
|
13
13
|
spec.homepage = "https://github.com/midnightSuyama/appicon_generate"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -21,9 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.5"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
|
-
spec.add_development_dependency "image_size"
|
25
24
|
spec.add_development_dependency "coveralls"
|
26
|
-
spec.add_development_dependency "
|
25
|
+
spec.add_development_dependency "image_size"
|
27
26
|
|
28
27
|
spec.add_runtime_dependency "rmagick"
|
29
28
|
end
|
data/bin/appicon_generate
CHANGED
@@ -8,8 +8,8 @@ options = {}
|
|
8
8
|
OptionParser.new do |opt|
|
9
9
|
Version = AppiconGenerate::VERSION
|
10
10
|
opt.banner = "Usage: #{File.basename($0)} [file] [options]"
|
11
|
-
opt.on('-i', '--ios', 'Generate icon
|
12
|
-
opt.on('-a', '--android', 'Generate icon
|
11
|
+
opt.on('-i', '--ios', 'Generate icon for iOS') {|v| options[:ios] = v }
|
12
|
+
opt.on('-a', '--android', 'Generate icon for Android') {|v| options[:android] = v }
|
13
13
|
opt.parse!
|
14
14
|
|
15
15
|
if ARGV.empty?
|
data/lib/appicon_generate.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'fileutils'
|
3
2
|
require 'RMagick'
|
4
3
|
|
@@ -15,7 +14,7 @@ module AppiconGenerate
|
|
15
14
|
img = Magick::Image.read(file).first
|
16
15
|
icons.each do |icon|
|
17
16
|
path = "#{DEST_PATH}/#{icon.path}"
|
18
|
-
FileUtils.mkdir_p
|
17
|
+
FileUtils.mkdir_p File.dirname(path)
|
19
18
|
img.resize(icon.px, icon.px).write(path)
|
20
19
|
end
|
21
20
|
img.destroy!
|
@@ -24,41 +23,48 @@ module AppiconGenerate
|
|
24
23
|
private
|
25
24
|
|
26
25
|
def icons_ios
|
27
|
-
|
26
|
+
icons = []
|
28
27
|
[
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
]
|
28
|
+
['Icon.png', 57],
|
29
|
+
['Icon@2x.png', 114],
|
30
|
+
['Icon-60.png', 60],
|
31
|
+
['Icon-60@2x.png', 120],
|
32
|
+
['Icon-60@3x.png', 180],
|
33
|
+
['Icon-72.png', 72],
|
34
|
+
['Icon-72@2x.png', 144],
|
35
|
+
['Icon-76.png', 76],
|
36
|
+
['Icon-76@2x.png', 152],
|
37
|
+
['Icon-Small.png', 29],
|
38
|
+
['Icon-Small@2x.png', 58],
|
39
|
+
['Icon-Small@3x.png', 87],
|
40
|
+
['Icon-Small-50.png', 50],
|
41
|
+
['Icon-Small-50@2x.png', 100],
|
42
|
+
['Icon-40.png', 40],
|
43
|
+
['Icon-40@2x.png', 80],
|
44
|
+
['Icon-40@3x.png', 120],
|
45
|
+
['iTunesArtwork.png', 512],
|
46
|
+
['iTunesArtwork@2x.png', 1024],
|
47
|
+
].each do |path, px|
|
48
|
+
icons << Icon.new("ios/#{path}", px)
|
49
|
+
end
|
50
|
+
icons
|
49
51
|
end
|
50
52
|
|
51
53
|
def icons_android
|
52
|
-
|
54
|
+
icons = []
|
53
55
|
[
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
]
|
56
|
+
['drawable-ldpi/ic_launcher.png', 36],
|
57
|
+
['drawable-mdpi/ic_launcher.png', 48],
|
58
|
+
['drawable-hdpi/ic_launcher.png', 72],
|
59
|
+
['drawable-xhdpi/ic_launcher.png', 96],
|
60
|
+
['drawable-xxhdpi/ic_launcher.png', 144],
|
61
|
+
['drawable-xxxhdpi/ic_launcher.png', 192],
|
62
|
+
['store.png', 512],
|
63
|
+
].each do |path, px|
|
64
|
+
icons << Icon.new("android/#{path}", px)
|
65
|
+
end
|
66
|
+
icons
|
62
67
|
end
|
68
|
+
|
63
69
|
end
|
64
70
|
end
|
@@ -1,26 +1,48 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
3
|
require 'spec_helper'
|
5
4
|
require 'fileutils'
|
6
5
|
require 'image_size'
|
7
6
|
|
7
|
+
shared_context 'icon' do |path, px|
|
8
|
+
before :all do
|
9
|
+
@image_size = ImageSize.path(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should exist' do
|
13
|
+
expect(File.exists? path).to be true
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'format should be png' do
|
17
|
+
expect(@image_size.format).to eq :png
|
18
|
+
end
|
19
|
+
|
20
|
+
it "width should be #{px}px" do
|
21
|
+
expect(@image_size.width).to eq px
|
22
|
+
end
|
23
|
+
|
24
|
+
it "height should be #{px}px" do
|
25
|
+
expect(@image_size.height).to eq px
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
8
29
|
describe AppiconGenerate do
|
9
30
|
before :all do
|
10
|
-
Dir.mkdir
|
11
|
-
Dir.chdir
|
31
|
+
Dir.mkdir 'tmp' unless File.exists? 'tmp'
|
32
|
+
Dir.chdir 'tmp'
|
33
|
+
end
|
34
|
+
|
35
|
+
after :all do
|
36
|
+
Dir.chdir '..'
|
37
|
+
FileUtils.rm_r 'tmp'
|
12
38
|
end
|
13
39
|
|
14
40
|
# iOS
|
15
|
-
context 'when generate icon
|
16
|
-
before
|
41
|
+
context 'when generate icon for iOS' do
|
42
|
+
before :all do
|
17
43
|
AppiconGenerate.run("#{File.dirname(__FILE__)}/fixtures/source.png", {:ios => true})
|
18
44
|
end
|
19
45
|
|
20
|
-
after(:all) do
|
21
|
-
FileUtils.rm_r(AppiconGenerate::DEST_PATH)
|
22
|
-
end
|
23
|
-
|
24
46
|
[
|
25
47
|
['Icon.png', 57],
|
26
48
|
['Icon@2x.png', 114],
|
@@ -45,39 +67,17 @@ describe AppiconGenerate do
|
|
45
67
|
path = "#{AppiconGenerate::DEST_PATH}/ios/#{path}"
|
46
68
|
|
47
69
|
context "'#{path}'" do
|
48
|
-
|
49
|
-
@image_size = ImageSize.path(path)
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should exist' do
|
53
|
-
File.exists?(path).should be_true
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'format should be png' do
|
57
|
-
@image_size.format.should eq :png
|
58
|
-
end
|
59
|
-
|
60
|
-
it "width should be #{px}px" do
|
61
|
-
@image_size.width.should eq px
|
62
|
-
end
|
63
|
-
|
64
|
-
it "height should be #{px}px" do
|
65
|
-
@image_size.height.should eq px
|
66
|
-
end
|
70
|
+
include_context 'icon', [path, px]
|
67
71
|
end
|
68
72
|
end
|
69
73
|
end
|
70
74
|
|
71
75
|
# Android
|
72
76
|
context 'when generate icon of Android' do
|
73
|
-
before
|
77
|
+
before :all do
|
74
78
|
AppiconGenerate.run("#{File.dirname(__FILE__)}/fixtures/source.png", {:android => true})
|
75
79
|
end
|
76
80
|
|
77
|
-
after(:all) do
|
78
|
-
FileUtils.rm_r(AppiconGenerate::DEST_PATH)
|
79
|
-
end
|
80
|
-
|
81
81
|
[
|
82
82
|
['drawable-ldpi/ic_launcher.png', 36],
|
83
83
|
['drawable-mdpi/ic_launcher.png', 48],
|
@@ -90,25 +90,7 @@ describe AppiconGenerate do
|
|
90
90
|
path = "#{AppiconGenerate::DEST_PATH}/android/#{path}"
|
91
91
|
|
92
92
|
context "'#{path}'" do
|
93
|
-
|
94
|
-
@image_size = ImageSize.path(path)
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'should exist' do
|
98
|
-
File.exists?(path).should be_true
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'format should be png' do
|
102
|
-
@image_size.format.should eq :png
|
103
|
-
end
|
104
|
-
|
105
|
-
it "width should be #{px}px" do
|
106
|
-
@image_size.width.should eq px
|
107
|
-
end
|
108
|
-
|
109
|
-
it "height should be #{px}px" do
|
110
|
-
@image_size.height.should eq px
|
111
|
-
end
|
93
|
+
include_context 'icon', [path, px]
|
112
94
|
end
|
113
95
|
end
|
114
96
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appicon_generate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- midnightSuyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: image_size
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: mime-types
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.25'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.25'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: rmagick
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +94,7 @@ dependencies:
|
|
108
94
|
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
|
-
description: Generate icon
|
97
|
+
description: Generate icon for iOS, Android
|
112
98
|
email:
|
113
99
|
- midnightSuyama@gmail.com
|
114
100
|
executables:
|
@@ -154,7 +140,7 @@ rubyforge_project:
|
|
154
140
|
rubygems_version: 2.2.2
|
155
141
|
signing_key:
|
156
142
|
specification_version: 4
|
157
|
-
summary: Generate icon
|
143
|
+
summary: Generate icon for iOS, Android
|
158
144
|
test_files:
|
159
145
|
- spec/appicon_generate_spec.rb
|
160
146
|
- spec/fixtures/source.png
|