This commit is contained in:
BoHung Chiu 2021-03-15 21:02:15 +08:00
parent edf4738b06
commit a6f82e58d3
1 changed files with 2 additions and 2 deletions

View File

@ -101,7 +101,7 @@ namespace :create_site do
next if outputs.blank?
if !outputs.include?("No such file or directory")
read_lines = outputs.split("\n").map{|l| l.split('#').first}
include_path_lines = read_lines.select{|l| l.include?("path")}
include_path_lines = read_lines.select{|l| (l.include?("path") rescue false)}
include_path_lines.each do |line|
path = line.split(/[:>]/).last.gsub(/[\'\"]/,"").strip
absolute_path = (path[0] == "/") ? path : ("#{template_site.path}/#{template_site.get_site_name}/#{path}")
@ -127,7 +127,7 @@ namespace :create_site do
update_infos("finish execing bundle install")
update_infos("starting #{args.site_name} web server to development")
outputs = exec_ssh_command_by_sudo_for_create(ssh,"bash -l -c 'cd #{args.path}/#{@site_construct.get_site_name}\nkill -s TERM `fuser tmp/unicorn.sock`\nsudo -p \"sudo password:\" kill -s TERM `sudo -p \"sudo password:\" fuser tmp/unicorn.sock`\nsudo -p \"sudo password:\" rm -f tmp/pids/unicorn.pid\nbundle exec unicorn_rails -c config/unicorn.rb -D -E development\n'")
if outputs.include? "not writable"
if (outputs.include? "not writable" rescue false)
exec_ssh_command_by_sudo_for_create(ssh,"sudo -p 'sudo password:' chown #{args.user}:#{args.user} #{args.path}/#{@site_construct.get_site_name} -R")
exec_ssh_command_by_sudo_for_create(ssh,"sudo -p 'sudo password:' chmod 777 #{args.path}/#{@site_construct.get_site_name} -R")
end