moped 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of moped might be problematic. Click here for more details.

checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fe95b809af3e8ba3e7dcb35684df215cf3a366c5
4
+ data.tar.gz: ad8d716fd8ec02ab0245dedffe098c1facb71a76
5
+ SHA512:
6
+ metadata.gz: 1d75ad7ba8d8127addba511ff259755c5b6bbcf94acdbe7fb05448fcf73848682c4bb93307ba0bb81cd3609a3aa58663f0304b1b9721cc90c002ecf37540ffa8
7
+ data.tar.gz: 90bd44b093930aed15f0a77efe77a347d97ca181a40506a9c976f73e267f7e39199c01e9e09106e8f5acb5a36adb2122e9671f5c0905030308cf34a8a15bcc38
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Overview
2
2
 
3
+ ## 1.4.4
4
+
5
+ ### Resolved Issues
6
+
7
+ * Fixed BSON binary issues on Ruby 2.0.0.
8
+
9
+ * \#169 Added additional authorization failure codes into reply.
10
+
11
+ * \#168 Added additional not master checks in replica set reconfiguration.
12
+
3
13
  ## 1.4.3
4
14
 
5
15
  ### Resolved Issues
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Moped [![Build Status](https://secure.travis-ci.org/mongoid/moped.png?branch=master&.png)](http://travis-ci.org/mongoid/moped)
1
+ Mop[ed [![Build Status](https://secure.travis-ci.org/mongoid/moped.png?branch=master&.png)](http://travis-ci.org/mongoid/moped) [![Code Climate](https://codeclimate.com/github/mongoid/moped.png)](https://codeclimate.com/github/mongoid/moped)
2
2
  ========
3
3
 
4
4
  Moped is a MongoDB driver for Ruby, which exposes a simple, elegant, and fast
@@ -49,4 +49,4 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49
49
  Credits
50
50
  -------
51
51
 
52
- Bernerd Schaefer bj schaefer at gmail dot com
52
+ Bernerd Schaefer and Durran Jordan
@@ -5,12 +5,12 @@ module Moped
5
5
  class Binary
6
6
 
7
7
  SUBTYPE_MAP = {
8
- generic: "\x00",
9
- function: "\x01",
10
- old: "\x02",
11
- uuid: "\x03",
12
- md5: "\x05",
13
- user: "\x80"
8
+ generic: 0.chr,
9
+ function: 1.chr,
10
+ old: 2.chr,
11
+ uuid: 3.chr,
12
+ md5: 5.chr,
13
+ user: 128.chr
14
14
  }.freeze
15
15
 
16
16
  SUBTYPE_TYPES = SUBTYPE_MAP.invert.freeze
@@ -22,15 +22,15 @@ module Moped
22
22
  end
23
23
 
24
24
  def to_utf8_binary
25
- encode(UTF8_ENCODING).force_encoding(BINARY_ENCODING)
25
+ encode(Moped::BSON::UTF8_ENCODING).force_encoding(Moped::BSON::BINARY_ENCODING)
26
26
  rescue EncodingError
27
- data = dup.force_encoding(UTF8_ENCODING)
27
+ data = dup.force_encoding(Moped::BSON::UTF8_ENCODING)
28
28
  raise unless data.valid_encoding?
29
- data.force_encoding(BINARY_ENCODING)
29
+ data.force_encoding(Moped::BSON::BINARY_ENCODING)
30
30
  end
31
31
 
32
32
  def from_utf8_binary
33
- force_encoding(UTF8_ENCODING).encode!
33
+ force_encoding(Moped::BSON::UTF8_ENCODING).encode!
34
34
  end
35
35
 
36
36
  module ClassMethods
@@ -163,7 +163,7 @@ module Moped
163
163
  #
164
164
  # @since 1.0.0
165
165
  def to_s
166
- data.unpack("H*")[0].force_encoding(UTF8_ENCODING)
166
+ data.unpack("H*")[0].force_encoding(Moped::BSON::UTF8_ENCODING)
167
167
  end
168
168
  alias :to_str :to_s
169
169
 
data/lib/moped/errors.rb CHANGED
@@ -99,13 +99,15 @@ module Moped
99
99
  # Classes of errors that could be caused by a replica set reconfiguration.
100
100
  class PotentialReconfiguration < MongoError
101
101
 
102
+ # Not master error codes.
103
+ NOT_MASTER = [ 13435, 13436 ]
104
+
102
105
  # Replica set reconfigurations can be either in the form of an operation
103
106
  # error with code 13435, or with an error message stating the server is
104
107
  # not a master. (This encapsulates codes 10054, 10056, 10058)
105
108
  def reconfiguring_replica_set?
106
- details["code"] == 13435 ||
107
- details["err"] == "not master" ||
108
- details["errmsg"] == "not master"
109
+ err = details["err"] || details["errmsg"] || details["$err"] || ""
110
+ NOT_MASTER.include?(details["code"]) || err.include?("not master")
109
111
  end
110
112
  end
111
113
 
@@ -13,7 +13,8 @@ module Moped
13
13
  class Reply
14
14
  include Message
15
15
 
16
- UNAUTHORIZED = 10057
16
+ # Unauthorized assertion errors.
17
+ UNAUTHORIZED = [ 10057, 16550 ]
17
18
 
18
19
  # @attribute
19
20
  # @return [Number] the length of the message
@@ -109,7 +110,7 @@ module Moped
109
110
  # @since 1.2.10
110
111
  def unauthorized?
111
112
  result = documents[0]
112
- result["code"] == UNAUTHORIZED || result["assertionCode"] == UNAUTHORIZED
113
+ result && (UNAUTHORIZED.include?(result["code"]) || UNAUTHORIZED.include?(result["assertionCode"]))
113
114
  end
114
115
 
115
116
  class << self
data/lib/moped/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Moped
3
- VERSION = "1.4.3"
3
+ VERSION = "1.4.4"
4
4
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moped
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
5
- prerelease:
4
+ version: 1.4.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bernerd Schaefer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-28 00:00:00.000000000 Z
11
+ date: 2013-03-22 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A MongoDB driver for Ruby.
15
14
  email:
@@ -77,33 +76,25 @@ files:
77
76
  - README.md
78
77
  homepage: http://mongoid.org/en/moped
79
78
  licenses: []
79
+ metadata: {}
80
80
  post_install_message:
81
81
  rdoc_options: []
82
82
  require_paths:
83
83
  - lib
84
84
  required_ruby_version: !ruby/object:Gem::Requirement
85
- none: false
86
85
  requirements:
87
- - - ! '>='
86
+ - - '>='
88
87
  - !ruby/object:Gem::Version
89
88
  version: '0'
90
- segments:
91
- - 0
92
- hash: 2209101216124577451
93
89
  required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
90
  requirements:
96
- - - ! '>='
91
+ - - '>='
97
92
  - !ruby/object:Gem::Version
98
93
  version: '0'
99
- segments:
100
- - 0
101
- hash: 2209101216124577451
102
94
  requirements: []
103
95
  rubyforge_project:
104
- rubygems_version: 1.8.24
96
+ rubygems_version: 2.0.3
105
97
  signing_key:
106
- specification_version: 3
98
+ specification_version: 4
107
99
  summary: A MongoDB driver for Ruby.
108
100
  test_files: []
109
- has_rdoc: