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 +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/Gemfile.rails-edge +7 -0
- data/lib/less/rails/helpers.rb +22 -3
- data/lib/less/rails/version.rb +1 -1
- data/test/cases/helpers_spec.rb +15 -6
- data/test/dummy_app/init.rb +1 -0
- data/test/spec_helper.rb +7 -1
- metadata +3 -2
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
eval File.read('Gemfile.rails-
|
1
|
+
eval File.read('Gemfile.rails-edge')
|
data/Gemfile.rails-edge
ADDED
@@ -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'
|
data/lib/less/rails/helpers.rb
CHANGED
@@ -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|
|
35
|
-
Less.register_rails_helper('font-url') { |tree, cxt|
|
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
|
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)
|
data/lib/less/rails/version.rb
CHANGED
data/test/cases/helpers_spec.rb
CHANGED
@@ -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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
data/test/dummy_app/init.rb
CHANGED
@@ -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
|
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
|
+
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-
|
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
|