Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit b6a3ae45112aa00d781ec08da4e43c568cd6e536 @benedikt committed
Showing with 135 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +2 −0 .rspec
  3. +3 −0 Gemfile
  4. +20 −0 LICENSE
  5. +38 −0 README.rdoc
  6. +26 −0 Rakefile
  7. +1 −0 autotest/discover.rb
  8. +20 −0 mongoid_tree.gemspec
  9. +21 −0 spec/spec_helper.rb
4 .gitignore
@@ -0,0 +1,4 @@
+.DS_Store
+Gemfile.lock
+doc
+*.gem
2 .rspec
@@ -0,0 +1,2 @@
+--color
+--format documentation
3 Gemfile
@@ -0,0 +1,3 @@
+gemspec
+
+gem 'bson_ext', '1.0.4'
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2010 Benedikt Deicke
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 README.rdoc
@@ -0,0 +1,38 @@
+= mongoid_tree
+
+A tree structure for Mongoid documents using the materialized path pattern
+
+== Requirements
+
+* mongoid (>= 2.0.0.beta9)
+
+== Install
+
+To install mongoid_tree, simply add it to your Gemfile:
+
+ gem "mongoid_tree"
+
+In order to get the latest development version of mongoid_tree:
+
+ gem "mongoid_tree", :git => "git://github.com/benedikt/mongoid_tree"
+
+Finally, run
+
+ bundle install
+
+== Usage
+
+Read the API documentation at http://rdoc.info/projects/benedikt/mongoid_tree
+
+ class Node
+ include Mongoid::Document
+ include Mongoid::Tree
+ end
+
+== Known issues
+
+See http://github.com/benedikt/mongoid_tree/issues
+
+== Copyright
+
+Copyright (c) 2010 Benedikt Deicke. See LICENSE for details.
26 Rakefile
@@ -0,0 +1,26 @@
+require 'rspec/core/rake_task'
+require 'rake/rdoctask'
+
+spec = Gem::Specification.load("mongoid_tree.gemspec")
+
+RSpec::Core::RakeTask.new(:spec)
+
+task :default => :spec
+
+Rake::RDocTask.new do |rdoc|
+ rdoc.rdoc_dir = 'doc'
+ rdoc.title = "#{spec.name} #{spec.version}"
+ rdoc.options += spec.rdoc_options
+ rdoc.rdoc_files.include(spec.extra_rdoc_files)
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+desc "Build the .gem file"
+task :build do
+ system "gem build #{spec.name}.spec"
+end
+
+desc "Push the .gem file to rubygems.org"
+task :release => :build do
+ system "gem push #{spec.name}-#{spec.version}.gem"
+end
1 autotest/discover.rb
@@ -0,0 +1 @@
+Autotest.add_discovery { "rspec2" }
20 mongoid_tree.gemspec
@@ -0,0 +1,20 @@
+Gem::Specification.new do |s|
+ s.name = 'mongoid_tree'
+ s.version = '0.1'
+ s.platform = Gem::Platform::RUBY
+ s.authors = ['Benedikt Deicke']
+ s.email = ['benedikt@synatic.net']
+ s.homepage = 'http://github.com/benedikt/mongoid_tree'
+ s.summary = 'A tree structure for Mongoid documents'
+ s.description = 'A tree structure for Mongoid documents using the materialized path pattern'
+
+ s.has_rdoc = true
+ s.rdoc_options = ['--main', 'README.rdoc', '--charset=UTF-8']
+ s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
+
+ s.files = Dir.glob('{lib,spec}/**/*') + %w(LICENSE README.rdoc Rakefile Gemfile .rspec)
+
+ s.add_runtime_dependency('mongoid', ['>= 2.0.0.beta9'])
+ s.add_development_dependency('rspec', ['>= 2.0.0.beta.18'])
+ s.add_development_dependency('autotest', ['>= 4.3.2'])
+end
21 spec/spec_helper.rb
@@ -0,0 +1,21 @@
+require 'rubygems'
+require 'bundler/setup'
+
+require 'mongoid'
+require 'mongoid/tree'
+
+require 'rspec'
+
+Dir['#{File.dirname(__FILE__)}/support/**/*.rb'].each { |f| require f }
+
+RSpec.configure do |config|
+ config.mock_with :rspec
+ config.after :each do
+ Mongoid.master.collections.reject { |c| c.name =~ /^system\./ }.each(&:drop)
+ end
+end
+
+Mongoid.configure do |config|
+ config.master = Mongo::Connection.new.db('mongoid_tree_test')
+ config.allow_dynamic_fields = false
+end

0 comments on commit b6a3ae4

Please sign in to comment.
Something went wrong with that request. Please try again.