Sometimes you want just to tweak the way you run a Rails project, but without commit those changes upstream.
There are some tools that allow one to do it without much problem.
Dir env allows you to just ignore the rbenv
.ruby-version or asdf
.tool-version in a very easy way. For example if the project uses a ruby version 2.7.1 but you have installed the version 2.7.2, all you need to do is to put this on your
load_prefix $HOME/.asdf/installs/ruby/2.7.2 layout ruby
With this, you can force the version 2.7.2 upon the Project.
Imagine that the Project mandates you to use Passenger, but you want to run the project locally using Puma, but without commit it to the original Gemfile. One way to do it is just to create a
eval_gemfile "Gemfile" gem 'passenger', require: false gem 'puma'
After it just, copy the original
Gemfile.local.lock and place add more one line to your
# what we add previously load_prefix $HOME/.asdf/installs/ruby/2.7.2 layout ruby # a new bundle gemfile BUNDLE_GEMFILE=Gemfile.local
With this in place, just run the commands as usual:
bundle install bundle exec rails server puma
- It's important to always resync the
Gemfile.local.lockwhen some major modification on the original
- It's important to make sure that your
.gitignore_globalfile will ignore properly the