From dcca449de1576fa548f036bcc26b478f8e904981 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Fri, 31 Mar 2017 22:33:07 +0200 Subject: [PATCH] Add Capistrano task to create i18n JS files --- config/deploy.rb | 6 ++++++ lib/capistrano/tasks/i18n.rake | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 lib/capistrano/tasks/i18n.rake diff --git a/config/deploy.rb b/config/deploy.rb index 74cd246a..1f5c286a 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -35,10 +35,16 @@ append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/uplo # Ruby version / RVM set :rvm1_ruby_version, '2.3.3@retrospring' +require 'pry' +binding.pry + # Rollbar set :rollbar_token, '35f65946f562414da66d0d48073f5290' # TODO: before publishing this repo (again) remove this token set :rollbar_env, Proc.new { fetch :stage } set :rollbar_role, Proc.new { :app } +# Create JS i18n files after precompiling assets +after 'assets:precompile', 'i18n:js_assets' + # Restart the app server after successful deploy after 'deploy:cleanup', 'deploy:restart' diff --git a/lib/capistrano/tasks/i18n.rake b/lib/capistrano/tasks/i18n.rake new file mode 100644 index 00000000..e47eb768 --- /dev/null +++ b/lib/capistrano/tasks/i18n.rake @@ -0,0 +1,9 @@ +namespace :i18n do + task :js_assets do + within release_path do + with rails_env: fetch(:rails_env), rails_groups: fetch(:rails_assets_groups) do + execute :rake, "i18n:js:export" + end + end + end +end