Permalink
Browse files

Initial scaffolding for gem

  • Loading branch information...
0 parents commit 00e48d5578a4e39fe002d6a967ca2fe71a7f9395 @alindeman alindeman committed Jun 27, 2011
Showing with 60 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +4 −0 Gemfile
  3. +1 −0 Rakefile
  4. +9 −0 lib/mm-optimistic_locking.rb
  5. +7 −0 lib/mongo_mapper/stale_document_error.rb
  6. +35 −0 mm-optimistic_locking.gemspec
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in mm-optimistic_locking.gemspec
+gemspec
@@ -0,0 +1 @@
+require 'bundler/gem_tasks'
@@ -0,0 +1,9 @@
+module MongoMapper
+ autoload :StaleDocumentError, "mongo_mapper/stale_document_error"
+
+ module Plugins
+ module OptimisticLocking
+ VERSION = "0.0.1"
+ end
+ end
+end
@@ -0,0 +1,7 @@
+module MongoMapper
+ class StaleDocumentError < MongoMapper::Error
+ def initialize(document)
+ super("Document #{document.inspect} is stale and must be reloaded from MongoDB")
+ end
+ end
+end
@@ -0,0 +1,35 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "mm-optimistic_locking"
+
+Gem::Specification.new do |s|
+ s.name = "mm-optimistic_locking"
+ s.version = MongoMapper::Plugins::OptimisticLocking::VERSION
+ s.authors = ["Andy Lindeman"]
+ s.email = ["andy@highgroove.com"]
+ s.homepage = "http://github.com/highgroove/mm-optimistic_locking"
+ s.summary = %q{Implements optimistic locking (similar to ActiveRecord) for MongoMapper}
+ 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.}
+
+ s.files = [
+ ".gitignore",
+ "Gemfile",
+ "Rakefile",
+ "lib/mm-optimistic_locking.rb",
+ "lib/mongo_mapper/stale_document_error.rb",
+ "mm-optimistic_locking.gemspec",
+ ]
+
+ s.test_files = [
+ ]
+
+ s.executables = [
+ ]
+
+ s.require_paths = ["lib"]
+
+ s.add_dependency 'mongo_mapper', '~>0.9.0'
+ s.add_dependency 'activesupport', '~>3.0'
+
+ s.add_development_dependency 'rspec', '~>2.6.0'
+end

0 comments on commit 00e48d5

Please sign in to comment.