less-rails 2.2.4 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -10,3 +10,4 @@ before_install:
10
10
  gemfile:
11
11
  - Gemfile.rails-3.1
12
12
  - Gemfile.rails-3.2
13
+ - Gemfile.rails-edge
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 2.2.5 - 10/28/2012
5
+
6
+ * Real Rails 4 compatability thanks to @yalab
7
+
8
+
4
9
  2.2.4 - 10/20/2012
5
10
 
6
11
  * Rails 4 compatability with Sprockets vs app.assets.
data/Gemfile CHANGED
@@ -1 +1 @@
1
- eval File.read('Gemfile.rails-3.2')
1
+ eval File.read('Gemfile.rails-edge')
@@ -0,0 +1,7 @@
1
+ eval File.read 'Gemfile.common'
2
+
3
+ gem 'rails', github: 'rails/rails'
4
+ gem 'journey', github: 'rails/journey'
5
+ gem 'arel', github: 'rails/arel'
6
+ gem 'sprockets-rails', github: 'rails/sprockets-rails'
7
+ gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_finders'
@@ -31,8 +31,8 @@ module Less
31
31
  Less.register_rails_helper('javascript-url') { |tree, cxt| javascript_url unquote(cxt.toCSS()) }
32
32
  Less.register_rails_helper('stylesheet-path') { |tree, cxt| stylesheet_path unquote(cxt.toCSS()) }
33
33
  Less.register_rails_helper('stylesheet-url') { |tree, cxt| stylesheet_url unquote(cxt.toCSS()) }
34
- Less.register_rails_helper('font-path') { |tree, cxt| asset_path unquote(cxt.toCSS()) }
35
- Less.register_rails_helper('font-url') { |tree, cxt| asset_url unquote(cxt.toCSS()) }
34
+ Less.register_rails_helper('font-path') { |tree, cxt| font_path unquote(cxt.toCSS()) }
35
+ Less.register_rails_helper('font-url') { |tree, cxt| font_url unquote(cxt.toCSS()) }
36
36
  Less.register_rails_helper('asset-data-url') { |tree, cxt| asset_data_url unquote(cxt.toCSS()) }
37
37
  end
38
38
 
@@ -89,7 +89,22 @@ module Less
89
89
  def stylesheet_url(stylesheet)
90
90
  "url(#{scope.stylesheet_path(stylesheet)})"
91
91
  end
92
+
93
+ def font_path(font)
94
+ if scope.respond_to?(:font_path)
95
+ scope.font_path(font).inspect
96
+ else
97
+ asset_path(font)
98
+ end
99
+ end
92
100
 
101
+ def font_url(font)
102
+ if scope.respond_to?(:font_path)
103
+ "url(#{scope.font_path(font)})"
104
+ else
105
+ asset_url(font)
106
+ end
107
+ end
93
108
 
94
109
  private
95
110
 
@@ -98,7 +113,11 @@ module Less
98
113
  end
99
114
 
100
115
  def public_path(asset)
101
- scope.asset_paths.compute_public_path asset, ::Rails.application.config.assets.prefix
116
+ if scope.respond_to?(:asset_paths)
117
+ scope.asset_paths.compute_public_path asset, ::Rails.application.config.assets.prefix
118
+ else
119
+ scope.path_to_asset(asset)
120
+ end
102
121
  end
103
122
 
104
123
  def context_asset_data_uri(path)
@@ -1,5 +1,5 @@
1
1
  module Less
2
2
  module Rails
3
- VERSION = "2.2.4"
3
+ VERSION = "2.2.5"
4
4
  end
5
5
  end
@@ -15,12 +15,21 @@ class HelpersSpec < Less::Rails::Spec
15
15
  line_for_helper('video-url').must_equal "video-url: url(/videos/rails.mp4);"
16
16
  line_for_helper('audio-path').must_equal 'audio-path: "/audios/rails.mp3";'
17
17
  line_for_helper('audio-url').must_equal "audio-url: url(/audios/rails.mp3);"
18
- line_for_helper('javascript-path').must_equal 'javascript-path: "/assets/rails.js";'
19
- line_for_helper('javascript-url').must_equal "javascript-url: url(/assets/rails.js);"
20
- line_for_helper('stylesheet-path').must_equal 'stylesheet-path: "/assets/rails.css";'
21
- line_for_helper('stylesheet-url').must_equal "stylesheet-url: url(/assets/rails.css);"
22
- line_for_helper('font-path').must_equal 'font-path: "/assets/rails.ttf";'
23
- line_for_helper('font-url').must_equal "font-url: url(/assets/rails.ttf);"
18
+ if Rails::VERSION::MAJOR < 4
19
+ line_for_helper('javascript-path').must_equal 'javascript-path: "/assets/rails.js";'
20
+ line_for_helper('javascript-url').must_equal "javascript-url: url(/assets/rails.js);"
21
+ line_for_helper('stylesheet-path').must_equal 'stylesheet-path: "/assets/rails.css";'
22
+ line_for_helper('stylesheet-url').must_equal "stylesheet-url: url(/assets/rails.css);"
23
+ line_for_helper('font-path').must_equal 'font-path: "/assets/rails.ttf";'
24
+ line_for_helper('font-url').must_equal "font-url: url(/assets/rails.ttf);"
25
+ else
26
+ line_for_helper('javascript-path').must_equal 'javascript-path: "/javascripts/rails.js";'
27
+ line_for_helper('javascript-url').must_equal "javascript-url: url(/javascripts/rails.js);"
28
+ line_for_helper('stylesheet-path').must_equal 'stylesheet-path: "/stylesheets/rails.css";'
29
+ line_for_helper('stylesheet-url').must_equal "stylesheet-url: url(/stylesheets/rails.css);"
30
+ line_for_helper('font-path').must_equal 'font-path: "/fonts/rails.ttf";'
31
+ line_for_helper('font-url').must_equal "font-url: url(/fonts/rails.ttf);"
32
+ end
24
33
  end
25
34
 
26
35
  it 'parses data urls ' do
@@ -11,6 +11,7 @@ module Dummy
11
11
  config.active_support.deprecation = :stderr
12
12
  config.cache_store = :memory_store
13
13
  config.consider_all_requests_local = true
14
+ config.eager_load = false
14
15
 
15
16
  config.assets.enabled = true
16
17
  config.assets.cache_store = [:file_store, "#{config.root}/tmp/cache/assets/"]
data/test/spec_helper.rb CHANGED
@@ -55,7 +55,13 @@ module Less
55
55
 
56
56
  def reset_caches
57
57
  dummy_assets.version = SecureRandom.hex(32)
58
- dummy_assets.cache.clear
58
+ cache = dummy_assets.cache
59
+ if cache.is_a? Sprockets::Cache::FileStore
60
+ path = cache.instance_variable_get(:@root)
61
+ cache = Sprockets::Cache::FileStore.new(path)
62
+ else
63
+ cache.clear
64
+ end
59
65
  end
60
66
 
61
67
  def prepare_cache_dir
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: less-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-21 00:00:00.000000000 Z
12
+ date: 2012-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: less
@@ -106,6 +106,7 @@ files:
106
106
  - Gemfile.common
107
107
  - Gemfile.rails-3.1
108
108
  - Gemfile.rails-3.2
109
+ - Gemfile.rails-edge
109
110
  - Guardfile
110
111
  - MIT-LICENSE
111
112
  - README.md