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 +4 -4
- data/HISTORY.txt +5 -0
- data/lib/dbd/graph.rb +9 -1
- data/lib/dbd/version.rb +1 -1
- data/spec/lib/dbd/graph/from_csv_spec.rb +32 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 004ab1807e35d982e643d33086ece8c962f8ae51
|
4
|
+
data.tar.gz: 2f4e8a6501dbc7d82d5d45f49d2375310093b510
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3883a3fa4c1c25ed9a8ea2271af6cfd84037ac8c9cfa2fa5739bc83faf1b1dcb6f60354283fff8511e84df07855df14545bbdcd4281c2d10260b2f1d657f6abf
|
7
|
+
data.tar.gz: e72ea1e28c849fb6e01624e2a8d1cd86bf72bce2152221acdbfcec7a65098f7eeb3c9f34dc97eac40ac4d4048e3b2d0ede726a31cd2587a06b20053480b932fe
|
data/HISTORY.txt
CHANGED
data/lib/dbd/graph.rb
CHANGED
@@ -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',
|
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
|
data/lib/dbd/version.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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
|