Skip to content
Merged
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ This script can be used to deploy this app to remote servers.
-h, --help Prints this help
-b, --branch=BRANCH Deploy the code from the passed Git branch
--no-migrations Do not carry out migrations
--no-asset-precompilation Skip asset precompilation during deployment
```

### Example of commands
Expand Down Expand Up @@ -197,6 +198,15 @@ deploy

These tasks will only run when the `:web` role is added to the deployment stage.

## Database migrations and asset precompilation

In order for the `--no-migrations` and `--no-asset-precompilation` flags to work correctly, you need to use this configuration in your `Capfile`:

```rb
require 'capistrano/rails/assets' if ::ENV['NO_ASSET_PRECOMPILATION'].nil?
require 'capistrano/rails/migrations' if ::ENV['NO_MIGRATIONS'].nil?
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
Expand Down
9 changes: 8 additions & 1 deletion lib/capistrano/data_plane_api/deploy/args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Deploy
# passed to the deployment script and saves them in
# an object.
class Args
PRINTABLE_ENV_VARS = %w[BRANCH NO_MIGRATIONS].freeze
PRINTABLE_ENV_VARS = %w[BRANCH NO_MIGRATIONS NO_ASSET_PRECOMPILATION].freeze

#: (Array[untyped]?) -> instance
def self.parse(options = nil) # rubocop:disable Metrics/MethodLength, Style/ClassMethodsDefinitions
Expand Down Expand Up @@ -156,6 +156,13 @@ def self.parse(options = nil) # rubocop:disable Metrics/MethodLength, Style/Clas
args.no_migrations = val
::ENV['NO_MIGRATIONS'] = 'true'
end

parser.on(
'--no-asset-precompilation',
'Skip asset precompilation during deployment',
) do
::ENV['NO_ASSET_PRECOMPILATION'] = 'true'
end
end

opt_parser.parse!(options || ::ARGV)
Expand Down