dassets 0.15.1 → 0.15.2

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
  SHA256:
3
- metadata.gz: 8d2158827f5cdbb5f779c9c3647a0f358bec9bffa62f5fefbf8b2b83f654d21a
4
- data.tar.gz: 84e0a6194cb0e506431750155dea71e3cc7cc0c62ac68a1ce8155454a5348f84
3
+ metadata.gz: 0c4f6cc3697d0b1b188558a154fc5456e52bb9db6e03b446b6a2c252762a8ae9
4
+ data.tar.gz: 55b78cc8cd737a3100c55e6613dd6b32548fd8553c652f2ee39d4a30523c2a3a
5
5
  SHA512:
6
- metadata.gz: b05667686c621b41c5cd0bd80242a58b74f58da3867180b039130e1898b7fcd8f49ee010c3007ad49e19d3cc748aa363c4f90170be6132797ddfb7c522e8a05b
7
- data.tar.gz: 1827b4f16b9f9d786306c8aef467a63b040830931b3481affe7af2954e7df11ebe5557cabe016b4d1ed0375923e18b9aa8c7906d8e55dae859f205d9e9bb2c34
6
+ metadata.gz: ad6ea83e174c7eff13899745e9606b321a19924144049b04f117ef9aef13a7f671dedd6781643873702808f671100ced0e1153ceb492c21084c4f45fbc2fee21
7
+ data.tar.gz: b107785591ef55e6247c425e26ec7a28a987ec9aecd5d608bc5bcd87bc6fce7bd39fabc6c3993919ab651bfdc3e37954081cde1b96d42069559e3177189920d5
@@ -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
@@ -49,7 +49,11 @@ class Dassets::SourceFile
49
49
  .join(".")
50
50
 
51
51
  File.join(
52
- [digest_dirname(@file_path), digest_basename].reject(&:empty?),
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dassets
4
- VERSION = "0.15.1"
4
+ VERSION = "0.15.2"
5
5
  end
@@ -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, :response_headers
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
 
@@ -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.1
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-10 00:00:00.000000000 Z
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