diff --git a/config/locales/en.yml b/config/locales/en.yml index 1b9d8e1..c51003e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -7,6 +7,7 @@ en: upload_cert: Upload Cert cert_management: Cert Management client_management: + get_template: "Get Template" finished_reload_page: "Finished!\\nReload Page!" apply_change: "Apply Change" are_you_sure_to_delete: "Are you sure to delete?" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 6f15aae..4562a4d 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -7,6 +7,7 @@ zh_tw: upload_cert: 上傳憑證 cert_management: 憑證管理 client_management: + get_template: "獲取版型" finished_reload_page: "已完成!\\n重新載入頁面!" apply_change: "設定生效" are_you_sure_to_delete: "您確定要刪除嗎?" diff --git a/lib/tasks/exec_command.rake b/lib/tasks/exec_command.rake index 296dc0b..a53e3be 100644 --- a/lib/tasks/exec_command.rake +++ b/lib/tasks/exec_command.rake @@ -35,7 +35,9 @@ namespace :exec_commands do @command_trans = {} @command_relations = {"upgrade_site"=>'git fetch origin && rails runner "a=Admin::SitesController.new;a.git_reset(%w(origin)[0],%w(update)[0]);while(1) do (Multithread.where(key: %w(update_manager)[0],status: %w(finish)[0]).count!=0 ? break : nil) end;sleep(5)"', "bundle_update"=>"bundle update && kill -s USR2 `cat tmp/pids/unicorn.pid`", - "restart_site"=>"kill -s TERM `fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock`;bundle exec unicorn_rails -c config/unicorn.rb -D -E {{rails_env}}"} + "restart_site"=>"kill -s TERM `fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock`;bundle exec unicorn_rails -c config/unicorn.rb -D -E {{rails_env}}", + "get_template"=>"mongo --eval 'db.sites.find().pretty()[0][\"template\"]' {{db_name}} --quiet"} + @preserve_output = ["get_template"] @command_relations.each do |k,v| @command_trans[k] = I18n.t("client_management.#{k}") end @@ -137,7 +139,11 @@ namespace :exec_commands do update_flag = 1 @command_relations.each do |k,v| if command.include?("{{#{k}}}") - update_flag = 2 #Not logging commands result + if @preserve_output.include?(k) + update_flag = 1 + else + update_flag = 2 #Not logging commands result + end end command = command.gsub("{{#{k}}}",v) @command_i18n = @command_i18n.gsub("{{#{k}}}",@command_trans[k])