dassets 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dassets.gemspec +1 -1
- data/lib/dassets.rb +18 -5
- data/lib/dassets/asset_file.rb +4 -4
- data/lib/dassets/file_store.rb +1 -1
- data/lib/dassets/source.rb +3 -3
- data/lib/dassets/source_file.rb +2 -7
- data/lib/dassets/version.rb +1 -1
- data/test/helper.rb +2 -0
- data/test/unit/dassets_tests.rb +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
|
4
|
-
|
3
|
+
metadata.gz: 89a17e9e4689219cffdda2b968a4c481f9813591
|
4
|
+
data.tar.gz: 2a74fdbbc78e44ec82d23f1aabbc284d70f03397
|
5
5
|
SHA512:
|
6
|
-
|
7
|
-
|
6
|
+
metadata.gz: d19a0f7587afb5d0d19a9878a0667973474ef55a3d684d363a66cb750394249a97cf957cac9e99df6662fd72d32be6e9eb46794c7d121c7d7b45558f85dd0dd7
|
7
|
+
data.tar.gz: bf6bfb399f0ab12d21f50d58db6b6e39b22da71768660236ae21f287ebf3470477598dc95a397a39395c960980fd428bf6cf1968145975a65ab7db67da28041b
|
data/dassets.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_development_dependency("assert", ["~> 2.16.
|
21
|
+
gem.add_development_dependency("assert", ["~> 2.16.3"])
|
22
22
|
gem.add_development_dependency('assert-rack-test', ["~> 1.0.4"])
|
23
23
|
gem.add_development_dependency("sinatra", ["~> 1.4"])
|
24
24
|
|
data/lib/dassets.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'dassets/version'
|
2
2
|
require 'dassets/asset_file'
|
3
3
|
require 'dassets/config'
|
4
|
+
require 'dassets/source_file'
|
4
5
|
|
5
6
|
module Dassets
|
6
7
|
|
@@ -10,21 +11,33 @@ module Dassets
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.init
|
13
|
-
@asset_files
|
14
|
+
@asset_files ||= {}
|
15
|
+
@source_files = SourceFiles.new(self.config.sources)
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.[](digest_path)
|
17
19
|
@asset_files[digest_path] ||= AssetFile.new(digest_path)
|
18
20
|
end
|
19
21
|
|
20
|
-
def self.
|
21
|
-
|
22
|
+
def self.source_files
|
23
|
+
@source_files
|
22
24
|
end
|
23
25
|
|
24
|
-
module
|
26
|
+
module SourceFiles
|
27
|
+
|
25
28
|
def self.new(sources)
|
26
|
-
|
29
|
+
# use a hash to store the source files so in the case two source files
|
30
|
+
# have the same digest path, the last one *should* be correct since it
|
31
|
+
# was last to be configured
|
32
|
+
sources.inject({}) do |hash, source|
|
33
|
+
source.files.each do |file_path|
|
34
|
+
s = SourceFile.new(file_path)
|
35
|
+
hash[s.digest_path] = s
|
36
|
+
end
|
37
|
+
hash
|
38
|
+
end
|
27
39
|
end
|
40
|
+
|
28
41
|
end
|
29
42
|
|
30
43
|
end
|
data/lib/dassets/asset_file.rb
CHANGED
@@ -8,10 +8,10 @@ class Dassets::AssetFile
|
|
8
8
|
attr_reader :digest_path, :dirname, :extname, :basename, :source_proxy
|
9
9
|
|
10
10
|
def initialize(digest_path)
|
11
|
-
@digest_path
|
12
|
-
@dirname
|
13
|
-
@extname
|
14
|
-
@basename
|
11
|
+
@digest_path = digest_path
|
12
|
+
@dirname = File.dirname(@digest_path)
|
13
|
+
@extname = File.extname(@digest_path)
|
14
|
+
@basename = File.basename(@digest_path, @extname)
|
15
15
|
@source_proxy = Dassets::SourceProxy.new(@digest_path, {
|
16
16
|
:content_cache => Dassets.config.content_cache,
|
17
17
|
:fingerprint_cache => Dassets.config.fingerprint_cache
|
data/lib/dassets/file_store.rb
CHANGED
data/lib/dassets/source.rb
CHANGED
@@ -6,9 +6,9 @@ class Dassets::Source
|
|
6
6
|
attr_reader :path, :engines, :response_headers
|
7
7
|
|
8
8
|
def initialize(path)
|
9
|
-
@path
|
10
|
-
@filter
|
11
|
-
@engines
|
9
|
+
@path = path.to_s
|
10
|
+
@filter = proc{ |paths| paths }
|
11
|
+
@engines = Hash.new{ |h,k| Dassets::NullEngine.new }
|
12
12
|
@response_headers = Hash.new
|
13
13
|
end
|
14
14
|
|
data/lib/dassets/source_file.rb
CHANGED
@@ -8,19 +8,14 @@ module Dassets
|
|
8
8
|
class SourceFile
|
9
9
|
|
10
10
|
def self.find_by_digest_path(path, options = nil)
|
11
|
-
|
12
|
-
source_files = Dassets.source_list.map{ |p| self.new(p) }
|
13
|
-
|
14
|
-
# get the last matching one (in case two source files have the same digest
|
15
|
-
# path the last one *should* be correct since it was last to be configured)
|
16
|
-
source_files.select{ |s| s.digest_path == path }.last || NullSourceFile.new(path, options)
|
11
|
+
Dassets.source_files[path] || NullSourceFile.new(path, options)
|
17
12
|
end
|
18
13
|
|
19
14
|
attr_reader :file_path
|
20
15
|
|
21
16
|
def initialize(file_path)
|
22
17
|
@file_path = file_path.to_s
|
23
|
-
@ext_list
|
18
|
+
@ext_list = File.basename(@file_path).split('.').reverse
|
24
19
|
end
|
25
20
|
|
26
21
|
# get the last matching one (in the case two sources with the same path are
|
data/lib/dassets/version.rb
CHANGED
data/test/helper.rb
CHANGED
data/test/unit/dassets_tests.rb
CHANGED
@@ -11,7 +11,7 @@ module Dassets
|
|
11
11
|
subject{ Dassets }
|
12
12
|
|
13
13
|
should have_imeths :config, :configure, :init, :[]
|
14
|
-
should have_imeths :
|
14
|
+
should have_imeths :source_files
|
15
15
|
|
16
16
|
should "return a `Config` instance with the `config` method" do
|
17
17
|
assert_kind_of Config, subject.config
|
@@ -38,8 +38,8 @@ module Dassets
|
|
38
38
|
end
|
39
39
|
|
40
40
|
should "know its list of configured source files" do
|
41
|
-
|
42
|
-
assert_equal
|
41
|
+
exp = Dassets::SourceFiles.new(Dassets.config.sources)
|
42
|
+
assert_equal exp, subject.source_files
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dassets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2017-05-10 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: assert
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 2.16.
|
22
|
+
version: 2.16.3
|
23
23
|
type: :development
|
24
24
|
version_requirements: *id001
|
25
25
|
- !ruby/object:Gem::Dependency
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements: []
|
136
136
|
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.6.
|
138
|
+
rubygems_version: 2.6.6
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Digested asset files
|