diff --git a/lib/tasks/copy_site.rake b/lib/tasks/copy_site.rake index e34d8cd..ca817db 100644 --- a/lib/tasks/copy_site.rake +++ b/lib/tasks/copy_site.rake @@ -20,6 +20,7 @@ namespace :create_site do @site_construct = SiteConstruct.find(args.site_construct_id) end begin + org_creating = (@site_construct.status == "creating") @site_construct.update(:status=>"creating") @site_construct.update!(:infos=>[]) begin @@ -48,7 +49,7 @@ namespace :create_site do end server = SiteServer.where(:server_name => template_site.server_type).first ls_out = exec_ssh_command_for_create(ssh, "ls #{@site_construct.full_site_path}/app").join("\n") - if ls_out.include?("No such") + if ls_out.include?("No such") || org_creating if @site_construct.server_type == template_site.server_type exec_ssh_command_for_create(ssh,"rsync -arv --delete --exclude={tmp/cache/,tmp/unicorn.sock,tmp/pids/*#{extra_exclude_path}} #{template_site.path}/#{template_site.get_site_name}/ #{args.path}/#{@site_construct.get_site_name}/",true) else diff --git a/lib/tasks/create_site.rake b/lib/tasks/create_site.rake index 0beb1e3..5d49ae5 100644 --- a/lib/tasks/create_site.rake +++ b/lib/tasks/create_site.rake @@ -132,11 +132,17 @@ namespace :create_site do end return outputs.join("\n") end - def update_infos_for_exec(info,update_last=false) + def update_infos_for_exec(info,update_last=false,update_array=false) + return if @site_construct.nil? + info.encode!("UTF-8", :invalid => :replace, :undef => :replace, :replace => '') if update_last && !@site_construct.infos.empty? - @site_construct.infos[-1] += info + @site_construct.infos[-1] += info.to_s else - @site_construct.infos = @site_construct.infos.push(info) + if update_array + @site_construct.infos += info + else + @site_construct.infos.push(info.to_s) + end end @site_construct.save! return @site_construct.infos diff --git a/lib/tasks/exec_command.rake b/lib/tasks/exec_command.rake index 8a84dcf..ecb039e 100644 --- a/lib/tasks/exec_command.rake +++ b/lib/tasks/exec_command.rake @@ -158,6 +158,7 @@ namespace :exec_commands do end def update_infos_for_exec(info,update_last=false,update_array=false) return if @site_construct.nil? + info.encode!("UTF-8", :invalid => :replace, :undef => :replace, :replace => '') if update_last && !@site_construct.infos.empty? @site_construct.infos[-1] += info.to_s else