This commit is contained in:
BoHung Chiu 2023-02-23 13:21:01 +08:00
parent 637ffdc327
commit eca05fa84d
1 changed files with 7 additions and 2 deletions

View File

@ -49,11 +49,16 @@ namespace :create_site do
db_setting_text = ssh.exec!("cat #{args.path}/#{@site_construct.get_site_name}/config/mongoid.yml") db_setting_text = ssh.exec!("cat #{args.path}/#{@site_construct.get_site_name}/config/mongoid.yml")
update_infos("setting dbname to #{@site_construct.db_name}") update_infos("setting dbname to #{@site_construct.db_name}")
exec_ssh_command_by_sudo_for_create(ssh,"sh -c \"echo '#{db_setting_text.gsub("orbit_4_5",@site_construct.db_name)}' > #{args.path}/#{@site_construct.get_site_name}/config/mongoid.yml\"",true) exec_ssh_command_by_sudo_for_create(ssh,"sh -c \"echo '#{db_setting_text.gsub("orbit_4_5",@site_construct.db_name)}' > #{args.path}/#{@site_construct.get_site_name}/config/mongoid.yml\"",true)
gemdir = ssh.exec!("/home/#{args.user}/.rvm/bin/rvm gemdir").to_s rvm_path = ssh.exec!("which rvm").to_s.strip
if rvm_path.blank?
rvm_path = "/home/#{args.user}/.rvm/bin/rvm"
end
gemdir = ssh.exec!("#{rvm_path} gemdir").to_s
if gemdir.include?("No such file or directory") if gemdir.include?("No such file or directory")
ls = ssh.exec!("echo `ls /home`").to_s.split ls = ssh.exec!("echo `ls /home`").to_s.split
ls.each do |d| ls.each do |d|
gemdir = ssh.exec!("/home/#{d}/.rvm/bin/rvm gemdir").to_s rvm_path = "/home/#{d}/.rvm/bin/rvm"
gemdir = ssh.exec!("#{rvm_path} gemdir").to_s
break if !gemdir.to_s.include?("No such file or directory") break if !gemdir.to_s.include?("No such file or directory")
end end
end end