dm-xml-adapter 0.578 → 0.581

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1 +1,2 @@
1
1
  This is an XML adapter.
2
+ Set DataMapper::Adapters::XmlAdapter.threads = 2 or more in jruby...
@@ -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 0
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 0
229
+ return 1
225
230
  end
226
- id = @last_used_id[class_name] || 0
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
@@ -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.578"
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-06-06 00:00:00 -04:00
12
+ date: 2010-07-01 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency