Compare commits

..

No commits in common. "match_mongo_chunk_size" and "master" have entirely different histories.

5 changed files with 6 additions and 35 deletions

View File

@ -1,12 +1,10 @@
NAME
----
mongoid-sequence
mongoid-grid_fs
INSTALL
-------
gem install mongoid-sequence
gem install mongoid-grid_fs
SYNOPSIS
--------
@ -35,8 +33,3 @@ DESCRIPTION
-----------
mongoid_sequence is a pure mongoid sequence generator based on mongodb's
increment operator
GRIDFS
------
Be sure to create indexes for the GridFS collections with `rake db:mongoid:create_indexes`.

View File

@ -51,10 +51,6 @@
require "digest/md5"
require "cgi"
if defined?(::Rails::Railtie)
require 'mongoid-grid_fs/railtie'
end
end
end
@ -62,8 +58,6 @@
#
module Mongoid
class GridFS
DEFAULT_CHUNK_SIZE = 256 * 1024
class << GridFS
attr_accessor :namespace
attr_accessor :file_model
@ -138,6 +132,9 @@
namespace.send(:const_set, :File, file_model)
namespace.send(:const_set, :Chunk, chunk_model)
#at_exit{ file_model.create_indexes rescue nil }
#at_exit{ chunk_model.create_indexes rescue nil }
const_get(const)
end
@ -296,7 +293,7 @@
field(:contentType, :type => String, :default => 'application/octet-stream')
field(:length, :type => Integer, :default => 0)
field(:chunkSize, :type => Integer, :default => DEFAULT_CHUNK_SIZE)
field(:chunkSize, :type => Integer, :default => (256 * (2 ** 20)))
field(:uploadDate, :type => Date, :default => Time.now.utc)
field(:md5, :type => String, :default => Digest::MD5.hexdigest(''))

View File

@ -1,18 +0,0 @@
module Mongoid
class GridFS
class Railtie < ::Rails::Railtie
rake_tasks do
task 'db:mongoid:create_indexes' do
::Mongoid::GridFS::Fs::File.create_indexes
::Mongoid::GridFS::Fs::Chunk.create_indexes
end
task 'db:mongoid:remove_indexes' do
::Mongoid::GridFS::Fs::File.remove_indexes
::Mongoid::GridFS::Fs::Chunk.remove_indexes
end
end
end
end
end

View File

@ -2,7 +2,6 @@
require 'pp'
require_relative 'testing'
require_relative '../lib/mongoid-sequence.rb'
require_relative '../lib/mongoid-grid_fs.rb'
Mongoid.configure do |config|
config.connect_to('mongoid-sequence')

View File

@ -70,7 +70,7 @@ Testing Mongoid::GridFs do
path = 'a.rb'
data = IO.read(__FILE__)
sio = StringIO.new(data)
sio = SIO.new(path, data)
g = assert{ GridFs[path] = sio and GridFs[path] }
@ -79,7 +79,7 @@ Testing Mongoid::GridFs do
before = GridFs::File.count
assert{ GridFs[path] = StringIO.new('foobar') }
assert{ GridFs[path] = SIO.new(path, 'foobar') }
assert{ GridFs[path].data == 'foobar' }
after = GridFs::File.count