airservice_build_tools 0.0.8 → 0.0.9
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/Gemfile.lock +1 -1
- data/lib/airservice/build_tools/android.rb +34 -0
- data/lib/airservice/build_tools/obj_c.rb +1 -0
- data/lib/airservice/build_tools/version.rb +1 -1
- data/spec/airservice/build_tools/android_spec.rb +34 -0
- data/spec/airservice/build_tools/obj_c_spec.rb +8 -8
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e46f405f5b0a3e35562125c040495430bdf74da8
|
4
|
+
data.tar.gz: 7035448d5613b28d73b6a9077ac89ec4caaf9c2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 919ea72adc876f27f8d401d7df92b682ff0f1cb62779f0b502ac7b387cc256f0d8c165956d32549c1209042252336ecd97064f91b6b6842b85b74902da4c1a0c
|
7
|
+
data.tar.gz: 871076b4965f2f15740094fb538e8bf2db46dc178e2ffdc08cff9740b1f6c6670749871380f6a2868d30abe8d7c9c16390f0c6b6a0e4f3c7a33848e12deddf84
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'airservice/build_tools'
|
2
|
+
|
3
|
+
module AirService
|
4
|
+
module BuildTools
|
5
|
+
module Android
|
6
|
+
include Logger
|
7
|
+
def create_android_icons(options={})
|
8
|
+
sizes = [
|
9
|
+
{size: 36, folder: 'drawable'},
|
10
|
+
{size: 36, folder: 'drawable-ldpi'},
|
11
|
+
{size: 48, folder: 'drawable-mdpi'},
|
12
|
+
{size: 72, folder: 'drawable-hdpi'},
|
13
|
+
{size: 96, folder: 'drawable-xhdpi'}
|
14
|
+
]
|
15
|
+
source = options.fetch(:source)
|
16
|
+
raise "Source file #{source} doesn't exists" unless File.exists?(source)
|
17
|
+
output_dir = options.fetch(:output_dir)
|
18
|
+
FileUtils.mkdir_p(output_dir)
|
19
|
+
|
20
|
+
sizes.each do |size|
|
21
|
+
folder_path = File.join(output_dir, size[:folder])
|
22
|
+
FileUtils.mkdir_p(folder_path)
|
23
|
+
|
24
|
+
target_size = "#{size[:size]}x#{size[:size]}"
|
25
|
+
output_file = "icon.png"
|
26
|
+
args = %W[#{File.expand_path(source, '.')}
|
27
|
+
-resize #{target_size}
|
28
|
+
#{File.join(output_dir, size[:folder], output_file)}]
|
29
|
+
system('convert', *args)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -29,6 +29,7 @@ module AirService
|
|
29
29
|
{size: 60, name: 'iphone', scale: [2]},
|
30
30
|
{size: 40, name: 'iphone_spotlight', scale: [2]},
|
31
31
|
{size: 29, name: 'iphone_settings', scale: [2]},
|
32
|
+
{size: 512, name: 'iTunesArtwork', scale: [2]},
|
32
33
|
]
|
33
34
|
source = options.fetch(:source)
|
34
35
|
raise "Source file #{source} doesn't exists" unless File.exists?(source)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'airservice/build_tools/android'
|
3
|
+
|
4
|
+
describe AirService::BuildTools::Android do
|
5
|
+
include described_class
|
6
|
+
|
7
|
+
describe '#create_android_icons' do
|
8
|
+
before do
|
9
|
+
FileUtils.rmtree('/tmp/icons/android')
|
10
|
+
end
|
11
|
+
it 'throws exception if it source file is not found' do
|
12
|
+
expect { create_android_icons(source: 'spec/fixtures/does_not_exist.png', output_dir: '/tmp/icons/android') }.to raise_error do |error|
|
13
|
+
expect(error.message).to include('source file')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
it 'creates images of desired sizes' do
|
17
|
+
create_android_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/android')
|
18
|
+
icons = Dir['/tmp/icons/android/**/*.png'].map do |file|
|
19
|
+
`identify #{file}`
|
20
|
+
end.join(' ')
|
21
|
+
icons.should include('36x36', '48x48', '72x72', '96x96')
|
22
|
+
end
|
23
|
+
it 'creates images with correct names' do
|
24
|
+
create_android_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/android')
|
25
|
+
icons = Dir['/tmp/icons/android/**/*.png'].join(' ')
|
26
|
+
icons.should include('icon.png')
|
27
|
+
end
|
28
|
+
it 'creates the correct folder names' do
|
29
|
+
create_android_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/android')
|
30
|
+
folder = Dir['/tmp/icons/android/*'].join(' ')
|
31
|
+
folder.should include('drawable', 'drawable-ldpi', 'drawable-mdpi', 'drawable-hdpi', 'drawable-xhdpi')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -64,30 +64,30 @@ describe AirService::BuildTools::ObjC do
|
|
64
64
|
|
65
65
|
describe '#create_ios_icons' do
|
66
66
|
before do
|
67
|
-
FileUtils.rmtree('/tmp/icons')
|
67
|
+
FileUtils.rmtree('/tmp/icons/ios')
|
68
68
|
end
|
69
69
|
it 'throws exception if it source file is not found' do
|
70
|
-
expect { create_ios_icons(source: 'spec/fixtures/does_not_exist.png', output_dir: '/tmp/icons') }.to raise_error do |error|
|
70
|
+
expect { create_ios_icons(source: 'spec/fixtures/does_not_exist.png', output_dir: '/tmp/icons/ios') }.to raise_error do |error|
|
71
71
|
expect(error.message).to include('source file')
|
72
72
|
end
|
73
73
|
end
|
74
74
|
it 'creates images of non retina sizes' do
|
75
|
-
create_ios_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/')
|
76
|
-
icons = Dir['/tmp/icons/*.png'].map do |file|
|
75
|
+
create_ios_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/ios')
|
76
|
+
icons = Dir['/tmp/icons/ios/*.png'].map do |file|
|
77
77
|
`identify #{file}`
|
78
78
|
end.join(' ')
|
79
79
|
icons.should include('76x76', '40x40', '29x29')
|
80
80
|
end
|
81
81
|
it 'creates images of retina sizes when specified' do
|
82
|
-
create_ios_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/')
|
83
|
-
icons = Dir['/tmp/icons/*.png'].map do |file|
|
82
|
+
create_ios_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/ios/')
|
83
|
+
icons = Dir['/tmp/icons/ios/*.png'].map do |file|
|
84
84
|
`identify #{file}`
|
85
85
|
end.join(' ')
|
86
86
|
icons.should include('152x152', '80x80', '58x58')
|
87
87
|
end
|
88
88
|
it 'creates images with correct names for ipad' do
|
89
|
-
create_ios_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/')
|
90
|
-
icons = Dir['/tmp/icons/*.png'].join(' ')
|
89
|
+
create_ios_icons(source: 'spec/fixtures/test_image.png', output_dir: '/tmp/icons/ios/')
|
90
|
+
icons = Dir['/tmp/icons/ios/*.png'].join(' ')
|
91
91
|
icons.should include('ipad@2x.png', 'ipad@1x.png')
|
92
92
|
end
|
93
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airservice_build_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AirService
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plist
|
@@ -124,8 +124,10 @@ files:
|
|
124
124
|
- README.md
|
125
125
|
- airservice_build_tools.gemspec
|
126
126
|
- lib/airservice/build_tools.rb
|
127
|
+
- lib/airservice/build_tools/android.rb
|
127
128
|
- lib/airservice/build_tools/obj_c.rb
|
128
129
|
- lib/airservice/build_tools/version.rb
|
130
|
+
- spec/airservice/build_tools/android_spec.rb
|
129
131
|
- spec/airservice/build_tools/obj_c_spec.rb
|
130
132
|
- spec/fixtures/test_image.png
|
131
133
|
- spec/spec_helper.rb
|
@@ -154,6 +156,7 @@ signing_key:
|
|
154
156
|
specification_version: 4
|
155
157
|
summary: Build toolls
|
156
158
|
test_files:
|
159
|
+
- spec/airservice/build_tools/android_spec.rb
|
157
160
|
- spec/airservice/build_tools/obj_c_spec.rb
|
158
161
|
- spec/fixtures/test_image.png
|
159
162
|
- spec/spec_helper.rb
|