pickle-mongo_mapper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source :rubygems
2
+ gem "mongo_mapper", "~>0.7.5"
3
+ gem "pickle", ">=0.3.0"
4
+
5
+ group :development do
6
+ gem "rspec", '>=1.3.0'
7
+ gem "bundler"
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (2.3.8)
5
+ bson (1.0)
6
+ jnunemaker-validatable (1.8.4)
7
+ activesupport (>= 2.3.4)
8
+ mongo (1.0)
9
+ bson (= 1.0)
10
+ mongo_mapper (0.7.5)
11
+ activesupport (>= 2.3.4)
12
+ jnunemaker-validatable (= 1.8.4)
13
+ mongo (= 1.0)
14
+ pickle (0.3.0)
15
+ rspec (1.3.0)
16
+
17
+ PLATFORMS
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ bundler
22
+ mongo_mapper (~> 0.7.5)
23
+ pickle (>= 0.3.0)
24
+ rspec (>= 1.3.0)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Marcin Ciunelis
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,27 @@
1
+ = pickle-mongo_mapper
2
+
3
+ ianwhite's pickle mongoid adapter
4
+
5
+ == Installation
6
+
7
+ You can let bundler to install pickle-mongo_mapper by adding this line to your application's Gemfile:
8
+
9
+ gem 'pickle-mongo_mapper'
10
+
11
+ And then execute:
12
+
13
+ bundle install
14
+
15
+ == Note on Patches/Pull Requests
16
+
17
+ * Fork the project.
18
+ * Make your feature addition or bug fix.
19
+ * Add tests for it. This is important so I don't break it in a
20
+ future version unintentionally.
21
+ * Commit, do not mess with rakefile, version, or history.
22
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
23
+ * Send me a pull request. Bonus points for topic branches.
24
+
25
+ == Copyright
26
+
27
+ Copyright (c) 2010 Marcin Ciunelis. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'bundler'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "pickle-mongo_mapper"
9
+ gem.summary = %Q{ianwhite's pickle mongo_mapper adapter}
10
+ gem.email = "marcin.ciunelis@gmail.com"
11
+ gem.homepage = "http://github.com/martinciu/pickle-mongo_mapper"
12
+ gem.authors = ["Marcin Ciunelis"]
13
+ gem.add_bundler_dependencies
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
18
+ end
19
+
20
+ require 'spec/rake/spectask'
21
+ Spec::Rake::SpecTask.new(:spec) do |spec|
22
+ spec.libs << 'lib' << 'spec'
23
+ spec.spec_files = FileList['spec/**/*_spec.rb']
24
+ end
25
+
26
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.pattern = 'spec/**/*_spec.rb'
29
+ spec.rcov = true
30
+ end
31
+
32
+ task :spec => :check_dependencies
33
+
34
+ task :default => :spec
35
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,80 @@
1
+ # MongoID adapter for Pickle
2
+ require 'mongo_mapper'
3
+
4
+ module MongoMapper #:nodoc:
5
+ module Document
6
+ module PickleAdapter
7
+ include Pickle::Adapter::Base
8
+
9
+ # Do not consider these to be part of the class list
10
+ def self.except_classes
11
+ @@except_classes ||= []
12
+ end
13
+
14
+ # Gets a list of the available models for this adapter
15
+ def self.model_classes
16
+ @@model_classes ||= ObjectSpace.each_object(Class).select {|klass| klass.ancestors.include?(MongoMapper::Document) || klass.ancestors.include?(MongoMapper::EmbeddedDocument)}
17
+ end
18
+
19
+ # get a list of column names for a given class
20
+ def self.column_names(klass)
21
+ #klass.column_names
22
+ klass.keys.keys.to_a
23
+ end
24
+
25
+ # Get an instance by id of the model
26
+ def self.get_model(klass, id)
27
+ klass.find(id)
28
+ end
29
+
30
+ # Find the first instance matching conditions
31
+ def self.find_first_model(klass, conditions)
32
+ klass.first(conditions)
33
+ end
34
+
35
+ # Find all models matching conditions
36
+ def self.find_all_models(klass, conditions)
37
+ klass.all(:conditions => conditions)
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ module MongoMapper #:nodoc:
44
+ module EmbeddedDocument
45
+ module PickleAdapter
46
+ include Pickle::Adapter::Base
47
+
48
+ # Do not consider these to be part of the class list
49
+ def self.except_classes
50
+ @@except_classes ||= []
51
+ end
52
+
53
+ # Gets a list of the available models for this adapter
54
+ def self.model_classes
55
+ @@model_classes ||= ObjectSpace.each_object(Class).select {|klass| klass.ancestors.include?(MongoMapper::Document) || klass.ancestors.include?(MongoMapper::EmbeddedDocument)}
56
+ end
57
+
58
+ # get a list of column names for a given class
59
+ def self.column_names(klass)
60
+ #klass.column_names
61
+ klass.keys.keys
62
+ end
63
+
64
+ # Get an instance by id of the model
65
+ def self.get_model(klass, id)
66
+ klass.find(id)
67
+ end
68
+
69
+ # Find the first instance matching conditions
70
+ def self.find_first_model(klass, conditions)
71
+ klass.first(conditions)
72
+ end
73
+
74
+ # Find all models matching conditions
75
+ def self.find_all_models(klass, conditions)
76
+ klass.all(:conditions => conditions)
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1 @@
1
+ require 'pickle/adapters/mongo_mapper'
@@ -0,0 +1,66 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{pickle-mongo_mapper}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Marcin Ciunelis"]
12
+ s.date = %q{2010-07-18}
13
+ s.email = %q{marcin.ciunelis@gmail.com}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ ".gitignore",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/pickle-mongo_mapper.rb",
28
+ "lib/pickle/adapters/mongo_mapper.rb",
29
+ "pickle-mongo_mapper.gemspec",
30
+ "spec/pickle-mongo_mapper_spec.rb",
31
+ "spec/spec.opts",
32
+ "spec/spec_helper.rb"
33
+ ]
34
+ s.homepage = %q{http://github.com/martinciu/pickle-mongo_mapper}
35
+ s.rdoc_options = ["--charset=UTF-8"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = %q{1.3.7}
38
+ s.summary = %q{ianwhite's pickle mongo_mapper adapter}
39
+ s.test_files = [
40
+ "spec/pickle-mongo_mapper_spec.rb",
41
+ "spec/spec_helper.rb"
42
+ ]
43
+
44
+ if s.respond_to? :specification_version then
45
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
+ s.specification_version = 3
47
+
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
+ s.add_runtime_dependency(%q<mongo_mapper>, ["~> 0.7.5"])
50
+ s.add_runtime_dependency(%q<pickle>, [">= 0.3.0"])
51
+ s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
52
+ s.add_development_dependency(%q<bundler>, [">= 0"])
53
+ else
54
+ s.add_dependency(%q<mongo_mapper>, ["~> 0.7.5"])
55
+ s.add_dependency(%q<pickle>, [">= 0.3.0"])
56
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
57
+ s.add_dependency(%q<bundler>, [">= 0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<mongo_mapper>, ["~> 0.7.5"])
61
+ s.add_dependency(%q<pickle>, [">= 0.3.0"])
62
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
63
+ s.add_dependency(%q<bundler>, [">= 0"])
64
+ end
65
+ end
66
+
@@ -0,0 +1,27 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ class Post
4
+ include MongoMapper::Document
5
+ end
6
+
7
+ class Comment
8
+ include MongoMapper::EmbeddedDocument
9
+ end
10
+
11
+ class Dummy
12
+ end
13
+
14
+ describe Pickle::Adapter do
15
+
16
+ describe ".model_classes" do
17
+ it "should return MongoMapper::Document classes" do
18
+ Pickle::Adapter.model_classes.should include(Post, Comment)
19
+ end
20
+
21
+ it "should not return other classes" do
22
+ Pickle::Adapter.model_classes.should_not include(Dummy)
23
+ end
24
+
25
+ end
26
+
27
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ begin
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems"
9
+ exit e.status_code
10
+ end
11
+
12
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ require 'mongo_mapper'
15
+ require 'pickle'
16
+ require 'pickle-mongo_mapper'
17
+ require 'spec'
18
+ require 'spec/autorun'
19
+
20
+ Spec::Runner.configure do |config|
21
+
22
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pickle-mongo_mapper
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Marcin Ciunelis
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-18 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ hash: 9
28
+ segments:
29
+ - 0
30
+ - 7
31
+ - 5
32
+ version: 0.7.5
33
+ type: :runtime
34
+ name: mongo_mapper
35
+ prerelease: false
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 19
44
+ segments:
45
+ - 0
46
+ - 3
47
+ - 0
48
+ version: 0.3.0
49
+ type: :runtime
50
+ name: pickle
51
+ prerelease: false
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 27
60
+ segments:
61
+ - 1
62
+ - 3
63
+ - 0
64
+ version: 1.3.0
65
+ type: :development
66
+ name: rspec
67
+ prerelease: false
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ type: :development
80
+ name: bundler
81
+ prerelease: false
82
+ version_requirements: *id004
83
+ description:
84
+ email: marcin.ciunelis@gmail.com
85
+ executables: []
86
+
87
+ extensions: []
88
+
89
+ extra_rdoc_files:
90
+ - LICENSE
91
+ - README.rdoc
92
+ files:
93
+ - .document
94
+ - .gitignore
95
+ - Gemfile
96
+ - Gemfile.lock
97
+ - LICENSE
98
+ - README.rdoc
99
+ - Rakefile
100
+ - VERSION
101
+ - lib/pickle-mongo_mapper.rb
102
+ - lib/pickle/adapters/mongo_mapper.rb
103
+ - pickle-mongo_mapper.gemspec
104
+ - spec/pickle-mongo_mapper_spec.rb
105
+ - spec/spec.opts
106
+ - spec/spec_helper.rb
107
+ has_rdoc: true
108
+ homepage: http://github.com/martinciu/pickle-mongo_mapper
109
+ licenses: []
110
+
111
+ post_install_message:
112
+ rdoc_options:
113
+ - --charset=UTF-8
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
124
+ version: "0"
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ requirements: []
135
+
136
+ rubyforge_project:
137
+ rubygems_version: 1.3.7
138
+ signing_key:
139
+ specification_version: 3
140
+ summary: ianwhite's pickle mongo_mapper adapter
141
+ test_files:
142
+ - spec/pickle-mongo_mapper_spec.rb
143
+ - spec/spec_helper.rb