How does a Ruby gem becomes invalid? - ruby-on-rails

My Ruby on Rails dev server has been running for a while on Windows 2016 server. But I had to restart it yesterday.
Then it raised the following error:
The git source https://github.com/fchampreux/write_xlsx_rails.git is not yet checked out. Please run `bundle install` before trying to start your application
I don't understand where this suddenly comes from !?! I created this gem 2 years ago by forking an obsolete version from DatozMX/write_xlsx_rails. And it used to work as expected. It is declared in Gemfile as the following:
# XLSX format support
gem 'write_xlsx'
gem 'write_xlsx_rails', git: 'https://github.com/fchampreux/write_xlsx_rails.git', branch: 'master'
If I replace the remote reference by the former local path (used when updating the gem), the gem is made available. But this cannot be used for deployment.
So I tried to run bundle install as suggested, and I get the following error:
Retrying `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch --branch master -- https://github.com/fchampreux/write_xlsx_rails.git
C:/Ruby27-x64/lib/ruby/gems/2.7.0/cache/bundler/git/write_xlsx_rails-858752332ce805e34a469f55ad6a2b115033800a` at C:/Sites/sis-portal due to error (2/4):
Bundler::Source::Git::GitCommandError Git error: command `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch --branch master -- https://github.com/fchampreux/write_xlsx_rails.git
C:/Ruby27-x64/lib/ruby/gems/2.7.0/cache/bundler/git/write_xlsx_rails-858752332ce805e34a469f55ad6a2b115033800a` in directory C:/Sites/sis-portal has failed.
fatal: unable to access 'https://github.com/fchampreux/write_xlsx_rails.git/': SSL certificate problem: self signed certificate in certificate chain
As other gems are correctly updated by the Bundler, I suspect a certificate issue. But why only on this gem from my GitHub repository? This is beyond my competency!

I finally solved the problem by updating Git.
We use the SSL version built into Git install. We installed it more than 2 years ago ... and its certificates were over 2 years old and had expired.

Related

Cannot install gem from github on dev box

I have a gem file which works fine locally. In my gem file one of my gems installs using a github location like so...
gem 'rails3-jquery-autocomplete', :git => 'https://github.com/willfults/rails3-jquery-autocomplete.git'
The problem is when I run ssh into my dev box and run bundle or bundle install I get the following error on my server...
Fetching gem metadata from https://rubygems.org/..
Fetching https://github.com/willfults/rails3-jquery-autocomplete.git
fatal: failed to open '/srv/www/socialu.com/https://github.com/willfults/rails3-jquery-autocomplete.git/objects': No such file or directory
Git error: command `git clone 'https://github.com/willfults/rails3-jquery-autocomplete.git' "/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-186d8dd59401e0d4dd8c2860261d9ba55e0793f2" --bare --no-hardlinks` in directory /srv/www/socialu.com has failed.
How can I resolve such? Thanks.
Update: with the git url I get the following...
Fetching git://github.com/willfults/rails3-jquery-autocomplete.git
remote: Counting objects: 1846, done. remote: Compressing objects:
100% (784/784), done. remote: Total 1846 (delta 1072), reused 1688
(delta 957) Receiving objects: 100% (1846/1846), 481.07 KiB | 764
KiB/s, done. Resolving deltas: 100% (1072/1072), done. ssh: Could not
resolve hostname /srv/www/socialu.com/https: Name or service not known
fatal: The remote end hung up unexpectedly Git error: command git
clone --no-checkout
"/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-6e048304dc5207eafc457581b1fa2d0073d2e1ed"
"/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/bundler/gems/rails3-jquery-autocomplete-060f2bea5e46"
in directory /srv/www/socialu.com has failed. If this error persists
you could try removing the cache directory
'/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-6e048304dc5207eafc457581b1fa2d0073d2e1ed'
It is a path issue, as you can see the URL is mixed with folder path.
Try to use git:// URL instead of https://.
Not sure if it will work, but it is a path issue somewhere.
Also check your rubygems version on the server, and update it if needed (latest is v1.8.24). There is something different on your machine if it works as is.
gem -v
Hope that helps.

Gem file with git remote failing on heroku push

I have the following line in my gemfile:
gem 'client_side_validations', :git => "git#github.com:Dakuan/client_side_validations.git", :branch => "master", ref: '2245b4174ffd4b400d999cb5a2b6dccc0289eb67'
The repo it's pointing at is public and I can run bundle install / update locally just fine. When I try to push to Heroku I get the following error:
Fetching git#github.com:Dakuan/client_side_validations.git
Host key verification failed.
fatal: The remote end hung up unexpectedly
Git error: command `git clone 'git#github.com:Dakuan/client_side_validations.git' "/tmp/build_1xa9f06n4k1cu/vendor/bundle/ruby/1.9.1/cache/bundler/git/client_side_validations-56a04875baabb67b5f8c192c6c6743df476fd90f" --bare --no-hardlinks` in directory /tmp/build_1xa9f06n4k1cu has failed.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
Anyone got any ideas about what's going on here?
Use this GitHub URL instead: git://github.com/Dakuan/client_side_validations.git
The git#github.com:… URL is the writable SSH version, which requires authentication with an SSH key connected to a GitHub account that has write access to the repository.
The git://github.com/… URL is the public, read-only version.
Since the gem you're using is in a public GitHub repository, you can also use this shorthand in your Gemfile:
gem 'client_side_validations', :github => 'Dakuan/client_side_validations'
See the Bundler Git documentation for more information.
A late second answer, as I ran into some confusing output from Heroku's build logs which stumped me for a while.
If you have multiple Github hosted gems in your Gemfile, and one of them is inaccessible (in my case, I had accidentally pointed to a private repo of mine), the build logs throw an error like Username not found or Repository not found for all the Github hosted gems - even those that are available.

bundle install leads to git clone error. Not sure what this response means

Getting a strange error on bundle install..
bundle install
Fetching gem metadata from http://rubygems.org/.....
Fetching gem metadata from http://rubygems.org/..
Fetching git://github.com/maccman/gdata.git
fatal: The remote end hung up unexpectedly
Git error: command `git clone 'git://github.com/maccman/gdata.git' "/Users/elephanttrip/.rvm/gems/ruby-1.9.2-p318#shasta/cache/bundler/git/gdata-811f852468ac76e0019108d8c5320da12b6683d4" --bare --no-hardlinks` in directory /Users/elephanttrip/Sites/shasta has failed.
This wasn't happening until I installed the mysql2 gem and mysql with brew.
Any ideas what this error means?
UPDATE
Also none of the folders it is trying to clone this to exist. It's probably something to do with my bundle paths and juggling .rvm
The problem is not on your end. Trying:
git clone 'git://github.com/maccman/gdata.git' "foobar" --bare --no-hardlinks
Fails on my machine with the same error.
Interestingly a non-bare clone seems to work as expected.
resolution: Clone from the https interface: https://github.com/maccman/gdata.git instead.
In your Terminal write bundle config github.https true
In your Terminal write bundle install
Add your SSH key to the github.
Or as #brice mentioned, you need to add your team to the repo.

Bundle update is failing

I just ran bundle update and got the following error - I have no idea what this is.
c:\San\ruby>bundle update
Updating git://github.com/odorcicd/authlogic.git
github.com[0: 207.97.227.239]: errno=No error
fatal: unable to connect a socket (No error)
An error has occurred in git when running git fetch --force --quiet --tags "git
://github.com/odorcicd/authlogic.git" refs/heads/*:refs/heads/*. Cannot complete bundling.
All my gems are up to date (gem update --system) and installed (bundle install). I did just upgrade from Rails 3.0.0 to 3.0.1, which required some other updates for Activesupport, Activemodel, etc, also to 3.0.1. Do you know what might be causing the error above?
At first glance, this looks like a network error connecting to github. Try to clone the repo via command line and see if you can get to it. A proxy or firewall may be causing this issue.
git clone git://github.com/odorcicd/authlogic.git
Or you can try the http url instead:
http://github.com/odorcicd/authlogic.git

Heroku / "fatal: pathspec '.gems' did not match any files"

I am trying to deploy one ROR app on Heroku.
As I typed "git push heroku master", I got this :
-----> Heroku receiving push
-----> Rails app detected
-----> WARNING: Detected Rails is not declared in either .gems or Gemfile
Scheduling the install of Rails 2.3.8.
See http://docs.heroku.com/gems for details on specifying gems.
I wanted to know what it meant especially what was behind the "WARNING" message.
On Heroku's website (http://docs.heroku.com/gems) it's said you can fix this issue with the following instructions :
git add .gems
git commit -a -m "added .gems file specifying framework
git push heroku master
The problem is when i type "git add .gems", I get this :
fatal: pathspec '.gems' did not match any files
What do you think i should do ?
Thanks in advance for your time.
Have been learning Ubuntu, Heroku+ROR for a few days
OS : Ubuntu
Ruby : 1.8.7
Rails : 2.3.8
You have to create the .gems file first, if it doesn't exist already:
$ touch .gems
$ git add .gems
$ git commit

Resources