rack-less 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-less (2.0.0)
4
+ rack-less (2.0.2)
5
5
  less (~> 1.2)
6
6
  rack (~> 1.0)
7
7
 
@@ -43,8 +43,6 @@ PLATFORMS
43
43
 
44
44
  DEPENDENCIES
45
45
  bundler (~> 1.0)
46
- less (~> 1.2)
47
- rack (~> 1.0)
48
46
  rack-less!
49
47
  rack-test (>= 0.5.3)
50
48
  sinatra (>= 0.9.4)
@@ -37,7 +37,7 @@ module Rack::Less
37
37
 
38
38
  def initialize(settings={})
39
39
  ATTRIBUTES.each do |a|
40
- instance_variable_set("@#{a}", settings[a] || DEFAULTS[a])
40
+ instance_variable_set("@#{a}", settings[a].nil? ? DEFAULTS[a] : settings[a])
41
41
  end
42
42
  end
43
43
 
@@ -77,22 +77,27 @@ module Rack::Less
77
77
  filename = key.strip
78
78
  filename += ".css" unless filename.include?('.css')
79
79
  if !filename.include?('?') && self.cache_bust != false
80
- filename += "?"
81
- filename += if self.cache_bust == true
82
- Time.now.to_i
83
- else
84
- self.cache_bust ||= default_cache_bust
85
- end.to_s
80
+ if !(cb = cache_bust_value).empty?
81
+ filename += "?#{cb}"
82
+ end
86
83
  end
87
84
  filename
88
85
  end
89
86
 
87
+ def cache_bust_value
88
+ if self.cache_bust == true
89
+ Time.now.to_i
90
+ else
91
+ self.cache_bust ||= default_cache_bust
92
+ end.to_s
93
+ end
94
+
90
95
  def default_cache_bust
91
96
  if defined?(::Sinatra) && defined?(::Sinatra::Application)
92
97
  app_root_cache_bust(::Sinatra::Application)
93
98
  elsif defined?(::Rails)
94
99
  app_root_cache_bust(::Rails)
95
- end || false
100
+ end || ""
96
101
  end
97
102
 
98
103
  def app_root_cache_bust(app)
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Less
3
- VERSION = '2.0.1'
3
+ VERSION = '2.0.2'
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ class ConfigTest < Test::Unit::TestCase
10
10
  { :cache => false,
11
11
  :compress => false,
12
12
  :combinations => {},
13
- :cache_bust => false
13
+ :cache_bust => nil
14
14
  }.each do |k,v|
15
15
  should "default #{k} correctly" do
16
16
  assert_equal v, @config.send(k)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-less
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 1
10
- version: 2.0.1
9
+ - 2
10
+ version: 2.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding