update mongoid version

This commit is contained in:
邱博亞 2021-11-20 22:58:24 +08:00
parent 5e7df7753a
commit 70f7e48749
2 changed files with 38 additions and 3 deletions

View File

@ -238,6 +238,40 @@ if bundle_update_flag
end
#system("cp -rf #{app_path}/temp_file/app #{env_pwd}")
end
c = open("#{env_pwd}/config/mongoid.yml",'r'){|f| f.read}
if c.scan(/^[ \t]*sessions\:/).length != 0
c = c.gsub(/^([ \t]*)sessions\:/,'\1clients:')
r = YAML.load(c)
r.each do |mode,v1|
v1.each do |clients,d|
d.each do |k,v|
if v["username"].present?
if !v["options"].present?
v["options"] = {}
end
v["options"]["user"] = v["username"]
v.delete "username"
end
if v["password"].present?
if !v["options"].present?
v["options"] = {}
end
v["options"]["password"] = v["password"]
v.delete "password"
end
if v["options"].present? && v["options"]["pool_size"].present?
v["options"]["max_pool_size"] = v["options"]["pool_size"]
v["options"].delete "pool_size"
end
if v["options"].present? && v["options"]["read"].class == String
v["options"]["read"] = {mode: v["options"]["read"]}
end
end
end
end
c = YAML.dump(r).sub("---\n",'')
open("#{env_pwd}/config/mongoid.yml",'w+'){|f| f.write(c)}
end
end
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|

View File

@ -45,8 +45,9 @@ gem 'httparty'
#database
# gem 'mongoid', github: "mongoid/mongoid"
gem 'mongoid', '~> 4.0.2'
gem 'bson', '~> 4.5.0'
gem 'mongo', '~> 2.10.5'
gem 'mongoid', '~> 5.4.1'
# sockets
# gem "websocket-rails"