rack-datamapper 0.2.4 → 0.2.5

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.
@@ -1,3 +1,7 @@
1
+ === 0.2.5 / 2009-12-04
2
+
3
+ * restful transaction does commit on status between 200 and 399 now
4
+
1
5
  === 0.2.3 / 2009-10-06
2
6
 
3
7
  * added mapping to fix naming problem between rack_datamapper and rack-datamapper
@@ -17,7 +17,7 @@ module DataMapper
17
17
  transaction = DataMapper::Transaction.new(DataMapper.repository(@name))
18
18
  transaction.commit do
19
19
  status, headers, response = @app.call(env)
20
- raise Rollback unless [301, 302, 303, 307].include?(status)
20
+ raise Rollback unless (200 <= status && status < 400)
21
21
  end
22
22
  rescue Rollback
23
23
  # ignore,
@@ -7,7 +7,7 @@ module DataMapper
7
7
 
8
8
  def initialize(app, options, id_generator)
9
9
  @mutex = Mutex.new
10
- if options.delete(:cache)
10
+ if cache = options.delete(:cache)
11
11
  @@cache = if RUBY_PLATFORM =~ /java/
12
12
  begin
13
13
  # to avoid memory leaks use a hashmap which clears
@@ -27,7 +27,7 @@ module DataMapper
27
27
  end
28
28
  @@semaphore = Mutex.new
29
29
  else
30
- @@cache = nil unless self.class.class_variable_defined? :@@cache
30
+ @@cache = nil unless cache.nil? && self.class.class_variable_defined?(:@@cache)
31
31
  end
32
32
  @@session_class = options.delete(:session_class) || Session unless (self.class.class_variable_defined?(:@@session_class) and @@session_class)
33
33
  @id_generator = id_generator
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module DataMapper
3
- VERSION = '0.2.4'.freeze
3
+ VERSION = '0.2.5'.freeze
4
4
  end
5
5
  end
@@ -84,7 +84,7 @@ describe DataMapper::RestfulTransactions do
84
84
 
85
85
  it 'should rollback when status is not redirect and method is not GET' do
86
86
  mock_request.should_receive(:request_method).any_number_of_times.and_return("PUT")
87
- app = RestfulTransactionsApp.new(200) do
87
+ app = RestfulTransactionsApp.new(404) do
88
88
  Name.create(:name => 'first')
89
89
  # TODO is this read uncommited ?
90
90
  Name.all.size.should == 1
@@ -92,7 +92,7 @@ describe DataMapper::RestfulTransactions do
92
92
  DataMapper::RestfulTransactions.new(app).call(nil)
93
93
  Name.all.size.should == 0
94
94
 
95
- app = RestfulTransactionsApp.new(404) do
95
+ app = RestfulTransactionsApp.new(100) do
96
96
  Name.create(:name => 'first')
97
97
  # TODO is this read uncommited ?
98
98
  Name.all.size.should == 1
@@ -1,12 +1,10 @@
1
1
  require 'pathname'
2
2
  require 'rubygems'
3
-
4
- gem 'rspec', '~>1.2'
5
- require 'spec'
6
-
3
+ gem 'dm-core', '0.9.10'
7
4
  $LOAD_PATH << Pathname(__FILE__).dirname.parent.expand_path + 'lib'
8
5
  require 'rack_datamapper'
9
-
6
+ require 'dm-core/version'
7
+ p DataMapper::VERSION
10
8
  def load_driver(name, default_uri)
11
9
  return false if ENV['ADAPTER'] != name.to_s
12
10
 
@@ -15,6 +13,7 @@ def load_driver(name, default_uri)
15
13
  DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
16
14
  true
17
15
  rescue LoadError => e
16
+ p e.backtrace
18
17
  warn "Could not load do_#{name}: #{e}"
19
18
  false
20
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-datamapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - mkristian
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-29 00:00:00 +05:30
12
+ date: 2009-12-18 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements: []
89
89
 
90
90
  rubyforge_project: rack-datamapper
91
- rubygems_version: 1.3.4
91
+ rubygems_version: 1.3.5
92
92
  signing_key:
93
93
  specification_version: 3
94
94
  summary: this collection of plugins helps to add datamapper functionality to Rack