dassets 0.14.1 → 0.14.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 +4 -4
- data/lib/dassets.rb +5 -0
- data/lib/dassets/config.rb +6 -2
- data/lib/dassets/version.rb +1 -1
- data/test/unit/config_tests.rb +17 -1
- data/test/unit/dassets_tests.rb +17 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
|
4
|
-
|
3
|
+
data.tar.gz: 27368bfd4202c312aa66d309d27517a6704f9bca
|
4
|
+
metadata.gz: 78fc0e7996a2a58dac2402129e53bc692d6ee24a
|
5
5
|
SHA512:
|
6
|
-
|
7
|
-
|
6
|
+
data.tar.gz: d86da74bebfd5c5799768c1c449348d9da0015ec948af9bd0aa706206a61b93e89e941804368683b275bcba6345fe008f7a7f86a7bd2908df8646fcb49c36c6b
|
7
|
+
metadata.gz: 0c6e6fde12b20fbb9614e7510a8b09a6f6fb78a3084e037cb6b94f9340e1a9caf63e9364d1c48066c6e9ff8e04cd3a56ad561775bf214da646f5f08c82c19be7
|
data/lib/dassets.rb
CHANGED
data/lib/dassets/config.rb
CHANGED
@@ -11,13 +11,17 @@ module Dassets
|
|
11
11
|
|
12
12
|
def initialize
|
13
13
|
super
|
14
|
-
|
15
|
-
@combinations = Hash.new{ |h, k| [k] } # digest pass-thru if none defined
|
14
|
+
self.reset
|
16
15
|
@content_cache = Dassets::Cache::NoCache.new
|
17
16
|
@fingerprint_cache = Dassets::Cache::NoCache.new
|
18
17
|
@file_store = FileStore::NullStore.new
|
19
18
|
end
|
20
19
|
|
20
|
+
def reset
|
21
|
+
@sources = []
|
22
|
+
@combinations = Hash.new{ |h, k| [k] } # digest pass-thru if none defined
|
23
|
+
end
|
24
|
+
|
21
25
|
def base_url(value = nil)
|
22
26
|
set_base_url(value) if !value.nil?
|
23
27
|
@base_url
|
data/lib/dassets/version.rb
CHANGED
data/test/unit/config_tests.rb
CHANGED
@@ -14,10 +14,26 @@ class Dassets::Config
|
|
14
14
|
subject{ @config }
|
15
15
|
|
16
16
|
should have_readers :combinations
|
17
|
+
should have_imeths :reset
|
17
18
|
should have_imeths :base_url, :set_base_url
|
18
19
|
should have_imeths :file_store, :content_cache, :fingerprint_cache
|
19
20
|
should have_imeths :source, :combination, :combination?
|
20
21
|
|
22
|
+
should "reset its sources and combination on `reset`" do
|
23
|
+
assert_empty subject.sources
|
24
|
+
assert_empty subject.combinations
|
25
|
+
|
26
|
+
path = Factory.path
|
27
|
+
subject.source(path)
|
28
|
+
subject.combination path, [Factory.path]
|
29
|
+
assert_equal 1, subject.sources.size
|
30
|
+
assert_equal 1, subject.combinations.size
|
31
|
+
|
32
|
+
subject.reset
|
33
|
+
assert_empty subject.sources
|
34
|
+
assert_empty subject.combinations
|
35
|
+
end
|
36
|
+
|
21
37
|
should "have no base url by default" do
|
22
38
|
assert_nil subject.base_url
|
23
39
|
end
|
@@ -84,7 +100,7 @@ class Dassets::Config
|
|
84
100
|
end
|
85
101
|
|
86
102
|
should "register new sources with the `source` method" do
|
87
|
-
path =
|
103
|
+
path = Factory.path
|
88
104
|
filter = proc{ |paths| [] }
|
89
105
|
subject.source(path){ |s| s.filter(&filter) }
|
90
106
|
|
data/test/unit/dassets_tests.rb
CHANGED
@@ -10,17 +10,30 @@ module Dassets
|
|
10
10
|
desc "Dassets"
|
11
11
|
subject{ Dassets }
|
12
12
|
|
13
|
-
should have_imeths :config, :configure, :init, :
|
14
|
-
should have_imeths :source_files
|
13
|
+
should have_imeths :config, :configure, :init, :reset
|
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
|
18
18
|
end
|
19
19
|
|
20
|
+
should "know how to reset itself" do
|
21
|
+
config_reset_called = false
|
22
|
+
Assert.stub(subject.config, :reset){ config_reset_called = true }
|
23
|
+
|
24
|
+
file1 = subject['nested/file3.txt']
|
25
|
+
|
26
|
+
subject.reset
|
27
|
+
|
28
|
+
file2 = subject['nested/file3.txt']
|
29
|
+
assert_not_same file2, file1
|
30
|
+
assert_true config_reset_called
|
31
|
+
end
|
32
|
+
|
20
33
|
should "return asset files given a their digest path using the index operator" do
|
21
34
|
file = subject['nested/file3.txt']
|
22
35
|
|
23
|
-
assert_kind_of
|
36
|
+
assert_kind_of subject::AssetFile, file
|
24
37
|
assert_equal 'nested/file3.txt', file.digest_path
|
25
38
|
assert_equal 'd41d8cd98f00b204e9800998ecf8427e', file.fingerprint
|
26
39
|
end
|
@@ -38,7 +51,7 @@ module Dassets
|
|
38
51
|
end
|
39
52
|
|
40
53
|
should "know its list of configured source files" do
|
41
|
-
exp = Dassets::SourceFiles.new(
|
54
|
+
exp = Dassets::SourceFiles.new(subject.config.sources)
|
42
55
|
assert_equal exp, subject.source_files
|
43
56
|
end
|
44
57
|
|