acbaker 0.0.2 → 0.0.3

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: 1b759222db16f3af1eb44448d91812d76ab1c69e
4
- data.tar.gz: b691dcb923103b569450d709f5b1503f3673d73f
3
+ metadata.gz: 4812fc0a537d4b5ec3c4f82fee692e6329302940
4
+ data.tar.gz: 8c72e59d353439629ef45da3d64e4aa030b5f2ac
5
5
  SHA512:
6
- metadata.gz: 1f70abd07c2e3c19e00069530294820fb0ccb2ed1b7bf871ff0aaac7377fcebeffc64a7b7fe986ce942ce27e165e135c6fc10c703f9829d31d2a67f7dae268aa
7
- data.tar.gz: 99e29709f2decbe047e2b345812e244b4c60f283f0ec4dd901413959ec22f136fb5467e3d3b8ac33b8ef28a1131e1570f993a9c7c5362440bd3b607f4d087d9b
6
+ metadata.gz: 7612ecedd2a2ee2a657049708ce2b53909b8f1c69350a934a91f64546d39a3fd840f70146de6c65cafa28c60ef99b2a3b51ce60f3b82c3cffe5c3d3420edc65a
7
+ data.tar.gz: b817e65daff69034d4b25156b5b3224e44c7b29710071235dcd1866d57f188efa9e0c4fe7113e636e9f055febe78059a7b9171f2a11c97a5a8b709fe0028d944
data/README.md CHANGED
@@ -20,6 +20,9 @@ USAGE
20
20
  CHANGELOG
21
21
  ---------
22
22
 
23
+ * **0.0.3**
24
+ * Allow json config without fixed size
25
+
23
26
  * **0.0.2**
24
27
  * Fix convert results
25
28
 
@@ -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
- (width_str, height_str) = image_spec['size'].split('x')
33
- scale = image_spec['scale'].gsub('x', '').to_i
34
- width = width_str.to_i * scale
35
- height = height_str.to_i * scale
36
- size_max = [width, height].max
37
- base_width = width / scale
38
- base_height = height / scale
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
- cmd = "convert #{source_image_file} -resize #{width}x#{height}^ -gravity Center -crop #{width}x#{height}+0+0 +repage #{target_directory}/#{filename}"
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
@@ -1,3 +1,3 @@
1
1
  module Acbaker
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-15 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander