sinatra-mongomatic 0.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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Jordan West
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,24 @@
1
+ = Sinatra::Mongomatic
2
+
3
+ gem install sinatra-mongomatic
4
+
5
+ == Usage
6
+
7
+ require 'sinatra'
8
+ require 'sinatra/mongomatic'
9
+
10
+ mongomatic Mongo::Connection.new.db("my_app_db")
11
+
12
+ == Note on Patches/Pull Requests
13
+
14
+ * Fork the project.
15
+ * Make your feature addition or bug fix.
16
+ * Add tests for it. This is important so I don't break it in a
17
+ future version unintentionally.
18
+ * Commit, do not mess with rakefile, version, or history.
19
+ (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)
20
+ * Send me a pull request. Bonus points for topic branches.
21
+
22
+ == Copyright
23
+
24
+ Copyright (c) 2010 Jordan West. See LICENSE for details.
@@ -0,0 +1,22 @@
1
+ $: << File.join(File.dirname(__FILE__), %w/.. lib/)
2
+ require 'sinatra'
3
+ require 'sinatra/mongomatic'
4
+
5
+ class User < Mongomatic::Base
6
+
7
+ end
8
+
9
+ mongomatic Mongo::Connection.new.db("test2")
10
+
11
+ get '/create/:name' do
12
+ User.new(:name => params[:name]).insert
13
+ "ok"
14
+ end
15
+
16
+ get '/all' do
17
+ User.find.inject("") do |list, user|
18
+ list += "#{user[:name]}<br>"
19
+ end
20
+ end
21
+
22
+
@@ -0,0 +1,24 @@
1
+ $: << File.join(File.dirname(__FILE__), %w/.. lib/)
2
+ require 'sinatra/base'
3
+ require 'sinatra/mongomatic'
4
+
5
+ class User < Mongomatic::Base
6
+ end
7
+
8
+ class MongomaticExample < Sinatra::Base
9
+ register Sinatra::Mongomatic
10
+
11
+ mongomatic Mongo::Connection.new.db("test2")
12
+
13
+ get '/create/:name' do
14
+ User.new(:name => params[:name]).insert
15
+ "ok"
16
+ end
17
+
18
+ get '/all' do
19
+ User.find.inject("") do |list, user|
20
+ list += "#{user[:name]}<br>"
21
+ end
22
+ end
23
+ run! if $0 == __FILE__
24
+ end
@@ -0,0 +1,16 @@
1
+ require 'mongomatic'
2
+ require 'sinatra/base'
3
+
4
+ module Sinatra
5
+ module Mongomatic
6
+ def self.registered(app)
7
+ app.mongomatic
8
+ end
9
+
10
+ def mongomatic(connection = nil)
11
+ ::Mongomatic.db = connection || Mongo::Connection.new.db("test")
12
+ end
13
+ end
14
+
15
+ register Sinatra::Mongomatic
16
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-mongomatic
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Jordan West
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-15 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: mongomatic
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 19
30
+ segments:
31
+ - 0
32
+ - 3
33
+ - 0
34
+ version: 0.3.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Easily include Mongomatic in your Sinatra applications
38
+ email: jordanrw@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ files:
47
+ - lib/sinatra/mongomatic.rb
48
+ - LICENSE
49
+ - README.rdoc
50
+ - examples/classic.rb
51
+ - examples/modular.rb
52
+ has_rdoc: true
53
+ homepage: http://mongomatic.com/
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options:
58
+ - --charset=UTF-8
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !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
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Sinatra extension for Mongomatic
86
+ test_files:
87
+ - examples/classic.rb
88
+ - examples/modular.rb