dm-xml-adapter 0.578 → 0.581
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.
- data/README +1 -0
- data/lib/dm-xml-adapter.rb +8 -3
- data/spec/dm-xml-adapter_spec.rb +2 -0
- metadata +2 -2
data/README
CHANGED
data/lib/dm-xml-adapter.rb
CHANGED
@@ -57,9 +57,14 @@ module DataMapper::Adapters
|
|
57
57
|
|
58
58
|
class XmlAdapter < AbstractAdapter
|
59
59
|
|
60
|
+
def self.threads=(count)
|
61
|
+
@@threadcount = count
|
62
|
+
end
|
63
|
+
|
60
64
|
def initialize(name, options)
|
61
65
|
super
|
62
66
|
|
67
|
+
@@threadcount = 1
|
63
68
|
@options = Hash.new
|
64
69
|
@options[:directory] = options[:directory]
|
65
70
|
@options[:directory] ||= './db'
|
@@ -217,13 +222,13 @@ module DataMapper::Adapters
|
|
217
222
|
# we need to create it...
|
218
223
|
if ! File.exists?(classname_to_dir(class_name))
|
219
224
|
# default ID
|
220
|
-
return
|
225
|
+
return 1
|
221
226
|
end
|
222
227
|
directory = Dir.new(classname_to_dir(class_name))
|
223
228
|
if directory.entries.size == 0
|
224
|
-
return
|
229
|
+
return 1
|
225
230
|
end
|
226
|
-
id = @last_used_id[class_name] ||
|
231
|
+
id = @last_used_id[class_name] || 1
|
227
232
|
while true do
|
228
233
|
if ! File.exists?(File.join(directory.path, id.to_s + ".xml"))
|
229
234
|
@last_used_id[class_name] = id
|
data/spec/dm-xml-adapter_spec.rb
CHANGED
@@ -3,6 +3,8 @@ require 'dm-core'
|
|
3
3
|
require 'pathname'
|
4
4
|
require Pathname(__FILE__).dirname.expand_path + 'spec_helper'
|
5
5
|
|
6
|
+
DataMapper::Adapters::XmlAdapter.threads = 2
|
7
|
+
|
6
8
|
describe DataMapper::Adapters::XmlAdapter do
|
7
9
|
before(:each) do
|
8
10
|
@adapter = DataMapper.setup(:default, {:adapter => 'xml', :directory => 'db'})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-xml-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.581"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Harding
|
@@ -9,7 +9,7 @@ autorequire: dm-xml-adapter
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-07-01 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|