sinatra-mongoid 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/README.md +18 -11
- data/VERSION +1 -1
- data/lib/sinatra/mongoid.rb +2 -1
- data/sinatra-mongoid.gemspec +2 -2
- metadata +2 -2
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -6,21 +6,21 @@ A Mongoid extension for Sinatra.
|
|
6
6
|
Usage
|
7
7
|
-----
|
8
8
|
|
9
|
-
|
9
|
+
Gemfile:
|
10
10
|
|
11
|
-
|
11
|
+
gem 'sinatra'
|
12
|
+
gem 'sinatra-mongoid', :require_as => 'sinatra/mongoid'
|
12
13
|
|
13
|
-
|
14
|
+
Bundle:
|
15
|
+
|
16
|
+
gem bundle
|
14
17
|
|
15
|
-
|
16
|
-
require 'sinatra'
|
17
|
-
require 'sinatra/mongoid'
|
18
|
+
Create your Sinatra app:
|
18
19
|
|
19
|
-
|
20
|
+
require File.dirname(__FILE__) + '/vendor/gems/environment'
|
21
|
+
Bundler.require_env
|
20
22
|
|
21
|
-
|
22
|
-
set :mongo_host, 'db.mongohq.com'
|
23
|
-
end
|
23
|
+
set :mongo_db, 'db-name'
|
24
24
|
|
25
25
|
Configuration
|
26
26
|
-------------
|
@@ -29,13 +29,15 @@ All Sinatra options you can set are:
|
|
29
29
|
|
30
30
|
:mongo_host
|
31
31
|
:mongo_db
|
32
|
+
:mongo_port
|
32
33
|
:mongo_user
|
33
34
|
:mongo_password
|
34
35
|
|
35
36
|
Their default values are:
|
36
37
|
|
37
38
|
ENV['MONGO_HOST'] || 'localhost'
|
38
|
-
ENV['MONGO_DB']
|
39
|
+
ENV['MONGO_DB'] || 'changme'
|
40
|
+
ENV['MONGO_PORT'] || Mongo::Connection::DEFAULT_PORT
|
39
41
|
ENV['MONGO_USER']
|
40
42
|
ENV['MONGO_PASSWORD']
|
41
43
|
|
@@ -44,3 +46,8 @@ Resources
|
|
44
46
|
|
45
47
|
* [Mongoid](http://mongoid.org)
|
46
48
|
* [Sinatra](http://sinatrarb.com)
|
49
|
+
|
50
|
+
Authors
|
51
|
+
-------
|
52
|
+
|
53
|
+
Dan Croak, Justin Reidy.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/sinatra/mongoid.rb
CHANGED
@@ -6,10 +6,11 @@ module Sinatra
|
|
6
6
|
def self.registered(app)
|
7
7
|
app.set :mongo_host, ENV['MONGO_HOST'] || 'localhost'
|
8
8
|
app.set :mongo_db, ENV['MONGO_DB'] || 'changeme'
|
9
|
+
app.set :mongo_port, ENV['MONGO_PORT'] || Mongo::Connection::DEFAULT_PORT
|
9
10
|
app.set :mongo_user, ENV['MONGO_USER']
|
10
11
|
app.set :mongo_password, ENV['MONGO_PASSWORD']
|
11
12
|
|
12
|
-
Mongoid.database = Mongo::Connection.new(app.mongo_host).
|
13
|
+
Mongoid.database = Mongo::Connection.new(app.mongo_host,app.mongo_port).
|
13
14
|
db(app.mongo_db)
|
14
15
|
if app.mongo_user
|
15
16
|
Mongoid.database.authenticate(app.mongo_user,
|
data/sinatra-mongoid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra-mongoid}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dan Croak"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-02-21}
|
13
13
|
s.description = %q{Like a blind date for the nastiest Ruby Mongo ORM and web framework.}
|
14
14
|
s.email = %q{dcroak@thoughtbot.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Croak
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-21 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|