disk_store 0.1.1 → 0.1.2

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
- metadata.gz: 07024f79a815fe1a7ad79d9434e92a81011d06b7
4
- data.tar.gz: 6b625b7bda7b8f4a037b8611d2e1c6445eaf742f
3
+ metadata.gz: 7faa15c4c175c701e092ae666603104e0cd3c79d
4
+ data.tar.gz: 645d9a33a2dbe7f3174ab36227ab3618ed6d147c
5
5
  SHA512:
6
- metadata.gz: 7808037a0c737663fd5c5efe482259b33c61a2e942afe67e41e0b87fbd4bbc34f14080aa990d4b6dceb2f200ce231353ce1ced4b9d258c2068b590ed5c95dfd8
7
- data.tar.gz: 466111d5bdba677b81855decdf668f67e5960d70dc55f9c1d50bfe0202010f4582f974a970ba43d239d8c6e07dae4e12258df9aab5f1c7c59396a8c7430a2f12
6
+ metadata.gz: 22842f3a27bc962003309cad6e0ccb573667984049615167d22d6024d01b85b3eb369f939e0f809b097c7dd783771ea4379d1478b1e8f5c0c3da39a21ea9fd60
7
+ data.tar.gz: 3264b63300a777e1c60d234b8b723383b95df29a4053f5227a4f9c4bf00e753965bb1d1ce6b2b1e1d33f7c6f607681c06e159428613731be353794d3ebfe0e77
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- disk_store (0.1.0)
4
+ disk_store (0.1.2)
5
5
  rake
6
6
 
7
7
  GEM
@@ -12,7 +12,7 @@ GEM
12
12
  safe_yaml (~> 0.9.0)
13
13
  diff-lcs (1.2.5)
14
14
  multi_json (1.8.4)
15
- rake (10.1.1)
15
+ rake (10.2.2)
16
16
  rspec (2.14.1)
17
17
  rspec-core (~> 2.14.0)
18
18
  rspec-expectations (~> 2.14.0)
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # DiskStore
2
2
 
3
+ [![Travis CI](https://travis-ci.org/layervault/disk_store.png?branch=master)](https://travis-ci.org/layervault/disk_store)
4
+
3
5
  DiskStore is a way of caching large files to disk in Ruby. Unlike ActiveSupport::Cache::Store,
4
6
  which is designed primarily for storing values of strings, DiskStore is meant for
5
7
  caching files to disk.
data/Rakefile CHANGED
@@ -1,3 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
1
6
  task :console do
2
7
  require 'irb'
3
8
  require 'irb/completion'
@@ -5,3 +10,5 @@ task :console do
5
10
  ARGV.clear
6
11
  IRB.start
7
12
  end
13
+
14
+ task :default => :spec
data/lib/disk_store.rb CHANGED
@@ -23,6 +23,9 @@ class DiskStore
23
23
  f.flock File::LOCK_EX
24
24
  IO::copy_stream(io, f)
25
25
  ensure
26
+ # We need to make sure that any data written makes it to the disk.
27
+ # http://stackoverflow.com/questions/6701103/understanding-ruby-and-os-i-o-buffering
28
+ f.fsync
26
29
  f.flock File::LOCK_UN
27
30
  end
28
31
  end
@@ -38,6 +41,7 @@ class DiskStore
38
41
  File.delete(file_path)
39
42
  delete_empty_directories(File.dirname(file_path))
40
43
  end
44
+ true
41
45
  end
42
46
 
43
47
  def fetch(key)
@@ -1,3 +1,3 @@
1
1
  class DiskStore
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -52,7 +52,7 @@ describe DiskStore do
52
52
  it "deletes the file from disk" do
53
53
  cache.write(key, file)
54
54
  expect{
55
- cache.delete(key)
55
+ expect(cache.delete(key)).to be_true
56
56
  }.to change{ Dir[File.join(@tmpdir, "**/*")].size }.by(-3)
57
57
  end
58
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disk_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Sutton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-20 00:00:00.000000000 Z
11
+ date: 2014-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -88,6 +88,7 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - .gitignore
91
+ - .travis.yml
91
92
  - Gemfile
92
93
  - Gemfile.lock
93
94
  - README.md