motion-assets 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/motion/project/assets.rb +13 -3
- data/lib/motion/project/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4da73c33e57347439f70703d39a336d0db5c375d
|
4
|
+
data.tar.gz: 98022c6c15db9ec8971462854c349c291d9e1027
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4453ed39cbbddfc703be311dd682ee61a868318327d991a31d1c9bd9fa4b0acc357bd5fd1791298905b34e351b3d72de71a2731fab9cc67081901c329e4e4638
|
7
|
+
data.tar.gz: d6d161609729c1b151b52b34c094b132ae262ab7908cb40d001d2cf7f6837fff2632dc983139c22c46c950cd4bf81dc6ed7324d26d6a34af7c564ef5525486de
|
@@ -144,7 +144,7 @@ module Motion::Project
|
|
144
144
|
parts = splash.split('|')
|
145
145
|
path = File.join(@output_dir, parts[0])
|
146
146
|
FileUtils.mkdir_p(File.dirname(path))
|
147
|
-
|
147
|
+
crop_image(@source_splash, path, parts[1])
|
148
148
|
@images << path
|
149
149
|
App.info "-", parts[0]
|
150
150
|
end
|
@@ -155,7 +155,7 @@ module Motion::Project
|
|
155
155
|
@icons.each do |icon|
|
156
156
|
path = File.join(@output_dir, icon.name)
|
157
157
|
FileUtils.mkdir_p(File.dirname(path))
|
158
|
-
|
158
|
+
resize_image(@source_icon, path, icon.dimensions)
|
159
159
|
@images << path
|
160
160
|
App.info "-", icon.name
|
161
161
|
end
|
@@ -170,13 +170,23 @@ module Motion::Project
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
-
def
|
173
|
+
def resize_image(source, path, dimensions)
|
174
174
|
image = MiniMagick::Image.open(source)
|
175
175
|
image.resize(dimensions)
|
176
176
|
image.format("png")
|
177
177
|
image.write(path)
|
178
178
|
end
|
179
179
|
|
180
|
+
def crop_image(source, path, dimensions)
|
181
|
+
image = MiniMagick::Image.open(source)
|
182
|
+
result = image.combine_options do |cmd|
|
183
|
+
cmd.gravity(:center)
|
184
|
+
cmd.crop("#{dimensions}!+0+0")
|
185
|
+
end
|
186
|
+
result.format("png")
|
187
|
+
result.write(path)
|
188
|
+
end
|
189
|
+
|
180
190
|
def validate_source_icon
|
181
191
|
unless File.exist?(@source_icon)
|
182
192
|
App.fail "You have to provide a valid base icon in your rakefile : app.assets.source_icon = './some/path/image.png"
|