dbd 0.1.2 → 0.1.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
- metadata.gz: addb45f3d6507ba21e2e57dfd6944ad4967cbd3a
4
- data.tar.gz: 4b55d219a8849a641b0ecaf4ad0bb6e37b67e0f4
3
+ metadata.gz: 004ab1807e35d982e643d33086ece8c962f8ae51
4
+ data.tar.gz: 2f4e8a6501dbc7d82d5d45f49d2375310093b510
5
5
  SHA512:
6
- metadata.gz: 09da0d26695087c4dfdd9a335c4b9bd68c819e9ff42e3f2811a620b1e5c59e8102dac0cd527408cde52aa0e2bd9616c69b446cb07d6bf04c29e9273e0d140601
7
- data.tar.gz: a621476363769544eaa06cfb64299e3d1c0044df1ea5e6ebceb4030eb1625d3dcabd4bac41098ae2f73dc4b1c4de167b065dd3a5723bc91ca2db311e5b8090e2
6
+ metadata.gz: 3883a3fa4c1c25ed9a8ea2271af6cfd84037ac8c9cfa2fa5739bc83faf1b1dcb6f60354283fff8511e84df07855df14545bbdcd4281c2d10260b2f1d657f6abf
7
+ data.tar.gz: e72ea1e28c849fb6e01624e2a8d1cd86bf72bce2152221acdbfcec7a65098f7eeb3c9f34dc97eac40ac4d4048e3b2d0ede726a31cd2587a06b20053480b932fe
@@ -141,3 +141,8 @@
141
141
  =====
142
142
 
143
143
  * Collection#freeze returns self (like Object.freeze)
144
+
145
+ 0.1.3 (5 Feb 2014)
146
+ =====
147
+
148
+ * tempfile_dir uses DbdDataEngine.default_data_dir if available
@@ -144,7 +144,7 @@ module Dbd
144
144
  # It seems that sometimes temp files are not properly
145
145
  # cleaned up.
146
146
  def on_sorted_file(filename)
147
- Tempfile.open('foo', 'data/') do |sorted_file|
147
+ Tempfile.open('foo', tempfile_dir) do |sorted_file|
148
148
  create_sorted_file(filename, sorted_file)
149
149
  yield(sorted_file)
150
150
  end
@@ -155,5 +155,13 @@ module Dbd
155
155
  `sort #{filename} > #{temp_name}`
156
156
  end
157
157
 
158
+ def tempfile_dir
159
+ if defined?(DbdDataEngine) && DbdDataEngine.respond_to?(:default_data_dir)
160
+ DbdDataEngine.default_data_dir
161
+ else
162
+ 'data'
163
+ end
164
+ end
165
+
158
166
  end
159
167
  end
@@ -1,3 +1,3 @@
1
1
  module Dbd
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -133,6 +133,38 @@ module Dbd
133
133
  graph = Graph.new
134
134
  graph.from_unsorted_CSV_file(filename).should be_a(described_class)
135
135
  end
136
+
137
+ describe 'tempfile_dir' do
138
+ context 'DbdDataEngine.default_data_dir is defined and present' do
139
+ before(:each) do
140
+ module DbdDataEngine
141
+ def self.default_data_dir
142
+ 'data/test'
143
+ end
144
+ end
145
+ end
146
+
147
+ after(:each) do
148
+ if defined?(DbdDataEngine)
149
+ begin
150
+ Object.send(:remove_const, :DbdDataEngine)
151
+ rescue NameError
152
+ end
153
+ end
154
+ end
155
+
156
+ it 'uses the default_data_dir for the temp file' do
157
+ filename = 'data/reverse.csv'
158
+ File.open(filename, 'w') do |f|
159
+ f << inverted_graph_facts_csv
160
+ end
161
+
162
+ graph = Graph.new
163
+ expect(Tempfile).to receive(:open).with('foo', 'data/test')
164
+ graph.from_unsorted_CSV_file(filename)
165
+ end
166
+ end
167
+ end
136
168
  end
137
169
  end
138
170
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Vandenabeele
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-26 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  version: '0'
268
268
  requirements: []
269
269
  rubyforge_project:
270
- rubygems_version: 2.0.3
270
+ rubygems_version: 2.1.11
271
271
  signing_key:
272
272
  specification_version: 4
273
273
  summary: A data store that (almost) never forgets