Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/westonganger/capistrano-precompile-chooser

Capistrano plugin to precompile your Rails assets locally, remotely, or not at all provided with a very convenient default terminal prompt.
https://github.com/westonganger/capistrano-precompile-chooser

capistrano capistrano-deployment capistrano-plugin rails rails-assets rails-deployment rails-precompile

Last synced: 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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

```ruby
# Gemfile

group :development do
gem "capistrano-precompile-chooser"
end
```

```ruby
# 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

```ruby
# config/deploy.rb

set :linked_dirs, %w{ 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

```bash
$ PRECOMPILE_MODE="local" cap production deploy
```

Or for fully automated deploys

```ruby
# Capfile

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

## Configuration Options,

```ruby
### 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](https://westonganger.com) - [@westonganger](https://github.com/westonganger)