How does Bundle know what gems need to be installed when I do a "bundle install"? Does it look for gems in a specific directory?
Bundler looks for a your gem dependencies in the Gemfile at the root of your Rails project folder, and executes the command bundle install.
Related
When i'm trying to install bundle with this command "bundle install" then it is showing me
could not locate gemfile
Please help me!!!!
here is the screenshort see this
Make sure you have installed Bundler with bundler -v. If you don't have it, install it with gem install bundler.
Later, create a new gemfile with bundle init command.
To work, you need to have a file name Gemfile with a list of all gem required by your application.
Locate this file and run the command in the same directory.
I'm having a problem with the rails
bundle install
command not being able to find a local gemfile.
The gem is located here::
~/.gem/ruby/2.1.5/gems/mygemname-1.5.0.SNAPSHOT
I included the gem in my Gemfile. But when I try to bundle my application, it get this error::
Could not find gem 'mygemname-1.5.0.SNAPSHOT' (>= 0) ruby' in the gems available on this machine.
I can see the gem sitting on my hardrive, but the bundle install command says it doesn't exist. Does anybody have any ideas on what may be going on here?
Thanks for your time.
As I canĀ“t comment yet...
I would check:
- Is it really the .gem folder holding the gem or is it symlinked (I am not confident that symlinks work on bundle install)
- Is rbenv or rvm in the game and is the installed gem installed with one of those or globally?
I've got the application from other developer, while i'm executing it through
bundle exec rails server
It give's me error of Could not locate Gemfile
now What should i do?
Try to run command bundle init
it will generate a Gemfile with the default rubygems.org source.
Gemfile in a rails application is used to manage gem versions used in your application.
For Gemfile maintenance have a look here .
Gemfile require at least one gem source, in the form of the URL for a Rubygems server. Generate a Gemfile with the default rubygems.org source by running bundle init .
Bundler is a dependency management tool used for ruby development. Bundler reads your gemfile and install the required gems.
You need to have a Gemfile in your application root directory for bundler to work.
I've started a simple rails application. I tried to install Compass and Haml, (using gem install) and ran 'bundle install'. The bundler re-installed all the gems and placed them in a new folder '/haml' inside the main directory of the rails application.
Your bundle is complete! It was installed into ./haml
Is that expected? Shouldn't these gems be placed in the rvm directory, not in the application directory?
$ bundle install --system
Will solve your problem.
Gems will be installed to your default system location for gems. If your system gems are stored in a root-owned location (such as in Mac OSX), bundle will ask for your root password to install them there.
While installing gems, Bundler will check vendor/cache and then your system's gems. If a gem isn't cached or installed, Bundler will try to install it from the sources you have declared in your Gemfile.
The --system option is the default. Pass it to switch back after using the --path option as described below.
I'm pretty new to Ruby/Rails but I was taking a look at bundler and was wondering how it works exactly. Do you install a full set of gems like normal gem install XYZand then use the Gemfile to pull a certain subset of those gems for use with a specific application? Or do you not install gems normally anymore and just include them in the Gemfile and then do a bundle install to include them all in a bundle that is then used with your application?
Thank you so much for taking the time to answer this, I'm just a little confused on what bundler's functionality is exactly.
-- MAP
These two links explain everything about bundler.
How does bundler bundle
How does bundle require gems
Think of bundler as a package management tool.
From bundle help command:
bundle install # Install the current environment to the system
bundle package # Locks and then caches all of the gems into vendor/cache
So bundle install command will install all gems to the system that are listed in Gemfile as well as their dependencies. If the gem was not previously installed it will grab it from the gemcutter repo. bundle package will cache the .gem files into your apps vendor/cache directory.
No need to run gem install first.