Skip to content

Commit

Permalink
Notes about using .ruby-version #5
Browse files Browse the repository at this point in the history
  • Loading branch information
kirs committed Feb 3, 2015
1 parent 79a8774 commit 6f1216c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -30,6 +30,10 @@ And then execute:
# config/deploy.rb
set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, '2.0.0-p247'

# in case you want to set ruby version from the file:
# set :rbenv_ruby, File.read('.ruby-version').strip

set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
set :rbenv_roles, :all # default value
Expand Down

3 comments on commit 6f1216c

@blackjid
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kirs sorry committing this here, but you locked the issue...
That File.read() will try to the get the .ruby version in the machine where you are running capistrano right? Wouldn't it be better to read that file in the remote machine, after the code being pulled?

@kirs
Copy link
Member Author

@kirs kirs commented on 6f1216c Feb 3, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I see no difference in reading local/remote files, but as a fact remote .ruby_version may not be available it it's the first deploy.

@codyrobbins
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I appreciate the addition of a commented example in the readme (thanks!), I still think that this should definitely be the default behavior of the gem if .ruby-version is present. It’s the default case and it reduces unnecessary verbosity of the deployment configuration. It’s not good practice to specify the same important application configuration value in two different places. Since this gem is meant to integrate Rbenv and Capistrano, and since .ruby-version is supported by Rbenv, I still don’t see a reason this gem wouldn’t include specific support for it?

Please sign in to comment.