From 9b553f11366503f12aa0cdae9d3387dcf05a8d1f Mon Sep 17 00:00:00 2001 From: Erik Henriksson Date: Tue, 31 Mar 2015 12:15:25 +0200 Subject: [PATCH] Reload permissions table on deploy --- config/deploy.rb | 1 + lib/capistrano/tasks/load_permissions.cap | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 lib/capistrano/tasks/load_permissions.cap diff --git a/config/deploy.rb b/config/deploy.rb index 710139084..d2699f716 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -43,6 +43,7 @@ namespace :deploy do # before :deploy, "deploy:check_revision" before :deploy, 'deploy:run_tests' + after :deploy, 'permissions:load' desc 'Restart application' task :restart do diff --git a/lib/capistrano/tasks/load_permissions.cap b/lib/capistrano/tasks/load_permissions.cap new file mode 100644 index 000000000..bd2602ace --- /dev/null +++ b/lib/capistrano/tasks/load_permissions.cap @@ -0,0 +1,11 @@ +namespace :deploy do + namespace :permissions do + desc 'Reload permissions table' + task :load do + on roles(:all) do + execute "cd #{deploy_to}/current && #{fetch(:rbenv_prefix)} bundle exec "\ + "rake permissions:load RAILS_ENV=#{fetch(:rails_env)}" + end + end + end +end