sinatra-mongomapper 1.0.0

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.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 John Bledsoe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Sinatra MongoMapper
2
+
3
+ A MongoMapper extension for Sinatra.
4
+
5
+ ## Installation
6
+
7
+ Install it with gem:
8
+
9
+ $ gem install sinatra-mongomapper
10
+
11
+ ## Usage
12
+
13
+ require 'sinatra'
14
+ require 'sinatra/mongomapper'
15
+
16
+ # Specify the database to use. *Required*
17
+ set :mongomapper, 'mongomapper://localhost:27017/example'
18
+
19
+ # Specify a logger to be used by the MongoDB driver
20
+ # Value can be any that the Logger accepts for initialization
21
+ # The following is the default setting
22
+ set :mongo_logfile, File.join("log", "mongo-driver-#{environment}.log")
23
+
24
+ # Assuming a MongoMapper document of Post
25
+ get '/' do
26
+ Post.all
27
+ haml :index
28
+ end
29
+
30
+ You can add a username and password for authentication:
31
+
32
+ set :mongomapper, 'mongomapper://username:password@localhost:27017/example'
33
+
34
+ Using a deferred value for <pre>:mongomapper</pre> doesn't work at this time.
35
+
36
+ ## Note on Patches/Pull Requests
37
+
38
+ * Fork the project.
39
+ * Make your feature addition or bug fix.
40
+ * Add tests for it. This is important so I don't break it in a
41
+ future version unintentionally.
42
+ * Commit, do not mess with rakefile, version, or history.
43
+ (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)
44
+ * Send me a pull request. Bonus points for topic branches.
45
+
46
+ ## Resources
47
+
48
+ * [Mongo Ruby Tutorial](http://www.mongodb.org/display/DOCS/Ruby+Tutorial)
49
+ * [MongoMapper](http://github.com/jnunemaker/mongomapper)
50
+ * [Sinatra](http://sinatrarb.com)
51
+
52
+ ## Copyright
53
+
54
+ Copyright (c) 2009 John Bledsoe. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gem|
4
+ gem.name = "sinatra-mongomapper"
5
+ gem.summary = "A MongoMapper extension for Sinatra."
6
+ gem.description = "You got your Ruby Mongo ODM mixed with my web framework!!!"
7
+ gem.email = "jcbledsoe@gmail.com"
8
+ gem.homepage = "http://github.com/slylencer/sinatra-mongomapper"
9
+ gem.authors = ["John Bledsoe"]
10
+
11
+ gem.add_dependency("sinatra")
12
+ gem.add_dependency("mongomapper")
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler not available. Install it with: gem install jeweler"
17
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,21 @@
1
+ require 'logger'
2
+ require 'mongo_mapper'
3
+ require 'uri'
4
+
5
+ module Sinatra
6
+ module MongoMapper
7
+ def self.registered(app)
8
+ app.set :mongo_logfile, File.join("log", "mongo-driver-#{environment}.log")
9
+ end
10
+
11
+ def mongomapper=(mongo_url)
12
+ url = URI(mongo_url)
13
+ logfile = ::Logger.new(mongo_logfile) if mongo_logfile
14
+ ::MongoMapper.connection = Mongo::Connection.new(url.host, url.port, :logfile => logfile)
15
+ ::MongoMapper.database = url.path.gsub(/^\//, '')
16
+ ::MongoMapper.database.authenticate(url.user, url.password) if url.user && url.password
17
+ end
18
+ end
19
+
20
+ register Sinatra::MongoMapper
21
+ end
@@ -0,0 +1,50 @@
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{sinatra-mongomapper}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["John Bledsoe"]
12
+ s.date = %q{2010-03-27}
13
+ s.description = %q{You got your Ruby Mongo ODM mixed with my web framework!!!}
14
+ s.email = %q{jcbledsoe@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.md",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/sinatra/mongomapper.rb",
26
+ "sinatra-mongomapper.gemspec"
27
+ ]
28
+ s.homepage = %q{http://github.com/slylencer/sinatra-mongomapper}
29
+ s.rdoc_options = ["--charset=UTF-8"]
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.3.6}
32
+ s.summary = %q{A MongoMapper extension for Sinatra.}
33
+
34
+ if s.respond_to? :specification_version then
35
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
+ s.specification_version = 3
37
+
38
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
39
+ s.add_runtime_dependency(%q<sinatra>, [">= 0"])
40
+ s.add_runtime_dependency(%q<mongomapper>, [">= 0"])
41
+ else
42
+ s.add_dependency(%q<sinatra>, [">= 0"])
43
+ s.add_dependency(%q<mongomapper>, [">= 0"])
44
+ end
45
+ else
46
+ s.add_dependency(%q<sinatra>, [">= 0"])
47
+ s.add_dependency(%q<mongomapper>, [">= 0"])
48
+ end
49
+ end
50
+
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-mongomapper
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - John Bledsoe
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-27 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: sinatra
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: mongomapper
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ description: You got your Ruby Mongo ODM mixed with my web framework!!!
45
+ email: jcbledsoe@gmail.com
46
+ executables: []
47
+
48
+ extensions: []
49
+
50
+ extra_rdoc_files:
51
+ - LICENSE
52
+ - README.md
53
+ files:
54
+ - .gitignore
55
+ - LICENSE
56
+ - README.md
57
+ - Rakefile
58
+ - VERSION
59
+ - lib/sinatra/mongomapper.rb
60
+ - sinatra-mongomapper.gemspec
61
+ has_rdoc: true
62
+ homepage: http://github.com/slylencer/sinatra-mongomapper
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options:
67
+ - --charset=UTF-8
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirements: []
85
+
86
+ rubyforge_project:
87
+ rubygems_version: 1.3.6
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: A MongoMapper extension for Sinatra.
91
+ test_files: []
92
+