non-stupid-digest-assets 1.0.4 → 1.0.5
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/README.md +9 -3
- data/lib/non-stupid-digest-assets.rb +5 -9
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f63ef1a8a236eafa05fc25eabf7393cc00d6baff
|
4
|
+
data.tar.gz: 8659593feaeb19887434629ebfe1a6089b895a30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d9faaed4b7720bf2a4349ff88104959a06ee7b464d6cad4fb6fdd5617541202a893eab187b7cc62c261146ef4ff346279e2cc818fd0ba9774e1b802bcd6123a
|
7
|
+
data.tar.gz: a04ce53dd96e2280d50cd69e85964c4f1076a483381ad45ff7aa53e44e087d87e1fe8c521bfc1da44fbffae74d24723f0ad077e9030c284ff6d8655be5137f11
|
data/README.md
CHANGED
@@ -6,6 +6,11 @@ What is it?
|
|
6
6
|
|
7
7
|
In Rails 4, there is no way to by default compile both digest and non-digest assets. This is a pain in the arse for almost everyone developing a Rails 4 app. This gem solves the problem with the minimum possible effort.
|
8
8
|
|
9
|
+
Compatibility
|
10
|
+
-------------
|
11
|
+
|
12
|
+
Currently this gem does not work with rails 4.2 beta. Pull requests welcome!
|
13
|
+
|
9
14
|
How do I install it?
|
10
15
|
--------------------
|
11
16
|
|
@@ -20,11 +25,12 @@ If you want to whitelist non-digest assets for only certain files, you can confi
|
|
20
25
|
```ruby
|
21
26
|
# config/initializers/non_digest_assets.rb
|
22
27
|
|
23
|
-
NonStupidDigestAssets.whitelist
|
28
|
+
NonStupidDigestAssets.whitelist += [/tinymce\/.*/, "image.png"]
|
24
29
|
```
|
25
30
|
|
26
|
-
Be sure to give either a regex that will match the right assets or
|
27
|
-
|
31
|
+
Be sure to give either a regex that will match the right assets or the logical path of the asset in question.
|
32
|
+
|
33
|
+
Note that the logical path is what you would provide to `asset_url`, so for an image at `RAILS_ROOT/assets/images/foo.png` the logical path is `foo.png`
|
28
34
|
|
29
35
|
But shouldn't I always use the Rails asset helpers anyway?
|
30
36
|
----------------------------------------------------------
|
@@ -13,12 +13,7 @@ module NonStupidDigestAssets
|
|
13
13
|
def whitelisted_files(files)
|
14
14
|
files.select do |file, info|
|
15
15
|
whitelist.any? do |item|
|
16
|
-
|
17
|
-
when Regexp
|
18
|
-
info['logical_path'] =~ item
|
19
|
-
else
|
20
|
-
info['logical_path'] == item
|
21
|
-
end
|
16
|
+
item === info['logical_path']
|
22
17
|
end
|
23
18
|
end
|
24
19
|
end
|
@@ -28,7 +23,7 @@ end
|
|
28
23
|
module Sprockets
|
29
24
|
class Manifest
|
30
25
|
def compile_with_non_digest *args
|
31
|
-
compile_without_non_digest *args
|
26
|
+
paths = compile_without_non_digest *args
|
32
27
|
|
33
28
|
NonStupidDigestAssets.files(files).each do |(digest_path, info)|
|
34
29
|
full_digest_path = File.join dir, digest_path
|
@@ -38,17 +33,18 @@ module Sprockets
|
|
38
33
|
|
39
34
|
if File.exists? full_digest_path
|
40
35
|
logger.debug "Writing #{full_non_digest_path}"
|
41
|
-
FileUtils.
|
36
|
+
FileUtils.copy_file full_digest_path, full_non_digest_path, :preserve_attributes
|
42
37
|
else
|
43
38
|
logger.debug "Could not find: #{full_digest_path}"
|
44
39
|
end
|
45
40
|
if File.exists? full_digest_gz_path
|
46
41
|
logger.debug "Writing #{full_non_digest_gz_path}"
|
47
|
-
FileUtils.
|
42
|
+
FileUtils.copy_file full_digest_gz_path, full_non_digest_gz_path, :preserve_attributes
|
48
43
|
else
|
49
44
|
logger.debug "Could not find: #{full_digest_gz_path}"
|
50
45
|
end
|
51
46
|
end
|
47
|
+
paths
|
52
48
|
end
|
53
49
|
|
54
50
|
alias_method_chain :compile, :non_digest
|
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.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Speller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-02 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
|
@@ -21,9 +21,9 @@ executables: []
|
|
21
21
|
extensions: []
|
22
22
|
extra_rdoc_files: []
|
23
23
|
files:
|
24
|
-
- lib/non-stupid-digest-assets.rb
|
25
24
|
- LICENSE
|
26
25
|
- README.md
|
26
|
+
- lib/non-stupid-digest-assets.rb
|
27
27
|
homepage: http://github.com/alexspeller/non-stupid-digest-assets
|
28
28
|
licenses:
|
29
29
|
- MIT
|
@@ -34,18 +34,19 @@ require_paths:
|
|
34
34
|
- lib
|
35
35
|
required_ruby_version: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
46
|
rubyforge_project:
|
47
|
-
rubygems_version: 2.
|
47
|
+
rubygems_version: 2.2.2
|
48
48
|
signing_key:
|
49
49
|
specification_version: 4
|
50
50
|
summary: Fix the Rails 4 asset pipeline to generate non-digest along with digest assets
|
51
51
|
test_files: []
|
52
|
+
has_rdoc:
|