spriteful 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spriteful.rb +0 -4
- data/lib/spriteful/cli.rb +5 -4
- data/lib/spriteful/sprite.rb +4 -1
- data/lib/spriteful/stylesheet.rb +1 -1
- data/lib/spriteful/stylesheets/template.css.erb +1 -1
- data/lib/spriteful/stylesheets/template.scss.erb +1 -1
- data/lib/spriteful/template.rb +1 -1
- data/lib/spriteful/version.rb +1 -1
- data/spec/spec_helper.rb +0 -4
- data/spec/stylesheet_spec.rb +1 -2
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcd128fafbb8a2299d5a30d4e8a110e8595f522d
|
4
|
+
data.tar.gz: 19a3213b12edad5575d30e127723b182b405f6df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1edd2284cee208dbdebce15093b44b28defea0709b39f2a331397c0d672be3904e1ce98463a8a179b5fbb391ba6e4d5a4815e6c0eddecd91dec7cfe813f8c0c0
|
7
|
+
data.tar.gz: 12e1e36cdd15fc62b5b4dbc77cf2e18c27bfceed626f484cf43577f9e35bd6fcb28d72aeafa4d10e9a9426af09722e5077d7426a6ef3725acc0973d56768e438
|
data/lib/spriteful.rb
CHANGED
data/lib/spriteful/cli.rb
CHANGED
@@ -111,7 +111,7 @@ module Spriteful
|
|
111
111
|
# Returns nothing.
|
112
112
|
def save_options
|
113
113
|
if save_options?
|
114
|
-
parts = Shellwords.join(
|
114
|
+
parts = Shellwords.join(@cli_options)
|
115
115
|
create_file '.spritefulrc', parts + "\n", force: true
|
116
116
|
end
|
117
117
|
end
|
@@ -124,7 +124,8 @@ module Spriteful
|
|
124
124
|
format: options.format,
|
125
125
|
rails: options.rails?,
|
126
126
|
mixin: options.mixin?,
|
127
|
-
template: template
|
127
|
+
template: template,
|
128
|
+
cli_options: @cli_options
|
128
129
|
}
|
129
130
|
end
|
130
131
|
|
@@ -147,8 +148,8 @@ module Spriteful
|
|
147
148
|
#
|
148
149
|
# Returns nothing.
|
149
150
|
def prepare_options!
|
150
|
-
|
151
|
-
@save_options =
|
151
|
+
@cli_options = ARGV.dup.uniq
|
152
|
+
@save_options = !!@cli_options.delete('--save')
|
152
153
|
|
153
154
|
if options.rails?
|
154
155
|
sources.concat(detect_sources)
|
data/lib/spriteful/sprite.rb
CHANGED
@@ -6,6 +6,9 @@ module Spriteful
|
|
6
6
|
# of images into a single one, and providing the required information
|
7
7
|
# about the related images.
|
8
8
|
class Sprite
|
9
|
+
# RMagick 2.13.4 replaced 'MaxRGB' with 'QuantumRange'.
|
10
|
+
OPACITY = Magick.const_defined?(:MaxRGB) ? Magick::MaxRGB : Magick::QuantumRange
|
11
|
+
|
9
12
|
# Public: returns the path where the sprite will be saved.
|
10
13
|
attr_reader :path
|
11
14
|
|
@@ -67,7 +70,7 @@ module Spriteful
|
|
67
70
|
# Returns nothing.
|
68
71
|
def combine!
|
69
72
|
combined = Magick::Image.new(width, height)
|
70
|
-
combined.opacity =
|
73
|
+
combined.opacity = OPACITY
|
71
74
|
@images.each do |image|
|
72
75
|
combined.composite!(image.source, image.left.abs, image.top.abs, Magick::SrcOverCompositeOp)
|
73
76
|
end
|
data/lib/spriteful/stylesheet.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* This Stylesheet was generated by the 'spriteful' gem, with the following options:
|
3
|
-
<%- if
|
3
|
+
<%- if cli_options.any? -%>
|
4
4
|
* 'spriteful <%= cli_options.join(' ') %>'.
|
5
5
|
<%- end -%>
|
6
6
|
* Below there are several CSS classes to use the '<%= sprite.name %>'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// ============================================================================
|
2
2
|
// This Stylesheet was generated by the 'spriteful' gem, with the following options:
|
3
|
-
<%- if
|
3
|
+
<%- if cli_options.any? -%>
|
4
4
|
// 'spriteful <%= cli_options.join(' ') %>'.
|
5
5
|
<%- end -%>
|
6
6
|
<%- if mixin? -%>
|
data/lib/spriteful/template.rb
CHANGED
@@ -27,7 +27,7 @@ module Spriteful
|
|
27
27
|
@sprite = sprite
|
28
28
|
@options = options
|
29
29
|
@destination = Pathname.new(options[:destination])
|
30
|
-
@cli_options = options[:cli_options]
|
30
|
+
@cli_options = Array(options[:cli_options])
|
31
31
|
|
32
32
|
if @options[:root]
|
33
33
|
@root = Pathname.new(File.expand_path(options[:root]))
|
data/lib/spriteful/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/stylesheet_spec.rb
CHANGED
@@ -66,9 +66,8 @@ describe Spriteful::Stylesheet do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'documents the Spriteful options used to generate the stylesheet' do
|
69
|
-
Spriteful.options = %w(one two three)
|
70
69
|
sprite = Spriteful::Sprite.new(source, destination)
|
71
|
-
stylesheet = Spriteful::Stylesheet.new(sprite, destination, format: 'css')
|
70
|
+
stylesheet = Spriteful::Stylesheet.new(sprite, destination, format: 'css', cli_options: %w(one two three))
|
72
71
|
output = stylesheet.render
|
73
72
|
|
74
73
|
expect(output).to match(/'spriteful one two three'/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spriteful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Mazza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 3.0
|
81
|
+
version: '3.0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 3.0
|
88
|
+
version: '3.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: bundler
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
167
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.4.
|
168
|
+
rubygems_version: 2.4.5
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
171
|
summary: ''
|
@@ -180,4 +180,3 @@ test_files:
|
|
180
180
|
- spec/sprite_spec.rb
|
181
181
|
- spec/spriteful/template_spec.rb
|
182
182
|
- spec/stylesheet_spec.rb
|
183
|
-
has_rdoc:
|