bson_ext 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ begin
12
12
  rescue LoadError
13
13
  end
14
14
  include Config
15
+
15
16
  ENV['TEST_MODE'] = 'TRUE'
16
17
 
17
18
  task :java do
@@ -42,10 +43,14 @@ task :test do
42
43
  puts "To test the pure ruby driver: \nrake test:ruby\n\n"
43
44
  end
44
45
 
46
+ task :path do
47
+ $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
48
+ end
49
+
45
50
  namespace :test do
46
51
 
47
52
  desc "Test the driver with the C extension enabled."
48
- task :c do
53
+ task :c => :path do
49
54
  ENV['C_EXT'] = 'TRUE'
50
55
  if ENV['TEST']
51
56
  Rake::Task['test:functional'].invoke
@@ -60,7 +65,7 @@ namespace :test do
60
65
  end
61
66
 
62
67
  desc "Test the driver using pure ruby (no C extension)"
63
- task :ruby do
68
+ task :ruby => :path do
64
69
  ENV['C_EXT'] = nil
65
70
  if ENV['TEST']
66
71
  Rake::Task['test:functional'].invoke
@@ -80,6 +85,13 @@ namespace :test do
80
85
  t.ruby_opts << '-w'
81
86
  end
82
87
 
88
+ desc "Run the replica set test suite"
89
+ Rake::TestTask.new(:rs_no_threads) do |t|
90
+ t.test_files = FileList['test/replica_sets/*_test.rb'] - ["test/replica_sets/refresh_with_threads_test.rb"]
91
+ t.verbose = true
92
+ t.ruby_opts << '-w'
93
+ end
94
+
83
95
  Rake::TestTask.new(:unit) do |t|
84
96
  t.test_files = FileList['test/unit/*_test.rb']
85
97
  t.verbose = true
@@ -122,9 +134,9 @@ namespace :test do
122
134
  t.ruby_opts << '-w'
123
135
  end
124
136
 
125
- task :drop_databases do |t|
137
+ task :drop_databases => :path do |t|
126
138
  puts "Dropping test databases..."
127
- require './lib/mongo'
139
+ require 'mongo'
128
140
  con = Mongo::Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
129
141
  ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Connection::DEFAULT_PORT)
130
142
  con.database_names.each do |name|
@@ -143,13 +155,13 @@ end
143
155
 
144
156
  desc "Generate YARD documentation"
145
157
  task :ydoc do
146
- require File.join(File.dirname(__FILE__), 'lib', 'mongo')
158
+ require 'mongo'
147
159
  out = File.join('ydoc', Mongo::VERSION)
148
160
  FileUtils.rm_rf('ydoc')
149
161
  system "yardoc lib/**/*.rb lib/mongo/**/*.rb lib/bson/**/*.rb -e ./yard/yard_ext.rb -p yard/templates -o #{out} --title MongoRuby-#{Mongo::VERSION} --files docs/TUTORIAL.md,docs/GridFS.md,docs/FAQ.md,docs/REPLICA_SETS.md,docs/WRITE_CONCERN.md,docs/READ_PREFERENCE.md,docs/HISTORY.md,docs/CREDITS.md,docs/RELEASES.md,docs/CREDITS.md,docs/TAILABLE_CURSORS.md"
150
162
  end
151
163
 
152
- namespace :bamboo do
164
+ namespace :jenkins do
153
165
  task :ci_reporter do
154
166
  begin
155
167
  require 'ci/reporter/rake/test_unit'
@@ -183,10 +195,14 @@ namespace :gem do
183
195
  `rm mongo-*.gem`
184
196
  `rm bson-*.gem`
185
197
  end
198
+
199
+ desc "Uninstall the optional c extensions"
200
+ task :uninstall_extensions do
201
+ `gem uninstall bson_ext`
202
+ end
186
203
 
187
204
  desc "Install the optional c extensions"
188
205
  task :install_extensions do
189
- `gem uninstall bson_ext`
190
206
  `gem build bson_ext.gemspec`
191
207
  `gem install --no-rdoc --no-ri bson_ext-*.gem`
192
208
  `rm bson_ext-*.gem`
@@ -204,7 +220,7 @@ end
204
220
 
205
221
  namespace :ci do
206
222
  namespace :test do
207
- task :c do
223
+ task :c => :path do
208
224
  Rake::Task['gem:install'].invoke
209
225
  Rake::Task['gem:install_extensions'].invoke
210
226
  Rake::Task['test:c'].invoke
@@ -1,4 +1,6 @@
1
- require './lib/bson'
1
+ $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
+ require 'bson'
3
+
2
4
  VERSION_HEADER = File.open(File.join(File.dirname(__FILE__), 'ext', 'cbson', 'version.h'), "r")
3
5
  VERSION = VERSION_HEADER.read.scan(/VERSION "(\d[^"]+)"/)[0][0]
4
6
  Gem::Specification.new do |s|
@@ -469,6 +469,12 @@ static int write_element(VALUE key, VALUE value, VALUE extra, int allow_id) {
469
469
  SAFE_WRITE(buffer, (const char*)&time_since_epoch, 8);
470
470
  break;
471
471
  }
472
+ // Date classes are TYPE T_DATA in Ruby >= 1.9.3
473
+ if (strcmp(cls, "DateTime") == 0 || strcmp(cls, "Date") == 0 || strcmp(cls, "ActiveSupport::TimeWithZone") == 0) {
474
+ bson_buffer_free(buffer);
475
+ rb_raise(InvalidDocument, "%s is not currently supported; use a UTC Time instance instead.", cls);
476
+ break;
477
+ }
472
478
  if(strcmp(cls, "BigDecimal") == 0) {
473
479
  bson_buffer_free(buffer);
474
480
  rb_raise(InvalidDocument, "Cannot serialize the Numeric type %s as BSON; only Bignum, Fixnum, and Float are supported.", cls);
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- #define VERSION "1.5.2"
17
+ #define VERSION "1.6.0"
metadata CHANGED
@@ -1,47 +1,35 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bson_ext
3
- version: !ruby/object:Gem::Version
4
- hash: 7
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.0
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 5
9
- - 2
10
- version: 1.5.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Mike Dirolf
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-12-13 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: bson
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70326298991580 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - "="
27
- - !ruby/object:Gem::Version
28
- hash: 7
29
- segments:
30
- - 1
31
- - 5
32
- - 2
33
- version: 1.5.2
18
+ requirements:
19
+ - - =
20
+ - !ruby/object:Gem::Version
21
+ version: 1.6.0
34
22
  type: :runtime
35
- version_requirements: *id001
36
- description: C extensions to accelerate the Ruby BSON serialization. For more information about BSON, see http://bsonspec.org. For information about MongoDB, see http://www.mongodb.org.
23
+ prerelease: false
24
+ version_requirements: *70326298991580
25
+ description: C extensions to accelerate the Ruby BSON serialization. For more information
26
+ about BSON, see http://bsonspec.org. For information about MongoDB, see http://www.mongodb.org.
37
27
  email: mongodb-dev@googlegroups.com
38
28
  executables: []
39
-
40
- extensions:
29
+ extensions:
41
30
  - ext/cbson/extconf.rb
42
31
  extra_rdoc_files: []
43
-
44
- files:
32
+ files:
45
33
  - Rakefile
46
34
  - bson_ext.gemspec
47
35
  - ext/cbson/extconf.rb
@@ -53,36 +41,27 @@ files:
53
41
  - ext/cbson/version.h
54
42
  homepage: http://www.mongodb.org
55
43
  licenses: []
56
-
57
44
  post_install_message:
58
45
  rdoc_options: []
59
-
60
- require_paths:
46
+ require_paths:
61
47
  - ext
62
- required_ruby_version: !ruby/object:Gem::Requirement
48
+ required_ruby_version: !ruby/object:Gem::Requirement
63
49
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 3
68
- segments:
69
- - 0
70
- version: "0"
71
- required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
55
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
80
60
  requirements: []
81
-
82
61
  rubyforge_project:
83
- rubygems_version: 1.8.10
62
+ rubygems_version: 1.8.16
84
63
  signing_key:
85
64
  specification_version: 3
86
65
  summary: C extensions for Ruby BSON.
87
66
  test_files: []
88
-
67
+ has_rdoc: false