Rails Bundler - specify with-opt-dir in Gemfile? - ruby-on-rails

I am able to install puma after downloading openssl and executing the following command:
gem install -- --with-opt-dir=c:\openssl
The problem is then if I try to update puma with bundle, it knows nothing of this directory.
Can you specify -- --with-opt-dir= in a Rails Gemfile?

You can specify this in bundle config as follows: bundle config build.puma --with-opt-dir=your/opt/dir and bundler will pass it to the gem install.

Related

Error installing nokogumbo gem with specific version

I am trying to do bundle install on my project.
Ruby: 2.5.1
Rails: 5.0.7.2
Bundler: 1.17.3
But when doing the bundle install, it gives me this error with the nokogumbo gem and it doesn't install it, I'm using a mac.enter image description here
Have you tried:
bundle config set force_ruby_platform true
bundle install
Otherwise, paste in your commands and the output so we can see a better view of what is going on.

Rails keeps looking for a non-existent gem

I've replaced the gem mysql2 for a sqlite3 in development environment. However Rails keeps looking for it. I've tried to delete Gemfile.lock and it didn't work. I've also changed the database.yml file.
This is the error when I do rails db:create
LoadError: cannot load such file -- /home/gn09/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/arel-9.0.0/lib/arel/visitors/mysql.rb
replace gem in Gemfile
#gemfile.rb
gem 'sqlite3'
database.yml
something like this
bundle
bundle update - update Gemfile.lock correctly
rails db:create db:migrate
rails s
First uninstall ruby
rbenv uninstall 2.6.1
Then install again to get a fresh set of gems
rbenv uninstall 2.6.1
Then install bundler
gem install bunder -v '2.1.4'
Then
bundle install

Bundle install a local pg gem without internet access

I'm on a remote server with no internet access.
Have a Rails app.
Trying to bundle install (All gems were cached using bundle package --all to app/vendor/cached)
Since no internet connection I'm using the --local flag (Tells bundle to use cached values- link): Running bundle install --local fails saying:
An error occurred while installing pg (1.1.4), and Bundler cannot continue.
Make sure that "gem install pg -v '1.1.4' --source 'https://rubygems.org'" succeeds before bundling.
Now the cached gem is at app folder at app/vendor/cached/pg.1.1.4.gem
It only happen with the pg gem.
Usually I solve this problem using: bundle config build.pg --with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10 (Which basically tells bundle to use those arguments when installing pg). But that's when I have internet connection.
Now I can install pg manually using this command:
gem install --local app/vendor/cached/pg.1.1.4.gem -- --with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10
Notice there are two parts for the arguments, separated by --:
--local app/vendor/cached/pg.1.1.4.gem
--with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10
So the first part of the arguments: --local app/vendor/cached/pg.1.1.4.gem
How do I get bundle to do it?
At my workstation where I have internet connection I still got that error but use this to fix it:
bundle config build.pg --with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10 Which basically tells bundle to use those arguments when installing pg
But now additionally bundle need also to use a local path? I guess? (like the gem install command uses?
It tries to connect to rubygems.org
To summarize: how to make bundle install install a local pg gem? or convert the previously shown working gem install command to bundle install command?
ruby 2.5.3, rails 5.2.1, bundler 1.17.3
output for bundle config:
build.pg (/home/myuser/.bundle/config): "--with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10"
I tried several combinations using the bundle config build.pg command but no success:
bundle config build.pg --with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10
bundle config build.pg --local app/vendor/cached/pg.1.1.4.gem -- --with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10
Solved it by running
bundle config build.pg --with-pg-config=/usr/pgsql-10/bin/pg_config.

Ruby on Rails bundler: command not found: spring unable to proceed

run bundle install --local
Could not find gem 'rails (= 4.2.6)' in any of the gem sources listed in your
Gemfile.
run bundle exec spring binstub --all
bundler: command not found: spring Install missing gem executables
with bundle install
Please help me solve this issue.
You will probably have Rails version different version of Rails(Its clear that you don't have 4.2.6 installed) installed(your rails project directory), but apparently you has updated it and now your project requires version 4.2.6. Update your gems:
bundle install

Rails ruby script/server error -- no such file to load -- gdata/spreadsheet

Rails ruby script/server error -- no such file to load -- gdata/spreadsheet
I have require gdata/speadsheet in /Users/me/myapp/vendor/gems/roo-1.2.3/lib/roo/google.rb
I cannot figure out how to install it.
Tried
gem install gdata_spreadsheet
gem install spreadsheet
gem install gdata
Which all seem to install, but still get
no such file to load -- gdata/spreadsheet
When
ruby script/server.
Any ideas on how to get this file?
Assuming you are using bundler for dependencies try adding the gem to your Gemfile:
gem 'gdata_spreadsheet'
Then use bundler to install your dependencies and start your server:
bundle
bundle exec script/server

Resources