dassets 0.15.1 → 0.15.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dassets/source.rb +9 -0
- data/lib/dassets/source_file.rb +9 -1
- data/lib/dassets/version.rb +1 -1
- data/test/unit/source_file_tests.rb +6 -1
- data/test/unit/source_tests.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c4f6cc3697d0b1b188558a154fc5456e52bb9db6e03b446b6a2c252762a8ae9
|
4
|
+
data.tar.gz: 55b78cc8cd737a3100c55e6613dd6b32548fd8553c652f2ee39d4a30523c2a3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad6ea83e174c7eff13899745e9606b321a19924144049b04f117ef9aef13a7f671dedd6781643873702808f671100ced0e1153ceb492c21084c4f45fbc2fee21
|
7
|
+
data.tar.gz: b107785591ef55e6247c425e26ec7a28a987ec9aecd5d608bc5bcd87bc6fce7bd39fabc6c3993919ab651bfdc3e37954081cde1b96d42069559e3177189920d5
|
data/lib/dassets/source.rb
CHANGED
@@ -14,6 +14,15 @@ class Dassets::Source
|
|
14
14
|
@response_headers = {}
|
15
15
|
end
|
16
16
|
|
17
|
+
def base_path(value = nil)
|
18
|
+
set_base_path(value) unless value.nil?
|
19
|
+
@base_path
|
20
|
+
end
|
21
|
+
|
22
|
+
def set_base_path(value)
|
23
|
+
@base_path = value
|
24
|
+
end
|
25
|
+
|
17
26
|
def filter(&block)
|
18
27
|
block.nil? ? @filter : @filter = block
|
19
28
|
end
|
data/lib/dassets/source_file.rb
CHANGED
@@ -49,7 +49,11 @@ class Dassets::SourceFile
|
|
49
49
|
.join(".")
|
50
50
|
|
51
51
|
File.join(
|
52
|
-
[
|
52
|
+
[
|
53
|
+
base_path,
|
54
|
+
digest_dirname(@file_path),
|
55
|
+
digest_basename,
|
56
|
+
].reject(&:empty?),
|
53
57
|
)
|
54
58
|
end
|
55
59
|
end
|
@@ -70,6 +74,10 @@ class Dassets::SourceFile
|
|
70
74
|
File.mtime(@file_path)
|
71
75
|
end
|
72
76
|
|
77
|
+
def base_path
|
78
|
+
source&.base_path.to_s
|
79
|
+
end
|
80
|
+
|
73
81
|
def response_headers
|
74
82
|
source.nil? ? {} : source.response_headers
|
75
83
|
end
|
data/lib/dassets/version.rb
CHANGED
@@ -18,7 +18,8 @@ class Dassets::SourceFile
|
|
18
18
|
|
19
19
|
should have_readers :file_path
|
20
20
|
should have_imeths :source, :asset_file, :digest_path
|
21
|
-
should have_imeths :compiled, :exists?, :mtime
|
21
|
+
should have_imeths :compiled, :exists?, :mtime
|
22
|
+
should have_imeths :base_path, :response_headers
|
22
23
|
should have_cmeth :find_by_digest_path
|
23
24
|
|
24
25
|
should "know its file path" do
|
@@ -59,6 +60,10 @@ class Dassets::SourceFile
|
|
59
60
|
assert_that(subject.response_headers).is(subject.source.response_headers)
|
60
61
|
end
|
61
62
|
|
63
|
+
should "use the base path of its source as its base path" do
|
64
|
+
assert_that(subject.base_path).equals(subject.source.base_path.to_s)
|
65
|
+
end
|
66
|
+
|
62
67
|
should "be findable by its digest path" do
|
63
68
|
found = Dassets::SourceFile.find_by_digest_path(subject.digest_path)
|
64
69
|
|
data/test/unit/source_tests.rb
CHANGED
@@ -15,6 +15,7 @@ class Dassets::Source
|
|
15
15
|
end
|
16
16
|
|
17
17
|
should have_reader :path, :engines, :response_headers
|
18
|
+
should have_imeths :base_path, :set_base_path
|
18
19
|
should have_imeth :files, :filter, :engine
|
19
20
|
|
20
21
|
should "know its path and default filter" do
|
@@ -24,6 +25,28 @@ class Dassets::Source
|
|
24
25
|
.equals(["file1", "file2"])
|
25
26
|
end
|
26
27
|
|
28
|
+
should "have no base path by default" do
|
29
|
+
assert_that(subject.base_path).is_nil
|
30
|
+
end
|
31
|
+
|
32
|
+
should "set non-nil base paths" do
|
33
|
+
path = Factory.path
|
34
|
+
subject.base_path path
|
35
|
+
assert_that(subject.base_path).equals(path)
|
36
|
+
|
37
|
+
subject.base_path(nil)
|
38
|
+
assert_that(subject.base_path).equals(path)
|
39
|
+
end
|
40
|
+
|
41
|
+
should "force set any base paths" do
|
42
|
+
path = Factory.path
|
43
|
+
subject.set_base_path path
|
44
|
+
assert_that(subject.base_path).equals(path)
|
45
|
+
|
46
|
+
subject.set_base_path(nil)
|
47
|
+
assert_that(subject.base_path).is_nil
|
48
|
+
end
|
49
|
+
|
27
50
|
should "know its files" do
|
28
51
|
exp_files = [
|
29
52
|
@source_path.join("test1.txt").to_s,
|
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.15.
|
4
|
+
version: 0.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-01
|
12
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: much-style-guide
|