sinatra-mongoid-config 0.1.0 → 0.1.1
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/README.md +20 -16
- metadata +4 -4
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
sinatra-mongoid-config
|
2
2
|
======================
|
3
3
|
|
4
|
-
|
4
|
+
Add Monogid to your Sinatra app with potentially zero-configuration. Lazily create the database connection whenever needed.
|
5
5
|
|
6
6
|
Installation
|
7
7
|
------------
|
8
8
|
|
9
|
-
It
|
9
|
+
It‘s available as a gem via RubyGems.org, so use standard procedure:
|
10
10
|
|
11
11
|
$ gem install sinatra-mongoid-config
|
12
12
|
|
@@ -15,9 +15,9 @@ If you're using Bundler, just add `gem "sinatra-mongoid-config"` to your `Gemfil
|
|
15
15
|
Using the Extension
|
16
16
|
-------------------
|
17
17
|
|
18
|
-
This extension works fine with both
|
18
|
+
This extension works fine with both “classic” Sinatra apps, as well as “modular” apps which inherit from `Sinatra::Base`. How you use the extension varies slightly between styles.
|
19
19
|
|
20
|
-
###
|
20
|
+
### “Classic”
|
21
21
|
|
22
22
|
require 'rubygems'
|
23
23
|
require 'sinatra'
|
@@ -27,7 +27,7 @@ This extension works fine with both "classic" Sinatra apps, as well as "modular"
|
|
27
27
|
'It works!'
|
28
28
|
end
|
29
29
|
|
30
|
-
###
|
30
|
+
### “Modular”
|
31
31
|
|
32
32
|
require 'rubygems'
|
33
33
|
require 'sinatra'
|
@@ -46,7 +46,7 @@ This extension works fine with both "classic" Sinatra apps, as well as "modular"
|
|
46
46
|
Options & Defaults
|
47
47
|
------------------
|
48
48
|
|
49
|
-
All options are set using Sinatra
|
49
|
+
All options are set using Sinatra’s standard `set` method. Remember that you can also change settings for each environment:
|
50
50
|
|
51
51
|
configure do
|
52
52
|
set :mongo_db, 'the_database'
|
@@ -58,14 +58,16 @@ All options are set using Sinatra's standard `set` method. Remember that you can
|
|
58
58
|
set :mongo_user, 'the_user'
|
59
59
|
set :mongo_password, 'the_password'
|
60
60
|
end
|
61
|
+
|
62
|
+
### Defaults
|
61
63
|
|
62
64
|
All configuration options have **sensible defaults listed below**, and depending on your situation, you may not have to set anything.
|
63
65
|
|
64
66
|
<table>
|
65
67
|
<thead>
|
66
68
|
<tr>
|
67
|
-
<th
|
68
|
-
<th
|
69
|
+
<th>Option</th>
|
70
|
+
<th>Default</th>
|
69
71
|
</tr>
|
70
72
|
</thead>
|
71
73
|
<tbody>
|
@@ -92,36 +94,38 @@ All configuration options have **sensible defaults listed below**, and depending
|
|
92
94
|
</tbody>
|
93
95
|
</table>
|
94
96
|
|
95
|
-
|
97
|
+
### Default DB Naming Convention
|
98
|
+
|
99
|
+
Did you notice that the default for `:mongo_db` calls `self.app_to_db_name`? That method attempts to be smart about what your database is named by using **the class name of your app and the current environment**. The real benefit here is for those who are creating "modular" apps, as they are named something other than the Sinatra default. Here are some examples:
|
96
100
|
|
97
101
|
<table>
|
98
102
|
<thead>
|
99
103
|
<tr>
|
100
|
-
<th
|
101
|
-
<th
|
102
|
-
<th
|
104
|
+
<th>App’s Class Name</th>
|
105
|
+
<th>Environment</th>
|
106
|
+
<th>Resulting Database Name</th>
|
103
107
|
</tr>
|
104
108
|
</thead>
|
105
109
|
<tbody>
|
106
110
|
<tr>
|
107
111
|
<td><code>Refresh</code></td>
|
108
112
|
<td><code>:development</code></td>
|
109
|
-
<td><code>refresh_development</code></td>
|
113
|
+
<td><code>'refresh_development'</code></td>
|
110
114
|
</tr>
|
111
115
|
<tr>
|
112
116
|
<td><code>RefreshChicago</code></td>
|
113
117
|
<td><code>:test</code></td>
|
114
|
-
<td><code>refresh_chicago_test</code></td>
|
118
|
+
<td><code>'refresh_chicago_test'</code></td>
|
115
119
|
</tr>
|
116
120
|
<tr>
|
117
121
|
<td><code>RefreshChicago::Jobs</code></td>
|
118
122
|
<td><code>:production</code></td>
|
119
|
-
<td><code>refresh_chicago_jobs_production</code></td>
|
123
|
+
<td><code>'refresh_chicago_jobs_production'</code></td>
|
120
124
|
</tr>
|
121
125
|
<tr>
|
122
126
|
<td><code>Sinatra::Application</code></td>
|
123
127
|
<td><code>:development</code></td>
|
124
|
-
<td><code>sinatra_application_development</code></td>
|
128
|
+
<td><code>'sinatra_application_development'</code></td>
|
125
129
|
</tr>
|
126
130
|
</tbody>
|
127
131
|
</table>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt Puchlerz
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
version: 2.0.0.beta7
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
|
-
description:
|
48
|
+
description: Add Monogid to your Sinatra app with potentially zero-configuration. Lazily creates the database connection whenever needed.
|
49
49
|
email: matt@puchlerz.com
|
50
50
|
executables: []
|
51
51
|
|
@@ -86,6 +86,6 @@ rubyforge_project:
|
|
86
86
|
rubygems_version: 1.3.6
|
87
87
|
signing_key:
|
88
88
|
specification_version: 3
|
89
|
-
summary: Mongoid config for Sinatra.
|
89
|
+
summary: Easy Mongoid config for Sinatra.
|
90
90
|
test_files: []
|
91
91
|
|