Downgrading gem version - ruby-on-rails

I have a application I am trying to host on the cloudcontrol server, but the issue is I need the gem -v to be 1.3.7.
I have tired:
cctrlapp APPNAME/default run "gem install rubygems-update -v 1.3.7
cctrlapp APPNAME/default run "gem update --system 1.3.7
But after all this on running cctrlapp APPNAME/default run "gem -v I get 1.8.24.
So my question is, how do I downgrade my gem version?

cloudControl is using bundler to manage the gems.
You need to specify the version in your Gemfile. Make sure it's also used in Gemfile.lock after running the 'bundle install' command.
Note that the Gemfile.lock needs to be included in your git repository.
When you push the next time, this version will be used. You can see this in push command's output, e.g. 'Installing rubygems-update (1.3.7)'.
After the next deploy, you can also verify it via run command (e.g. cctrlapp APPNAME/default run 'gem list').

Related

Rails container build but no start - macbook M1

I have an app that I can build the container, but not able to start
The error message when I try to start it:
Activating bundler (~> 2.3) failed:
Could not find 'bundler' (2.3.18) required by `$BUNDLER_VERSION`.
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.3.18`
Checked in 'GEM_PATH=/root/.gem/ruby/2.5.0:/usr/local/lib/ruby/gems/2.5.0:/usr/local/bundle' , execute `gem env` for more information
To install the version of bundler this project requires, run `gem install bundler -v '~> 2.3'`
The Dockerfile already has:
FROM --platform=linux/amd64 ruby:2.5.9-slim-stretch
(...)
ENV BUNDLER_VERSION 2.3.18
RUN gem update --system 3.2.3
RUN gem install bundler -v "$BUNDLER_VERSION"
I had to manually run the bundler install, even it should run on build
docker run bundle install

'You must use Bundler 2 or greater with this lockfile.' even with Bundler 2.0.2 installed

I'm trying to Dockerize my Rails app and constantly getting this warning when running docker build -t tml_portal:
Sending build context to Docker daemon 355.1MB
Step 1/1 : FROM rails:onbuild
# Executing 4 build triggers
---> Using cache
---> Using cache
---> Running in 641c1404bf87
You must use Bundler 2 or greater with this lockfile.
The command '/bin/sh -c bundle install' returned a non-zero code: 20
I've tried bundler update --system, gem uninstall bundler, gem install bundler 2.0.2, etc. Basically every suggestion on the internet. I will say that I have a problem sometimes where if I switch directories, RVM switches to ruby 2.3.3 and I have to rvm use 2.6.5. My system ruby is not the same as local. Not sure if that has anything to do with it but I just can't figure out a solution. I've also made sure to delete the Docker build cache.
At the very bottom of your Gemfile.lock it should say what version of Bundler was used:
# Gemfile.lock
BUNDLED WITH
2.0.2
You can also check what version of Bundler you're currently using in the console with:
bundler -v
Make sure both of those have the version you're looking for. If not, delete the Gemfile.lock completely and - barring you have the updated version installed - it should re-bundle with the updated version.

Rack 2.0.1 requires Ruby >= 2.2.2

I am trying to run "bundle update", but I keep getting the error message:
An error occurred while installing rack (2.0.1), and Bundler cannot continue.
Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.
Then I install rack 2.0.1:
sudo gem install rack -v 2.0.1
Successfully installed rack-2.0.1
Parsing documentation for rack-2.0.1
Done installing documentation for rack after 2 seconds
1 gem installed
Then I even ran "rbenv rehash", and I run "bundle update" again and the same error message shows up. How do I get Bundler to recognize the new gem?
Make sure you have the "bundler" installed from the ruby version installed by rbenv first. Then, check the ruby version in that directory. It should be the one that you installed from rbenv or rvm. After these, if you are installing something just don't use sudo before bundle. Because bundle is from the rbenv ruby version. If the rbenv rehash doesn't work, just restart the bash and check.
If the without sudo thing needs permission, you are most likely using the bundler that was installed by your system ruby as sudo gem install bundler.
Try reinstalling bundler without a sudo like gem install bundler and retry.
Even if that doesn't work, remove the Gemfile.lock in your directory. Remove any version of rack mentioned in your Gemfile if any. Just have the gem name like gem 'rack' and try bundle install again. The gem that you could install with sudo was stored for the system ruby, not the one you have installed through rbenv.
When you ran sudo install, your gem most probably got installed under a different directory. When using Rbenv or VRM, you shouldn't use sudo.
First of all you could try uninstalling the gem from your system gems and doing it again without sudo.
Going into extremes you could completely reinstall your rbenv with gems (and while at it switch to RVM, personally I think its easier to manage). After that try to bundle install everything again without sudo and it should work.

Uninstalling Postgres Rubygem on Windows 8.1

copy and paste "Hi, I'm new to Ruby/Ruby on Rails."
I'm running Windows 8.1. I have two outdated versions of the PostgresSQL Rubygem (pg) installed on my device: -v 0.9.0 and -v 0.18.2. I'm trying to uninstall both, but when I enter the command gem uninstall pg -v '0.9.0' for example, it's as if nothing happened. I installed -v 0.9.0 apart from bundle install.
I have already tried using the command:
ruby -e "`gem list`.split(/$/).each { |line| puts `gem uninstall -Iax #{line.split(' ')[0]}` unless line.empty? }"
This was supposed to remove everything - but it removed everything except the pg gems. What command should I be using to uninstall the pg gems?
Try gem list --details to see where your "pg" gems are installed. Perhaps they're in a different directory from where you expect (perhaps with unusual permissions).
Try bundle clean --force to remove all the gems that aren't part of the bundle. (You can also add --dry-run to see what it plans to do.)
And depending on how you installed it, you might consider re-installing Ruby.
Good luck!

Ruby on Rails cannot bundle install

Ruby version: 2.1.5p273
Rails version: 4.2.0
Gem Version: 2.2.2
OS: Windows 7 x64
Hello, I am very very new to rails programming. I am trying to start learning, but cannot because of these problems.
I created a rails app
I type: >rails new app
I then navigate to the created folder
I type: >rails server
It tells me
"Run 'bundle install' to install missing gems."
I do so and it than tells me:
"Make sure that 'gem install debugger-linecache -v '1.2.0' succeeds before bundling'"
after installing said gem I try bundle install again, but it than repeats the same error with a different gem.
""Make sure that 'gem install *random gem* -v '*random version*' succeeds before bundling'""
I hardly have any idea what I'm doing here. How can I get this server running?
i started to write an answer, and then saw you comment,
but for everyone out there who need an answer and didn't notice your comment:
Try this,
first run:
bundle update
and then try to bundle install
if its not working, install bundler:
gem install bundler
and now run bundle install
Solved by using the following two commands: gem update --system gem install bundler

Resources