Bundler: Could not local Gemfile - ruby

I'm moving some ruby projects over to an Ubuntu machine, and am trying to install the dependencies.
I've installed ruby-full and the bundler gem. When I move to the project directory and type bundle install I get the error Could not locate Gemfile
I am in the correct directory, and the GemFile is there.
If I ls the current directory, I see:
etrax_connect.rb fujixml.bat fuji_xml.rb GemFile GemFile.lock generate_subject_xml.rb logging.rb prawn_functions.rb README.md samples sftp_connect.rb
Its RIGHT there.
The contents of my GemFile:
source 'https://rubygems.org'
gem 'listen'#file listening
gem 'nokogiri'#xml parsing
gem 'rake'#Globbing
gem 'net-sftp'
gem 'tiny_tds'
gem 'prawn'
I dont understand.

Rename GemFile to Gemfile, and also GemFile.lock to Gemfile.lock.

Related

bundle install - The Gemfile specifies no dependencies - Even though I'm in the directory that contains the Gemfile

I'm trying to follow a guide to use rspec for testing. I use bundle init to create the Gemfile. Then I tried to do bundle install (following the guide) to install all the gems. I made sure to be in the same folder containing the gemfile. However, I keep getting this:
The Gemfile specifies no dependencies
Bundle complete! 0 Gemfile dependencies, 1 gem now installed.
Use bundle info [gemname] to see where a bundled gem is installed.
My Gemfile (right after I did bundle init) looks like this:
frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "rails"
I use ruby 2.7.1.
Any help will be greatly appreciative.
I tried this step by step and I get this error only when I haven't specified any gem in my Gemfile. I guess the bundle init command create a Gemfile with gem 'rails' line is commented. Please verify your Gemfile and make sure you have added at least one gem into your Gemfile or check if gem 'rails' line is still commented out.

How to install gems from Gemfile?

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

Bundler: install local gem with system gems

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

How to install gemfile on osx?

I am trying to install the following gem from the command line following the instructions:
https://github.com/maxdemarzi/neography
Executing:
gem 'neography'
Results in "Unknown command neography".
I have "bundle" gem installed from executing "gem install bundle".
What step am I missing? Does this have to be done for each individual project? Or is this supposed to install to environment?
The command you're looking for is gem install neography.
To create a Gemfile for your application, you need to look into the bundler gem's Gemfile. Basically, just create a file named Gemfile in your project root with a source and your list of gems and run the command bundle install.
A Gemfile that would work for you in this case is:
# Gemfile
source 'https://rubygems.org'
gem 'neography'

Using bundler, how do you unpack a gem installed via a git repository?

How can I unpack a gem specified in bundler by a :git => url?
My Gemfile has
gem 'my_gem', :git => 'git#github.com:xxxxx/xxxxx.git'
$ bundle correctly reports the gem as available, and my code works. $ bundle which my_gem even tells me where my gem is stored. However:
$ gem unpack my_gem
ERROR: Gem 'my_gem' not installed nor fetchable.
$ bundle exec gem unpack my_gem
ERROR: Gem 'my_gem' not installed nor fetchable.
Is it possible to unpack a gem installed like this?
Why the need to unpack it? You already have the sourcecode. The point of specifying a git repository is that you don't have a bundled gem, but the source to generate it.
Simply use
git clone git://github.com/xxxx/yyy.git
and the source will be in the yyy folder of the current directory.
Also, you can open any gem in your Gemfile using:
bundle open my_gem
Not exactly answering the question but supposing you had the gem file to hand, it's a bunch of gzip files tarred up (opposite to the usual)
$ tar xzf mygem.gem
$ ls
mygem.gem checksums.yaml.gz data.tar.gz metadata.gz
metaddata.gz is the gemspec, and data.tar.gz is all the files (lib/my/stuff.rb etc).

Resources