Pow will not change ruby ​​version after updating project

I am using Pow and power gem with my rails project.

Now I'm trying to update the ruby ​​version (from 1.9.3 to 2.0.0, I use RVM)

When I switch the ruby ​​version, I install all the gem dependencies, I am sure that the application is working fine by running rails s and visiting localhost:3000

I preview my application first by visiting http://my_app.dev using pow. After the update, this URL does not work due to the error Bundler::RubyVersionMismatch: Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0

What I tried:

  • re-create application
  • restart pool server
  • update update server
  • kill pow server
  • google this error :)

This error still exists. By the way, I have another rails application that originally uses ruby ​​2.0 and works with pow ok.

+4
source share
1 answer

Create a file called .powrc in the root directory of the projects. Copy and paste the contents below into the file.

 if [ -f "$rvm_path/scripts/rvm" ]; then source "$rvm_path/scripts/rvm" if [ -f ".rvmrc" ]; then source ".rvmrc" fi if [ -f ".ruby-version" ]; then rvm use `cat .ruby-version` fi if [ -f ".ruby-gemset" ]; then rvm gemset use --create `cat .ruby-gemset` fi fi 

This will look for your ruby ​​environment files and choose the correct version from it. If this does not work the first time, make sure that you have a .rvmrc or .ruby-version file in the project root directory.

And don't forget touch tmp/restart.txt reload the application.

Source: https://gist.github.com/nbibler/5307941

+8
source

Source: https://habr.com/ru/post/1498843/


All Articles