map_reduced 0.0.8 → 0.1.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/lib/map_reduced/config.rb +15 -1
- data/lib/map_reduced.rb +3 -2
- metadata +4 -4
data/lib/map_reduced/config.rb
CHANGED
@@ -5,7 +5,21 @@ module MapReduced
|
|
5
5
|
attr_writer :template_path
|
6
6
|
|
7
7
|
def database=(string)
|
8
|
-
|
8
|
+
begin
|
9
|
+
if string.match /^.+\:\/\/.+/
|
10
|
+
uri = URI.parse(string)
|
11
|
+
connection = Mongo::Connection.new(uri.host, uri.port)
|
12
|
+
database = uri.path.gsub(/^\//, "")
|
13
|
+
connection.add_auth(database, uri.user, uri.password)
|
14
|
+
connection.apply_saved_authentication
|
15
|
+
@db = connection.db(database)
|
16
|
+
else
|
17
|
+
@db = Mongo::Connection.new.db(string)
|
18
|
+
end
|
19
|
+
rescue Mongo::ConnectionFailure => e
|
20
|
+
raise Mongo::ConnectionFailure, "#{e}\nIt is possible that your database string is badly formed.\nIt should either be a database name (for localhost connections), or a fully-formed remote connection like mongodb://user:pass@host:port/database"
|
21
|
+
end
|
22
|
+
|
9
23
|
end
|
10
24
|
|
11
25
|
def db
|
data/lib/map_reduced.rb
CHANGED
@@ -2,10 +2,11 @@ require 'map_reduced/config'
|
|
2
2
|
require 'map_reduced/document'
|
3
3
|
require 'active_support/core_ext'
|
4
4
|
require 'active_support/inflector'
|
5
|
-
require 'mongo'
|
5
|
+
require 'mongo' # >= 1.0.1
|
6
6
|
require 'erb'
|
7
|
+
require 'uri'
|
7
8
|
require 'pathname'
|
8
9
|
|
9
10
|
module MapReduced
|
10
|
-
VERSION = "0.0
|
11
|
+
VERSION = "0.1.0"
|
11
12
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: map_reduced
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.8
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Scott Burton
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-08 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|