Skip to content

Capistrano plugin to precompile your Rails assets locally, remotely, or not at all provided with a very convenient default terminal prompt.

License

Notifications You must be signed in to change notification settings

westonganger/capistrano-precompile-chooser

Repository files navigation

Capistrano Precompile Chooser

Gem Version RubyGems Downloads Buy Me a Coffee

Capistrano plugin to precompile your Rails assets locally, remotely, or not at all provided with a very convenient default terminal prompt.

By Default, on every deploy this plugin will prompt you on whether you want to precompile your assets locally, remotely, or not at all. Alternatively you can set some variable for fully automated deploys.

$ cap production deploy

How do you want to compile assets? (local/remote/skip)
skip

Precompile Modes

  • local - Local Precompilation Mode (Improves Memory/Load Spikes on Server during Deploys)
  • remote - Remote Precompilation Mode (Rails Default)
  • skip - No Precompilation (Speeds up deployments with unchanged assets)

Installation

# Gemfile

group :development do
  gem "capistrano-precompile-chooser"
end
# Capfile

# require 'capistrano/rails' ### Comment Out or Remove this line
require 'capistrano/precompile_chooser'

If you want to be able to safely use the skip option you must add public/assets to your capistrano :shared_dirs variable

# config/deploy.rb

set :linked_dirs, %w{ <other-dirs> public/assets }

Usage

Now when running a deployment:

$ cap production deploy

How do you want to compile assets? (local/remote/skip)
skip

You can also use the $PRECOMPILE environment variable

$ PRECOMPILE_MODE="local" cap production deploy

Or for fully automated deploys

# Capfile

ENV['PRECOMPILE_MODE'] = 'local'
require 'capistrano/precompile_chooser'

Configuration Options,

### For Local Precompile Only
set :assets_dir,   "public/assets"
set :packs_dir,    "public/packs"
set :rsync_cmd,    "rsync -av --delete"
set :assets_role,  "web"

Credits

Created & Maintained by Weston Ganger - @westonganger

About

Capistrano plugin to precompile your Rails assets locally, remotely, or not at all provided with a very convenient default terminal prompt.

Topics

Resources

License

Stars

Watchers

Forks

Languages