acbaker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/acbaker/asset_pack.rb +16 -10
- data/lib/acbaker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4812fc0a537d4b5ec3c4f82fee692e6329302940
|
4
|
+
data.tar.gz: 8c72e59d353439629ef45da3d64e4aa030b5f2ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7612ecedd2a2ee2a657049708ce2b53909b8f1c69350a934a91f64546d39a3fd840f70146de6c65cafa28c60ef99b2a3b51ce60f3b82c3cffe5c3d3420edc65a
|
7
|
+
data.tar.gz: b817e65daff69034d4b25156b5b3224e44c7b29710071235dcd1866d57f188efa9e0c4fe7113e636e9f055febe78059a7b9171f2a11c97a5a8b709fe0028d944
|
data/README.md
CHANGED
data/lib/acbaker/asset_pack.rb
CHANGED
@@ -9,7 +9,7 @@ module Acbaker
|
|
9
9
|
if options[:json]
|
10
10
|
@json_data = options[:json]
|
11
11
|
else
|
12
|
-
@json_file = File.join(File.dirname(File.expand_path(__FILE__)), "config", "#{type}.json")
|
12
|
+
@json_file = File.join(File.dirname(File.expand_path(__FILE__)), "config", "#{type.to_s}.json")
|
13
13
|
@json_data = JSON.parse(File.open(@json_file).read)
|
14
14
|
end
|
15
15
|
@images = @json_data['images']
|
@@ -29,14 +29,16 @@ module Acbaker
|
|
29
29
|
@json_data['images'].each_with_index do |image_spec, index|
|
30
30
|
|
31
31
|
# Get size
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
scale = image_spec['scale'].gsub('x', '').to_i
|
33
|
+
if image_spec['size']
|
34
|
+
(width_str, height_str) = image_spec['size'].split('x')
|
35
|
+
width = width_str.to_i * scale
|
36
|
+
height = height_str.to_i * scale
|
37
|
+
size_max = [width, height].max
|
38
|
+
base_width = width / scale
|
39
|
+
base_height = height / scale
|
40
|
+
end
|
41
|
+
|
40
42
|
# Get version
|
41
43
|
if image_spec['minimum-system-version'].nil?
|
42
44
|
version = 'ios56'
|
@@ -79,7 +81,11 @@ module Acbaker
|
|
79
81
|
end
|
80
82
|
|
81
83
|
# Generate image
|
82
|
-
|
84
|
+
if image_spec['size']
|
85
|
+
cmd = "convert #{source_image_file} -resize #{width}x#{height}^ -gravity Center -crop #{width}x#{height}+0+0 +repage #{target_directory}/#{filename}"
|
86
|
+
else
|
87
|
+
cmd = "convert #{source_image_file} -gravity Center +repage #{target_directory}/#{filename}"
|
88
|
+
end
|
83
89
|
system(cmd)
|
84
90
|
|
85
91
|
# Trigger Callback proc
|
data/lib/acbaker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acbaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Strebitzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|