I am trying to run bundle install in a remote machine which does not have access to the gems.internal.com source.
I am running the command:
bundle install --without deployment
But I get the error:
Could not fetch specs from http://gems.internal.com
The deployment-gem is a required gem only for Teamcity deployment which runs capistrano commands and it's not needed when running bundle install on the remote machine.
Here is my Gemfile which is inside a bundle I unpack from a .gem file in a production server:
source 'https://rubygems.org'
gem 'rubocop', '0.39.0'
gem 'rspec', '3.4.0'
gem 'rake', '11.1.2'
gem 'thor', '0.19.1'
gem 'rubyzip', '~>1.1'
gem 'aws-sdk', '~> 2'
group :deployment do
gem 'deployment-gem','0.4', :source => "http://gems.internal.com"
end
What am I missing here?
bundle install --without does not install the gems, but still downloads them to check dependencies
If you absolutely cannot make all sources accessible by remote machine - you may go with bundle package and checking all gems into repository
Related
I have a project where we are building a custom gem which is hosted on a private gemserver (gemfury). This gem is a dependency in multiple Gemfiles where I need to run tests.
So I have a Gemfile that looks like this:
source "https://rubygems.org"
source 'https://gem.fury.io/custom/' do
gem 'my-custom-gem', '0.0.42'
end
gem 'aws-sdk-iotdataplane', '~>1.15.0'
gem 'bson', '~>4.4.2'
gem 'mongoid', '~>6.1.1'
.
.
.
I build and install the gem locally with rake install (which works fine) and then attempt to run bundle install on the above Gemfile.
I get the following error:
$ bundle install
Fetching gem metadata from https://gem.fury.io/custom/..
Could not find gem 'my-custom-gem (= 0.0.42)' in rubygems repository https://gem.fury.io/custom/ or installed locally.
The source contains the following versions of 'my-custom-gem': 0.0.1, 0.0.4
It is my understanding that if the gem is installed locally on the system, bundler should not attempt to fetch it from the source.
Is this correct?
If I remove the custom source block from around the gem line, it will use the local gem and the fact that the error message says "... or installed locally" really seems to suggest this should work.
I want to add code coverage to my project and sign up coveralls.io and create Gemfile with:
gem 'coveralls', require: false
but how can I install the gem from Gemfile?
run the command bundle install in your shell, once you have your Gemfile created.
This command will look your Gemfile and install the relevant Gems on the indicated versions.
The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.
Your can create a Gemfile just by typing bundle init in your shell
I add a Gemfile example for your reference:
source "https://rubygems.org" # where gems will be downloaded from
ruby "2.2.3" # ruby version, change for the one you use
gem "sinatra"
gem "sinatra-flash"
gem "sinatra-partial"
gem "bcrypt"
gem "dm-validations"
gem "dm-transactions"
gem "data_mapper"
gem "dm-postgres-adapter"
gem "pg"
gem "database_cleaner"
group :test do # you can make groups for test, development, production..
gem "rspec"
gem "capybara"
gem "rspec-sinatra"
gem "cucumber"
gem "coveralls", require: false
end
First install bundler if you don't have it
gem install bundler or sudo gem install bundler if you don't have the required permissions. Bundler is a gem that manages gem dependencies.
then you can follow the above instruction for creating the gemfile, after which you can issue the command
bundle install
I'm planning to use Phusion Passenger Enterprise for production, but was just going to use the open-source passenger gem for development to test things out and get it running.
I set up my Gemfile like this:
group :development, :test do
gem "passenger", ">= 5.0.25", require: "phusion_passenger/rack_handler"
end
group :production do
gem "passenger-enterprise-server", ">= 5.0.25", require: "phusion_passenger/rack_handler"
end
But when installing for development, it always wants to install passenger-enterprise-server ...
$ bundle install --without production
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'passenger-enterprise-server (>= 5.0.25) ruby' in the gems available on this machine.
$ more .bundle/config
---
BUNDLE_WITHOUT: production
I'm not sure what I'm doing wrong here...
Bundler still needs to get the gemspec for all gems listed, and compare them all for compatibility, even with --without -- it won't actually install passenger-enterprise-server, but still needs to look up it's .gemspec to check compatibility.
And it can't find it for some reason. Probably because it's a license-protected limited access thing.
I'd ask Passenger support how they suggest you handle this.
Try bundle install --without=production
source
Update: Also, try installing the gem on your machine with gem install first, then run bundle install in your project.
I am using rvm, ruby 2.0.0 and bundler.
My Gemfile looks like this:
source 'https://rubygems.org'
gem 'logger'
gem 'mygem', :path => '.'
bundle installs both of them gems. bundle show shows logger is installed in ~/.rvm/gems/ruby-2.0.0-p247/gems, but mygem is installed in the path where the gem is located.
Is there any way to get bundle to install the local gem into rvm's gems directory?
No, Bundler treats path gems differently and does not install them to your GEM_PATH. This is so that you don't need to reinstall as you make changes.
It is not normal or necessary for a gem to point to itself or its runtime dependencies in its Gemfile. You might want to add gemspec to do this automatically. See http://bundler.io/v1.3/rubygems.html
Trying to deploy to Heroku but get the following error:
-----> Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
Fetching source index for http://rubygems.org/
Could not find devise-1.4.6 in any of the sources
FAILED: http(preventing hyperlink)://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
I have "gem 'devise'" in my gem file, have "source 'http://rubygems.org'" at the top, and have run both bundle install and bundle update. Not sure why Heroku is looking for 1.4.6. Any ideas?
Thanks!
John
Here is the gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.9'
gem 'devise'
gem 'sqlite3', '1.3.3', :group => :development
Looks like devise 1.4.6 is no longer at Rubygems.com: http://rubygems.org/gems/devise/versions
I tried using devise 1.4.5, but it didn't work either.
You need to update the locked version of Devise in your Gemfile.lock.
$ bundle update devise
Then commit, push and deploy to Heroku.