mongo 1.2.3 → 1.2.4

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/Rakefile CHANGED
@@ -175,6 +175,14 @@ namespace :gem do
175
175
  sh "rm bson_ext-*.gem"
176
176
  end
177
177
 
178
+ desc "Build all gems"
179
+ task :build_all do
180
+ sh "gem build mongo.gemspec"
181
+ sh "gem build bson.gemspec"
182
+ sh "gem build bson.java.gemspec"
183
+ sh "gem build bson_ext.gemspec"
184
+ end
185
+
178
186
  end
179
187
 
180
188
  namespace :ci do
data/docs/HISTORY.md CHANGED
@@ -1,11 +1,18 @@
1
1
  # MongoDB Ruby Driver History
2
2
 
3
+ ### 1.2.4
4
+ 2011-2-23
5
+
6
+ * Fix the exception message shown when there's an IOError (malditogeek)
7
+ * Another update to map-reduce docs for v1.8. Note that if you use the new
8
+ output option {:out => {:inline => true}}, then you must also specify
9
+ :raw => true.
10
+
3
11
  ### 1.2.3
4
12
  2011-2-22
5
13
 
6
- * Updated docs for v1.8 map-reduce and ensure that :raw option
7
- is used when no collection name is returned.
8
- * Minor Collection#group doc update.
14
+ * Update docs for map-reduce command
15
+ * Minor doc fix
9
16
 
10
17
  ### 1.2.2
11
18
  2011-2-15
data/lib/mongo.rb CHANGED
@@ -19,7 +19,7 @@
19
19
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
20
20
 
21
21
  module Mongo
22
- VERSION = "1.2.3"
22
+ VERSION = "1.2.4"
23
23
  end
24
24
 
25
25
  module Mongo
@@ -509,7 +509,7 @@ module Mongo
509
509
  @db.command(cmd)['value']
510
510
  end
511
511
 
512
- # Perform a map/reduce operation on the current collection.
512
+ # Perform a map-reduce operation on the current collection.
513
513
  #
514
514
  # @param [String, BSON::Code] map a map function, written in JavaScript.
515
515
  # @param [String, BSON::Code] reduce a reduce function, written in JavaScript.
@@ -529,11 +529,13 @@ module Mongo
529
529
  # @option opts [Boolean ] :verbose (false) if true, provides statistics on job execution time.
530
530
  # @option opts [Boolean] :raw (false) if true, return the raw result object from the map_reduce command, and not
531
531
  # the instantiated collection that's returned by default. Note if a collection name isn't returned in the
532
- # map-reduce output (as, for example, when using :out => {:inline => 1}), then this option will be
533
- # forced to true.
532
+ # map-reduce output (as, for example, when using :out => {:inline => 1}), then you must specify this option
533
+ # or an ArgumentError will be raised.
534
534
  #
535
535
  # @return [Collection, Hash] a Mongo::Collection object or a Hash with the map-reduce command's results.
536
536
  #
537
+ # @raise ArgumentError if you specify {:out => {:inline => true}} but don't specify :raw => true.
538
+ #
537
539
  # @see http://www.mongodb.org/display/DOCS/MapReduce Offical MongoDB map/reduce documentation.
538
540
  #
539
541
  # @core mapreduce map_reduce-instance_method
@@ -553,10 +555,13 @@ module Mongo
553
555
  raise Mongo::OperationFailure, "map-reduce failed: #{result['errmsg']}"
554
556
  end
555
557
 
556
- if raw || !result["result"]
558
+ if raw
557
559
  result
558
- else
560
+ elsif result["result"]
559
561
  @db[result["result"]]
562
+ else
563
+ raise ArgumentError, "Could not instantiate collection from result. If you specified " +
564
+ "{:out => {:inline => true}}, then you must also specify :raw => true to get the results."
560
565
  end
561
566
  end
562
567
  alias :mapreduce :map_reduce
@@ -49,8 +49,7 @@ module Mongo
49
49
  begin
50
50
  sock.close
51
51
  rescue IOError => ex
52
- warn "IOError when attempting to close socket connected "
53
- + "to #{@host}:#{@port}: #{ex.inspect}"
52
+ warn "IOError when attempting to close socket connected to #{@host}:#{@port}: #{ex.inspect}"
54
53
  end
55
54
  end
56
55
  @host = @port = nil
@@ -485,7 +485,11 @@ class TestCollection < Test::Unit::TestCase
485
485
  res = @@test.map_reduce(m, r, :out => {:reduce => output_collection})
486
486
  assert res.find.to_a.any? {|doc| doc["_id"] == 3 && doc["value"]["count"] == 2}
487
487
 
488
- res = @@test.map_reduce(m, r, :out => {:inline => 1})
488
+ assert_raise ArgumentError do
489
+ @@test.map_reduce(m, r, :out => {:inline => 1})
490
+ end
491
+
492
+ @@test.map_reduce(m, r, :raw => true, :out => {:inline => 1})
489
493
  assert res["results"]
490
494
  end
491
495
  end
@@ -264,5 +264,15 @@ class TestConnection < Test::Unit::TestCase
264
264
  end
265
265
  assert_equal 0, @con.primary_pool.checked_out.size
266
266
  end
267
+
268
+ should "show a proper exception message if an IOError is raised while closing a socket" do
269
+ fake_socket = Mocha::Mock.new
270
+ fake_socket.stubs(:close).raises(IOError.new)
271
+ fake_socket.stub_everything
272
+ TCPSocket.expects(:new).returns(fake_socket)
273
+
274
+ @con.primary_pool.checkout_new_socket
275
+ assert_equal [], @con.primary_pool.close
276
+ end
267
277
  end
268
278
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 3
10
- version: 1.2.3
9
+ - 4
10
+ version: 1.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Menard
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-02-22 00:00:00 -05:00
20
+ date: 2011-02-23 00:00:00 -05:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -28,12 +28,12 @@ dependencies:
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- hash: 25
31
+ hash: 23
32
32
  segments:
33
33
  - 1
34
34
  - 2
35
- - 3
36
- version: 1.2.3
35
+ - 4
36
+ version: 1.2.4
37
37
  type: :runtime
38
38
  version_requirements: *id001
39
39
  description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.