active_assets 0.2.7 → 0.2.8
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.
- data/active_assets.gemspec +1 -1
- data/lib/active_assets/active_expansions/expansion.rb +2 -1
- data/lib/active_assets/active_sprites/runners/abstract_runner.rb +4 -0
- data/lib/active_assets/active_sprites/runners/chunky_png_runner.rb +1 -1
- data/lib/active_assets/active_sprites/runners/mini_magick_runner.rb +2 -8
- data/lib/active_assets/active_sprites/runners/rmagick_runner.rb +1 -1
- data/lib/active_assets/active_sprites/sprite_piece.rb +2 -1
- metadata +4 -4
data/active_assets.gemspec
CHANGED
@@ -24,7 +24,8 @@ module ActiveAssets
|
|
24
24
|
|
25
25
|
def asset(path, options = {})
|
26
26
|
options = HashWithIndifferentAccess.new(options)
|
27
|
-
|
27
|
+
# map is for 1.9.2; HashWithIndifferentAccess bug?
|
28
|
+
options.assert_valid_keys(*Asset.members.map(&:to_s))
|
28
29
|
|
29
30
|
inferred_type, extension = inferred_type(path)
|
30
31
|
|
@@ -15,7 +15,7 @@ module ActiveAssets
|
|
15
15
|
sprite_piece_path = image_computed_full_path(sp.path)
|
16
16
|
sp_image = ChunkyPNG::Image.from_file(sprite_piece_path)
|
17
17
|
sp.details = SpritePiece::Details.new(
|
18
|
-
sprite
|
18
|
+
sprite_url(sprite, sprite_path),
|
19
19
|
orientation == Sprite::Orientation::VERTICAL ? 0 : width,
|
20
20
|
orientation == Sprite::Orientation::VERTICAL ? height : 0,
|
21
21
|
sp_image.width,
|
@@ -3,12 +3,6 @@ require 'mini_magick'
|
|
3
3
|
module ActiveAssets
|
4
4
|
module ActiveSprites
|
5
5
|
class MiniMagickRunner < AbstractRunner
|
6
|
-
class ImageTempfile < Tempfile
|
7
|
-
def make_tmpname(ext, n)
|
8
|
-
'mini_magick%d-%d%s' % [$$, n, ext ? ".#{ext}" : '']
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
6
|
private
|
13
7
|
def set_sprite_details_and_return_image_list(sprite, sprite_path, sprite_pieces, orientation)
|
14
8
|
offset = 0
|
@@ -17,7 +11,7 @@ module ActiveAssets
|
|
17
11
|
sp_path = image_computed_full_path(sp.path)
|
18
12
|
image = MiniMagick::Image.open(sp_path)
|
19
13
|
sp.details = SpritePiece::Details.new(
|
20
|
-
sprite
|
14
|
+
sprite_url(sprite, sprite_path),
|
21
15
|
orientation == Sprite::Orientation::VERTICAL ? 0 : offset,
|
22
16
|
orientation == Sprite::Orientation::VERTICAL ? offset : 0,
|
23
17
|
image["width"],
|
@@ -32,7 +26,7 @@ module ActiveAssets
|
|
32
26
|
|
33
27
|
def create_sprite(sprite, sprite_path, sprite_pieces, image_list, width, height, orientation, verbose)
|
34
28
|
begin
|
35
|
-
tempfile =
|
29
|
+
tempfile = Tempfile.new(File.extname(sprite_path)[1..-1])
|
36
30
|
tempfile.binmode
|
37
31
|
ensure
|
38
32
|
tempfile.close
|
@@ -18,7 +18,7 @@ module ActiveAssets
|
|
18
18
|
|
19
19
|
image_list.each_with_index do |image, i|
|
20
20
|
sprite_pieces[i].details = SpritePiece::Details.new(
|
21
|
-
sprite
|
21
|
+
sprite_url(sprite, sprite_path),
|
22
22
|
orientation == Sprite::Orientation::VERTICAL ? 0 : offset,
|
23
23
|
orientation == Sprite::Orientation::VERTICAL ? offset : 0,
|
24
24
|
image.columns,
|
@@ -36,12 +36,13 @@ module ActiveAssets
|
|
36
36
|
|
37
37
|
def to_css
|
38
38
|
return '' if details.nil?
|
39
|
+
|
39
40
|
<<-CSS
|
40
41
|
#{css_selector}
|
41
42
|
{
|
42
43
|
width:#{width || "#{details.width}px"};
|
43
44
|
height:#{height || "#{details.height}px"};
|
44
|
-
background:url('#{
|
45
|
+
background:url('#{details.sprite_path}') no-repeat #{x || "#{-details.x}px"} #{y || "#{-details.y}px"};
|
45
46
|
display:block;
|
46
47
|
}
|
47
48
|
CSS
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 8
|
10
|
+
version: 0.2.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sam Woodard
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-12 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|