acbaker 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7b02ac721b50e1e19bbf92a6d1fcc16ce4b2eee
4
- data.tar.gz: 931376cc55d92bad8d5963f0f93809ab8b34c5b2
3
+ metadata.gz: 2addf8779a1ba8dda726042891ff5ed78ff92ead
4
+ data.tar.gz: 82fc094482817ceff0be7435718e2f45f54de2d0
5
5
  SHA512:
6
- metadata.gz: 998a2683ab28aa176733374da9e9b6867940e3dbbf552ddf7e39c536e173a2bc448e8eba6f4f3ceb93e338e00e39b3be7cf598ee3e57e6e34e3e03012b9e4553
7
- data.tar.gz: c2c111dc161dcbf63d01f7d928af2fc8705e14a5ad1a74c62bc328499d2e7b851ff4e5601ebc47c2d87b3298ff3368bd58a479af1d9d64dc67d369281a55faad
6
+ metadata.gz: b62cb0ac49dbe7c9ab7afdbdcc7635ef98985642c073d90245f4432369de7cee2d47a3dbc5e867d1f21a4e5918de506b681f04e6e288ad1f105996da0f4bbf4b
7
+ data.tar.gz: 4f1b0840193f2f06ac7bcf5778f6639b2d33755d34e9d260db31e8ec8fa82927f0f9003327542ba82d8afe4eb1abe92bede2cf97280342c88582e7f693dca004
@@ -68,6 +68,11 @@ module Acbaker
68
68
  version = 'ios56'
69
69
  end
70
70
 
71
+ # process image
72
+ @processors.each do |processor|
73
+ image = processor.run(image, image_spec, width, height)
74
+ end
75
+
71
76
  # Generate filename
72
77
  filename_array = []
73
78
  filename_array.push(@type)
@@ -97,11 +102,8 @@ module Acbaker
97
102
  else
98
103
  filename = "#{filename_array.join('-')}.png"
99
104
  end
100
-
101
- # process image
102
- @processors.each do |processor|
103
- image = processor.run(image, image_spec, width, height)
104
- end
105
+
106
+ # save image
105
107
  image.write("#{target_directory}/#{filename}")
106
108
 
107
109
  # Trigger Callback proc
@@ -2,4 +2,5 @@ $:.push File.expand_path('../', __FILE__)
2
2
  require 'processors/base'
3
3
  require 'processors/center'
4
4
  require 'processors/cover'
5
- require 'processors/contain'
5
+ require 'processors/contain'
6
+ require 'processors/constraint'
@@ -0,0 +1,18 @@
1
+ module Acbaker
2
+ module Processors
3
+ class Constraint < Base
4
+ @@defaults = {}
5
+
6
+ def run(image, image_spec, width=nil, height=nil)
7
+ # resize image
8
+ image.change_geometry("#{width}x#{height}") do |px, py, i|
9
+ image.resize!(px, py)
10
+ image_spec['size'] = "#{px}x#{py}"
11
+ end
12
+
13
+ image
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -5,7 +5,7 @@ module Acbaker
5
5
 
6
6
  def run(image, image_spec, width=nil, height=nil)
7
7
  # resize image
8
- image.change_geometry("#{width}x") do |px, py, i|
8
+ image.change_geometry("#{width}x#{height}") do |px, py, i|
9
9
  image.resize!(px, py)
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module Acbaker
2
- VERSION = "0.0.7"
3
- end
2
+ VERSION = "0.0.8"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acbaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Strebitzer
@@ -94,6 +94,7 @@ files:
94
94
  - lib/acbaker/processors.rb
95
95
  - lib/acbaker/processors/base.rb
96
96
  - lib/acbaker/processors/center.rb
97
+ - lib/acbaker/processors/constraint.rb
97
98
  - lib/acbaker/processors/contain.rb
98
99
  - lib/acbaker/processors/cover.rb
99
100
  - lib/acbaker/version.rb