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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e63c0a3ac0ace8a37960c2b007802938effb9f73
4
- data.tar.gz: bbd2d4e865227dd3b68f4bec64c4f6c15df03b96
3
+ metadata.gz: dcd128fafbb8a2299d5a30d4e8a110e8595f522d
4
+ data.tar.gz: 19a3213b12edad5575d30e127723b182b405f6df
5
5
  SHA512:
6
- metadata.gz: 7dd122c7267b3926e351f245ee9907998f8ba01b0a168508a7de6d2a2f825ee0d0b199395cdddf93e1e774d6ef2051a1caa4117f2eff258faa793b8385362418
7
- data.tar.gz: aa6b33f88f21060952d4afc531ec578728c7c7784c1334550bb3fc95ce249a8c5d41ab72ff4691c9d9b14e82fbc8166f7913a383198cab5242d2b94bccadd2bc
6
+ metadata.gz: 1edd2284cee208dbdebce15093b44b28defea0709b39f2a331397c0d672be3904e1ce98463a8a179b5fbb391ba6e4d5a4815e6c0eddecd91dec7cfe813f8c0c0
7
+ data.tar.gz: 12e1e36cdd15fc62b5b4dbc77cf2e18c27bfceed626f484cf43577f9e35bd6fcb28d72aeafa4d10e9a9426af09722e5077d7426a6ef3725acc0973d56768e438
@@ -9,8 +9,4 @@ require 'spriteful/template'
9
9
 
10
10
  module Spriteful
11
11
  class EmptySourceError < Thor::Error; end
12
-
13
- class << self
14
- attr_accessor :options
15
- end
16
12
  end
@@ -111,7 +111,7 @@ module Spriteful
111
111
  # Returns nothing.
112
112
  def save_options
113
113
  if save_options?
114
- parts = Shellwords.join(Spriteful.options)
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
- Spriteful.options = ARGV.dup.uniq
151
- @save_options = !!Spriteful.options.delete('--save')
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)
@@ -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 = Magick::MaxRGB
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
@@ -73,7 +73,7 @@ module Spriteful
73
73
  protected
74
74
 
75
75
  def template_options
76
- @options.merge(destination: @destination, cli_options: Spriteful.options)
76
+ @options.merge(destination: @destination)
77
77
  end
78
78
 
79
79
  # Internal: returns the 'rails' flag.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * This Stylesheet was generated by the 'spriteful' gem, with the following options:
3
- <%- if Spriteful.options -%>
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 Spriteful.options -%>
3
+ <%- if cli_options.any? -%>
4
4
  // 'spriteful <%= cli_options.join(' ') %>'.
5
5
  <%- end -%>
6
6
  <%- if mixin? -%>
@@ -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]))
@@ -1,3 +1,3 @@
1
1
  module Spriteful
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -2,8 +2,4 @@ require 'spriteful'
2
2
 
3
3
  RSpec.configure do |config|
4
4
  config.order = 'random'
5
-
6
- config.after do
7
- Spriteful.options = nil
8
- end
9
5
  end
@@ -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.0
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: 2014-11-13 00:00:00.000000000 Z
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.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.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.2
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: