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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9afe1f7f6a12c2b8fbb8b9cdd2342260273425e6
4
- data.tar.gz: 8d398b186c528f63efd0a7b8c43e93e01432e09d
3
+ metadata.gz: 0b613832f44a75b2d4445e5bab7ad67c33e2ab55
4
+ data.tar.gz: 8773135da4faad06f28335335770cdfc5b1ae028
5
5
  SHA512:
6
- metadata.gz: 3ff60afecb09755a46e2749cd5d5d80a7104c541c23f87118f11b255b2143df5c27c596c7a4f5171524fd6e04a7244fac86b4eebe83498701b624f9ce686d169
7
- data.tar.gz: 18670a05cd9ff78feaf5486be22f3bd035e3fb8d0483edfb9402f74699c8ba2d20294c5ef7a7a5165848797517ba63667d04e21742d7ce4450d9f6b10b3eac66
6
+ metadata.gz: dae1e7937f07230a7936ab896ff8c3aa3bf3124c22b793b235984fc32effcbcef562fd1868c6cce8bacdafb6a4ce4284d947813b983b16ec12d3366efa66f7be
7
+ data.tar.gz: 1c0476f2c5e8da1a35d7a41108b089de5094efdbe45fefadc7a279e278ee7a57764c9e1108f0891207d4c287b2534d5a5270d45798dbf40b946dc3acdd4bb576
data/.travis.yml CHANGED
@@ -4,4 +4,3 @@ rvm:
4
4
  - 2.0.0
5
5
  - 1.9.3
6
6
  - 1.9.2
7
- - 1.8.7
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Coverage Status](https://coveralls.io/repos/midnightSuyama/appicon_generate/badge.png)](https://coveralls.io/r/midnightSuyama/appicon_generate)
7
7
  [![Code Climate](https://codeclimate.com/github/midnightSuyama/appicon_generate.png)](https://codeclimate.com/github/midnightSuyama/appicon_generate)
8
8
 
9
- Generate icon of iOS, Android
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 of iOS
32
- * `-a`, `--android` Generate icon of Android
31
+ * `-i`, `--ios` Generate icon for iOS
32
+ * `-a`, `--android` Generate icon for Android
33
33
 
34
34
  ## Contributing
35
35
 
@@ -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 of iOS, Android"
12
- spec.description = "Generate icon of iOS, Android"
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 "mime-types", "~> 1.25"
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 of iOS') {|v| options[:ios] = v }
12
- opt.on('-a', '--android', 'Generate icon of Android') {|v| options[:android] = v }
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?
@@ -1,3 +1,3 @@
1
1
  module AppiconGenerate
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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(File.dirname(path))
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
- path = 'ios'
26
+ icons = []
28
27
  [
29
- Icon.new("#{path}/Icon.png", 57),
30
- Icon.new("#{path}/Icon@2x.png", 114),
31
- Icon.new("#{path}/Icon-60.png", 60),
32
- Icon.new("#{path}/Icon-60@2x.png", 120),
33
- Icon.new("#{path}/Icon-60@3x.png", 180),
34
- Icon.new("#{path}/Icon-72.png", 72),
35
- Icon.new("#{path}/Icon-72@2x.png", 144),
36
- Icon.new("#{path}/Icon-76.png", 76),
37
- Icon.new("#{path}/Icon-76@2x.png", 152),
38
- Icon.new("#{path}/Icon-Small.png", 29),
39
- Icon.new("#{path}/Icon-Small@2x.png", 58),
40
- Icon.new("#{path}/Icon-Small@3x.png", 87),
41
- Icon.new("#{path}/Icon-Small-50.png", 50),
42
- Icon.new("#{path}/Icon-Small-50@2x.png", 100),
43
- Icon.new("#{path}/Icon-40.png", 40),
44
- Icon.new("#{path}/Icon-40@2x.png", 80),
45
- Icon.new("#{path}/Icon-40@3x.png", 120),
46
- Icon.new("#{path}/iTunesArtwork.png", 512),
47
- Icon.new("#{path}/iTunesArtwork@2x.png", 1024),
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
- path = 'android'
54
+ icons = []
53
55
  [
54
- Icon.new("#{path}/drawable-ldpi/ic_launcher.png", 36),
55
- Icon.new("#{path}/drawable-mdpi/ic_launcher.png", 48),
56
- Icon.new("#{path}/drawable-hdpi/ic_launcher.png", 72),
57
- Icon.new("#{path}/drawable-xhdpi/ic_launcher.png", 96),
58
- Icon.new("#{path}/drawable-xxhdpi/ic_launcher.png", 144),
59
- Icon.new("#{path}/drawable-xxxhdpi/ic_launcher.png", 192),
60
- Icon.new("#{path}/store.png", 512),
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('tmp') unless File.exists?('tmp')
11
- Dir.chdir('tmp')
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 of iOS' do
16
- before(:all) do
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
- before(:all) do
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(:all) do
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
- before(:all) do
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
@@ -1,5 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'appicon_generate'
3
+
2
4
  require 'coveralls'
3
5
  Coveralls.wear!
4
-
5
- Dir["#{File.dirname(__FILE__)}/../lib/**/*.rb"].each {|f| require f}
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.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-09-21 00:00:00.000000000 Z
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: image_size
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: coveralls
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 of iOS, Android
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 of iOS, Android
143
+ summary: Generate icon for iOS, Android
158
144
  test_files:
159
145
  - spec/appicon_generate_spec.rb
160
146
  - spec/fixtures/source.png