mm-optimistic_locking 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in mm-optimistic_locking.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
@@ -0,0 +1,17 @@
1
+ require 'mongo_mapper'
2
+
3
+ module MongoMapper
4
+ autoload :StaleDocumentError, "mongo_mapper/stale_document_error"
5
+
6
+ module Plugins
7
+ autoload :OptimisticLocking, "mongo_mapper/plugins/optimistic_locking.rb"
8
+ end
9
+
10
+ module Plugins
11
+ module Querying
12
+ module InstanceMethods
13
+ include MongoMapper::Plugins::OptimisticLocking::QueryingInterceptor
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ module MongoMapper
2
+ class StaleDocumentError < MongoMapper::Error
3
+ def initialize(document)
4
+ super("Document #{document.inspect} is stale and must be reloaded from MongoDB")
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mm-optimistic_locking"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "mm-optimistic_locking"
7
+ s.version = MongoMapper::Plugins::OptimisticLocking::VERSION
8
+ s.authors = ["Andy Lindeman"]
9
+ s.email = ["andy@highgroove.com"]
10
+ s.homepage = "http://github.com/highgroove/mm-optimistic_locking"
11
+ s.summary = %q{Implements optimistic locking (similar to ActiveRecord) for MongoMapper}
12
+ s.description = %q{Before a record is saved, mm-optimistic_locking will check if it has been modified by another process. If so, a StaleDocumentError will be raised. The object can be reloaded and resaved after the conflict has been resolved.}
13
+
14
+ s.files = [
15
+ ".gitignore",
16
+ "Gemfile",
17
+ "Rakefile",
18
+ "lib/mm-optimistic_locking.rb",
19
+ "lib/mongo_mapper/stale_document_error.rb",
20
+ "mm-optimistic_locking.gemspec",
21
+ ]
22
+
23
+ s.test_files = [
24
+ ]
25
+
26
+ s.executables = [
27
+ ]
28
+
29
+ s.require_paths = ["lib"]
30
+
31
+ s.add_dependency 'mongo_mapper', '~>0.9.0'
32
+ s.add_dependency 'activesupport', '~>3.0'
33
+
34
+ s.add_development_dependency 'rake', '~>0.8.7'
35
+ s.add_development_dependency 'rspec', '~>2.6.0'
36
+ s.add_development_dependency 'database_cleaner', '~>0.6.7'
37
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mm-optimistic_locking
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Andy Lindeman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-06-27 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: mongo_mapper
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 0.9.0
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: "3.0"
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rake
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 0.8.7
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ version: 2.6.0
58
+ type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: database_cleaner
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.6.7
69
+ type: :development
70
+ version_requirements: *id005
71
+ description: Before a record is saved, mm-optimistic_locking will check if it has been modified by another process. If so, a StaleDocumentError will be raised. The object can be reloaded and resaved after the conflict has been resolved.
72
+ email:
73
+ - andy@highgroove.com
74
+ executables: []
75
+
76
+ extensions: []
77
+
78
+ extra_rdoc_files: []
79
+
80
+ files:
81
+ - .gitignore
82
+ - Gemfile
83
+ - Rakefile
84
+ - lib/mm-optimistic_locking.rb
85
+ - lib/mongo_mapper/stale_document_error.rb
86
+ - mm-optimistic_locking.gemspec
87
+ has_rdoc: true
88
+ homepage: http://github.com/highgroove/mm-optimistic_locking
89
+ licenses: []
90
+
91
+ post_install_message:
92
+ rdoc_options: []
93
+
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: "0"
108
+ requirements: []
109
+
110
+ rubyforge_project:
111
+ rubygems_version: 1.6.2
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: Implements optimistic locking (similar to ActiveRecord) for MongoMapper
115
+ test_files: []
116
+