non-stupid-digest-assets 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ee85f56051802bf315a0485cbb13143d35705f7
4
- data.tar.gz: b3449ef41cf282ad1ad1acdaea5350967fc91740
3
+ metadata.gz: 030252475e6d337adfc4a1a3a7dc07cdfa110ca4
4
+ data.tar.gz: f3e3638cf97a5e53a43b163737f4c253004de98b
5
5
  SHA512:
6
- metadata.gz: 5c671d99fea5ff1b4a0a7c359811a7de681a8ee1e28efea67c5dea8782a5320c52272bfeb11a80aa6454502ee0a603c3b1136cdc21b91bb664a02141ecb78fa7
7
- data.tar.gz: b00019b08209f4bf39277e0101d42bf7fec6a5db1bade193d4e01a32cf6d0e1942da96d4ace3685476dca8e9248e1671b21ee367f73ab3e2d90c27c487202c5b
6
+ metadata.gz: e209cf69ac8bc6b4fc4d8f3c24b35c145ceefa9725ab49d0effb59fcb221cc52de9be81cff2c6c49392d1f608499a8f53e1b9e245fdb3d031c9bdcdde0b20e94
7
+ data.tar.gz: c7e57bb6fef7f8fc22235cfce69fe05c2ba3a160a3926c57c23f60475a40b5620059440bc102164ce022e7abc9d92b844a13a767881cc6b67a10748af90187de
data/README.md CHANGED
@@ -15,6 +15,17 @@ Just put it in your Gemfile
15
15
  gem "non-stupid-digest-assets"
16
16
  ```
17
17
 
18
+ If you want to whitelist non-digest assets for only certain files, you can configure a whitelist like this:
19
+
20
+ ```ruby
21
+ # config/initializers/non_digest_assets.rb
22
+
23
+ NonStupidDigestAssets.whitelist = [/tinymce\/.*/, "full/file/path.txt"]
24
+ ```
25
+
26
+ Be sure to give either a regex that will match the right assets or a full
27
+ path to the asset in question.
28
+
18
29
  But shouldn't I always use the Rails asset helpers anyway?
19
30
  ----------------------------------------------------------
20
31
 
@@ -1,9 +1,36 @@
1
+ module NonStupidDigestAssets
2
+ mattr_accessor :whitelist
3
+ @@whitelist = []
4
+
5
+ class << self
6
+ def files(files)
7
+ return files if whitelist.empty?
8
+ whitelisted_files(files)
9
+ end
10
+
11
+ private
12
+
13
+ def whitelisted_files(files)
14
+ files.select do |file, info|
15
+ whitelist.any? do |item|
16
+ case item
17
+ when Regexp
18
+ info['logical_path'] =~ item
19
+ else
20
+ info['logical_path'] == item
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
1
28
  module Sprockets
2
29
  class Manifest
3
30
  def compile_with_non_digest *args
4
31
  compile_without_non_digest *args
5
32
 
6
- files.each do |(digest_path, info)|
33
+ NonStupidDigestAssets.files(files).each do |(digest_path, info)|
7
34
  full_digest_path = File.join dir, digest_path
8
35
  full_digest_gz_path = "#{full_digest_path}.gz"
9
36
  full_non_digest_path = File.join dir, info['logical_path']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: non-stupid-digest-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Speller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-13 00:00:00.000000000 Z
11
+ date: 2014-01-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Rails 4, much to everyone's annoyance, provides no option to generate both digest