Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Update Outdated Rails Capistrano Examples to Cap v3 #522

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions extras/rails/ASSETS-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,23 @@ $ heroku config:set NPM_CONFIG_PRODUCTION=false

[https://devcenter.heroku.com/articles/nodejs-support#customizing-the-build-process]()

### Capistrano
### Capistrano 3

All we need to do is add a task to run `yarn install` before we compile the assets.
All we need to do is add a task to run `yarn install && yarn run blendid -- build` before we compile the assets.

The example below shows an example of using [nvm](https://github.com/creationix/nvm) (node version manager) to use the specified node version for your application.

```rb
# ./config/deploy.rb

before "deploy:assets:precompile", "deploy:yarn_install"
before "deploy:assets:precompile", "deploy:blendid_build"

namespace :deploy do
desc "Run yarn install"
task :yarn_install do
invoke_command "bash -c '. /home/deploy/.nvm/nvm.sh && cd #{release_path} && yarn install'"
desc "Install front end dependencies and compile for production with Blendid"
task :blendid_build do
on roles(:web), in: :groups, limit: 3, wait: 10 do
execute "bash -c '. /home/deploy/.nvm/nvm.sh && cd #{release_path} && yarn install && yarn run blendid -- build'"
end
end
end
```
Expand Down
6 changes: 4 additions & 2 deletions extras/rails/config/deploy.rb.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Using Capistrano? Use this file
# Using Capistrano 3? Use this file
before "deploy:assets:precompile", "deploy:blendid_build"

namespace :deploy do
desc "Install front end dependencies and compile for production with Blendid"
task :blendid_build do
invoke_command "bash -c '. /home/deploy/.nvm/nvm.sh && cd #{release_path} && yarn install && yarn run blendid -- build'"
on roles(:web), in: :groups, limit: 3, wait: 10 do
execute "bash -c '. /home/deploy/.nvm/nvm.sh && cd #{release_path} && yarn install && yarn run blendid -- build'"
end
end
end