Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capistrano 3.0+ compatibility issues #64

Closed
nfedyashev opened this issue Oct 20, 2013 · 3 comments
Closed

Capistrano 3.0+ compatibility issues #64

nfedyashev opened this issue Oct 20, 2013 · 3 comments

Comments

@nfedyashev
Copy link
Contributor

3.0.0 version has lots of upgrades and improvements and people are slowly migrating to this new version. Although many of those changes are not backwards compatible with old 2+ capistrano versions.

If you try 3.0.0 now with latest bkeepers/dotenv version it would fail with:

cap staging deploy
cap aborted!
undefined method `instance' for Capistrano::Configuration:Class
/Users/nfedyashev/.gem/ruby/2.0.0/gems/dotenv-0.9.0/lib/dotenv/capistrano/recipes.rb:1:in `<top (required)>'
/Users/nfedyashev/.gem/ruby/2.0.0/gems/dotenv-0.9.0/lib/dotenv/capistrano.rb:1:in `<top (required)>'
config/deploy.rb:1:in `<top (required)>'
/Users/nfedyashev/.gem/ruby/2.0.0/gems/capistrano-3.0.0/lib/capistrano/setup.rb:12:in `load'
/Users/nfedyashev/.gem/ruby/2.0.0/gems/capistrano-3.0.0/lib/capistrano/setup.rb:12:in `block (2 levels) in <top (required)>'
/Users/nfedyashev/.gem/ruby/2.0.0/gems/capistrano-3.0.0/lib/capistrano/application.rb:12:in `run'
/Users/nfedyashev/.gem/ruby/2.0.0/gems/capistrano-3.0.0/bin/cap:3:in `<top (required)>'
/Users/nfedyashev/.gem/ruby/2.0.0/bin/cap:23:in `load'
/Users/nfedyashev/.gem/ruby/2.0.0/bin/cap:23:in `<main>'
Tasks: TOP => staging
(See full trace by running task with --trace)

There are several ways to fix it, but seems like the simplest way to symlink .env in 3.0.0 is to add it to linked_files variables, like:

-set :linked_files, %w{config/database.yml}
+set :linked_files, %w{config/database.yml .env}

I guess that is more obvious and simple than checking capistrano version in our dotenv, and changing linked_files variable.

Two approaches: "We did everything so you don't have to, but please make sure .env is present in shared dir vs "ok, I need to make dotenv work with 3.0+ capistrano, README tells me to add .env to linked_files - now I understand that it has to be present in shared dir too"

I vote for the latter(no updates to lib/dotenv/capistrano.rb and lib/dotenv/capistrano.rb but README instructions has to be update for 3.0+ versions).

@nfedyashev
Copy link
Contributor Author

@bkeepers @garno

what do you think guys?

@bkeepers
Copy link
Owner

Yeah, I'm cool with the second approach.

@montells
Copy link

how do you make sure .env is present in shared dir?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants