dassets 0.14.2 → 0.14.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- data.tar.gz: 27368bfd4202c312aa66d309d27517a6704f9bca
4
- metadata.gz: 78fc0e7996a2a58dac2402129e53bc692d6ee24a
3
+ data.tar.gz: 8dbe44e69f1cd555b3d4530bf6776c93ee6adc45
4
+ metadata.gz: 25630a550508870191515317a401c64a3afa28ac
5
5
  SHA512:
6
- data.tar.gz: d86da74bebfd5c5799768c1c449348d9da0015ec948af9bd0aa706206a61b93e89e941804368683b275bcba6345fe008f7a7f86a7bd2908df8646fcb49c36c6b
7
- metadata.gz: 0c6e6fde12b20fbb9614e7510a8b09a6f6fb78a3084e037cb6b94f9340e1a9caf63e9364d1c48066c6e9ff8e04cd3a56ad561775bf214da646f5f08c82c19be7
6
+ data.tar.gz: 42a5cb8ee86ff57a117107491c25d7fbc3d813978bb17d0ac67b15e61aa3ced203e6e9fe03b1b7d7d4c0c708f14011021b65401e27bdddf7156be32e7e6b2c48
7
+ metadata.gz: f11ead1c8a44cf0988602f2fb9ae08ca7c5cc2d7f587c679f504f68bf6f46f838395ce906b491b156565c5ac5c65067aaaa068f870a4228b53b150e741911857
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.require_paths = ["lib"]
20
20
 
21
21
  gem.add_development_dependency("assert", ["~> 2.16.3"])
22
- gem.add_development_dependency('assert-rack-test', ["~> 1.0.4"])
22
+ gem.add_development_dependency('assert-rack-test', ["~> 1.0.5"])
23
23
  gem.add_development_dependency("sinatra", ["~> 1.4"])
24
24
 
25
25
  gem.add_dependency("rack", ["~> 1.0"])
@@ -10,17 +10,17 @@ module Dassets
10
10
  @save_mutex = ::Mutex.new
11
11
  end
12
12
 
13
- def save(url, &block)
13
+ def save(url_path, &block)
14
14
  @save_mutex.synchronize do
15
- store_path(url).tap do |path|
15
+ store_path(url_path).tap do |path|
16
16
  FileUtils.mkdir_p(File.dirname(path))
17
17
  File.open(path, "w"){ |f| f.write(block.call) }
18
18
  end
19
19
  end
20
20
  end
21
21
 
22
- def store_path(url)
23
- File.join(@root, url)
22
+ def store_path(url_path)
23
+ File.join(@root, url_path)
24
24
  end
25
25
 
26
26
  class NullStore < FileStore
@@ -28,8 +28,9 @@ module Dassets
28
28
  super('')
29
29
  end
30
30
 
31
- def save(url, &block)
32
- store_path(url) # no-op, just return the store path like the base does
31
+ def save(url_path, &block)
32
+ # no-op, just return the store path like the base does
33
+ store_path(url_path)
33
34
  end
34
35
  end
35
36
 
@@ -1,3 +1,3 @@
1
1
  module Dassets
2
- VERSION = "0.14.2"
2
+ VERSION = "0.14.3"
3
3
  end
@@ -122,7 +122,7 @@ class Dassets::AssetFile
122
122
  @outfile = Dassets.config.file_store.store_path(@asset_file.url)
123
123
  end
124
124
  teardown do
125
- FileUtils.rm(@outfile)
125
+ FileUtils.rm_rf(Dassets.config.file_store.root.to_s)
126
126
  Dassets.config.file_store Dassets::FileStore::NullStore.new
127
127
  end
128
128
 
@@ -69,7 +69,7 @@ class Dassets::Config
69
69
  subject.file_store(store)
70
70
  assert_equal store, subject.file_store
71
71
 
72
- subject.content_cache(nil)
72
+ subject.file_store(nil)
73
73
  assert_equal store, subject.file_store
74
74
  end
75
75
 
@@ -6,35 +6,37 @@ class Dassets::FileStore
6
6
  class UnitTests < Assert::Context
7
7
  desc "Dassets::FileStore"
8
8
  setup do
9
- @root = TEST_SUPPORT_PATH.join('public')
10
- @url = 'some/url'
11
- @url_path = @root.join(@url).to_s
12
- FileUtils.rm_f(@url_path)
9
+ @root = TEST_SUPPORT_PATH.join('public')
10
+ @url_path = Factory.url
11
+ @root_path = File.join(@root, @url_path).to_s
12
+ FileUtils.rm_f(@root_path)
13
13
 
14
14
  @store = Dassets::FileStore.new(@root.to_s)
15
15
  end
16
16
  teardown do
17
- FileUtils.rm_f(@url_path)
17
+ FileUtils.rm_rf(@root.to_s)
18
18
  end
19
19
  subject{ @store }
20
20
 
21
21
  should have_readers :root
22
22
  should have_imeths :save, :store_path
23
23
 
24
- should "know its root path" do
24
+ should "know its root" do
25
25
  assert_equal @root.to_s, subject.root
26
26
  end
27
27
 
28
- should "build the store path based on a given url" do
29
- assert_equal @url_path, subject.store_path(@url)
28
+ should "build the store path based on a given url path" do
29
+ assert_equal @root_path, subject.store_path(@url_path)
30
30
  end
31
31
 
32
- should "return write a file and return the store path on save" do
33
- assert_not_file_exists @url_path
34
- path = subject.save(@url){ 'some contents' }
32
+ should "write a file and return the store path on save" do
33
+ content = Factory.text
34
+ assert_not_file_exists @root_path
35
+ path = subject.save(@url_path){ content }
35
36
 
36
- assert_equal @url_path, path
37
- assert_file_exists @url_path
37
+ assert_equal @root_path, path
38
+ assert_file_exists @root_path
39
+ assert_equal content, File.read(@root_path)
38
40
  end
39
41
 
40
42
  end
@@ -49,12 +51,13 @@ class Dassets::FileStore
49
51
  assert_kind_of Dassets::FileStore, subject
50
52
  end
51
53
 
52
- should "know its root path" do
54
+ should "know its root" do
53
55
  assert_equal '', subject.root
54
56
  end
55
57
 
56
- should "return the store path on save" do
57
- assert_equal "/#{@url}", subject.save(@url)
58
+ should "return the store path on save but not save a file" do
59
+ assert_equal File.join('', @url_path), subject.save(@url_path)
60
+ assert_not_file_exists @root_path
58
61
  end
59
62
 
60
63
  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.2
4
+ version: 0.14.3
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: 2017-05-10 00:00:00 Z
13
+ date: 2017-07-26 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: assert
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 1.0.4
32
+ version: 1.0.5
33
33
  type: :development
34
34
  version_requirements: *id002
35
35
  - !ruby/object:Gem::Dependency
@@ -91,10 +91,6 @@ files:
91
91
  - test/support/app/assets/nested/file3.txt
92
92
  - test/support/empty/.gitkeep
93
93
  - test/support/factory.rb
94
- - test/support/public/file2-9bbe1047cffbb590f59e0e5aeff46ae4.txt
95
- - test/support/public/grumpy_cat-b0d1f399a916f7a25c4c0f693c619013.jpg
96
- - test/support/public/nested/a-thing.txt-7413d18f2eba9c695a880aff67fde135.no-use
97
- - test/support/public/nested/file3-d41d8cd98f00b204e9800998ecf8427e.txt
98
94
  - test/support/source_files/_ignored.txt
99
95
  - test/support/source_files/nested/_nested_ignored.txt
100
96
  - test/support/source_files/nested/test2.txt
@@ -149,10 +145,6 @@ test_files:
149
145
  - test/support/app/assets/nested/file3.txt
150
146
  - test/support/empty/.gitkeep
151
147
  - test/support/factory.rb
152
- - test/support/public/file2-9bbe1047cffbb590f59e0e5aeff46ae4.txt
153
- - test/support/public/grumpy_cat-b0d1f399a916f7a25c4c0f693c619013.jpg
154
- - test/support/public/nested/a-thing.txt-7413d18f2eba9c695a880aff67fde135.no-use
155
- - test/support/public/nested/file3-d41d8cd98f00b204e9800998ecf8427e.txt
156
148
  - test/support/source_files/_ignored.txt
157
149
  - test/support/source_files/nested/_nested_ignored.txt
158
150
  - test/support/source_files/nested/test2.txt