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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d95961ea4f5f654297c681787f51f8d9d5a1f62
4
- data.tar.gz: d1dae004759ca1a837e5598d426b30b6bcfcf3ba
3
+ metadata.gz: 9dfd4591320f443fab55abef43c4c8fa58f69cdb
4
+ data.tar.gz: 9282bbe4eedc70f09efcf9b41c750d5ea26eb0ba
5
5
  SHA512:
6
- metadata.gz: fd0254b974221ca2f8a366309b3feee61aefdaf96a82458dfd7d1488a74a67c4dd4c93440c2705ddd8cbebc2c8f54b3798337e70ee0d281a08272f6c858637fc
7
- data.tar.gz: 7908f11e3402a70b92d5b9c3d40af37d07de2f415d99e53025f3e1ef2f71e254f9ae02d6f306eaa9c86973815ba9fb31179804cdb2925f6e86484cb6b2b46d4d
6
+ metadata.gz: 246bb2864946b9241659834ce691d4e1edd4792b86b90f2441f1d823cf388e10f89efb23d49d29b197fa25b130b095a5c41bc63ba07353c7b9b58c3686155cce
7
+ data.tar.gz: 4118e08224a43a50fa5edb472429a943d68bad326b1531d3953c47498e632b46453dfe4843ae8c126de4ef1e48cf2e8e968a3fd7bf71675679dfc22461748d85
@@ -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.0'
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
- @root = "#{::Rails.root}/public/assets"
8
+ super "#{::Rails.root}/tmp/cache"
9
+ @assets_path = "#{::Rails.root}/public/assets"
9
10
  end
10
11
 
11
- def get key
12
- # no-op, maybe warn to serve it statically
13
- end
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
- def set key, attributes
16
- return unless attributes.is_a? Hash and (logical_path = attributes[:logical_path]).present?
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assets_live_compile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braulio Bhavamitra