assets_live_compile 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets_live_compile.gemspec +1 -1
- data/lib/sprockets/cache/assets_live_compile_store.rb +12 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dfd4591320f443fab55abef43c4c8fa58f69cdb
|
4
|
+
data.tar.gz: 9282bbe4eedc70f09efcf9b41c750d5ea26eb0ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 246bb2864946b9241659834ce691d4e1edd4792b86b90f2441f1d823cf388e10f89efb23d49d29b197fa25b130b095a5c41bc63ba07353c7b9b58c3686155cce
|
7
|
+
data.tar.gz: 4118e08224a43a50fa5edb472429a943d68bad326b1531d3953c47498e632b46453dfe4843ae8c126de4ef1e48cf2e8e968a3fd7bf71675679dfc22461748d85
|
data/assets_live_compile.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "assets_live_compile"
|
5
5
|
s.license = "LGPL-3.0"
|
6
|
-
s.version = '0.2.
|
6
|
+
s.version = '0.2.1'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Braulio Bhavamitra"]
|
9
9
|
s.email = ["brauliobo@gmail.com"]
|
@@ -2,23 +2,25 @@ require 'sprockets/cache/file_store'
|
|
2
2
|
|
3
3
|
module Sprockets
|
4
4
|
class Cache
|
5
|
-
class AssetsLiveCompileStore
|
5
|
+
class AssetsLiveCompileStore < FileStore
|
6
6
|
|
7
7
|
def initialize options = {}
|
8
|
-
|
8
|
+
super "#{::Rails.root}/tmp/cache"
|
9
|
+
@assets_path = "#{::Rails.root}/public/assets"
|
9
10
|
end
|
10
11
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
12
|
+
def set key, attrs
|
13
|
+
super
|
14
|
+
return attrs unless ::Rails.application.config.assets.digest
|
15
|
+
return attrs unless attrs.is_a? Hash and (logical_path = attrs[:logical_path]).present?
|
16
|
+
return attrs if logical_path.index '.self.' and not ::Rails.application.config.assets.debug
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
return if logical_path.index '.self.' and !::Rails.application.config.assets.debug
|
18
|
-
asset = Sprockets::Asset.new nil, attributes
|
19
|
-
path = File.join @root, asset.digest_path.strip
|
18
|
+
asset = Sprockets::Asset.new nil, attrs
|
19
|
+
path = File.join @assets_path, asset.digest_path.strip
|
20
20
|
FileUtils.mkdir_p File.dirname(path)
|
21
21
|
File.open(path, 'wb'){ |f| f.write asset.source }
|
22
|
+
|
23
|
+
attrs
|
22
24
|
end
|
23
25
|
|
24
26
|
end
|