nusurge_gridfs 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/rack/gridfs.rb +5 -4
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/lib/rack/gridfs.rb CHANGED
@@ -14,12 +14,12 @@ module Rack
14
14
  }.merge(options)
15
15
 
16
16
  @app = app
17
- @hostname = options[:hostname]
18
- @port = options[:port]
19
- @database = options[:database]
20
17
  @prefix = options[:prefix]
21
18
  @db = nil
22
19
 
20
+ @hostname, @port, @database, @username, @password =
21
+ options.values_at(:hostname, :port, :database, :username, :password)
22
+
23
23
  connect!
24
24
  end
25
25
 
@@ -42,7 +42,8 @@ module Rack
42
42
  private
43
43
  def connect!
44
44
  Timeout::timeout(5) do
45
- @db = Mongo::Connection.new(hostname).db(database)
45
+ @db = Mongo::Connection.new(hostname, port).db(database)
46
+ @db.authenticate(@username, @password) if @username
46
47
  end
47
48
  rescue Exception => e
48
49
  raise Rack::GridFSConnectionError, "Unable to connect to the MongoDB server (#{e.to_s})"
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - nutheory
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-07 00:00:00 -07:00
17
+ date: 2010-04-08 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency