We have a ruby rails project which we normally get from our enterprise github repository. Recently, I've added dependencies that for some reason breaks my other projects that are not related to the one I was working on. My questions are
Does "bundle install" saves the dependencies globally? or can it behave like the npm to install on current project?
Can I undo "bundle install" by using "bundle clean --force"? after doing this and running "bundle install" again it doesn't to make any changes (not showing "Installing" instead it's say "Using"
I tried removing the the version of ruby since I found out that runing "bundle install" creates a directory /usr/share/rvm/gems/ruby-2.7.2#ruby_test_setup_engine/. But my issue was still there.
I also tried deleting the project folder and cloning it again but since
/usr/share/rvm/gems/ruby-2.7.2#ruby_test_setup_engine/ was created it didn't do anything at all.
Not sure what kind of issues you are facing. but based on your question here is the details:
Does "bundle install" saves the dependencies globally?
No it's not saves globally, it's saved specific to project and more specific to gemset you are using.
Can I undo "bundle install" by using "bundle clean --force"?
No, this command just cleans up unused gems in your bundler directory.
But you can undo your bundle via rvm gemset empty.
Removing gem directory won't help as it will create as soon as you run bundle install command.
Another way to reset you gemset is remove your Gemfile.lock and copy from original source and re run bundle install.
Hope this info will helps.
Related
I deleted the gemfile.lock from my Redmine 2.2, installed in my machine. How can I restore it?
I tried "bundle install", without success.
In your case, it's not a big deal.
Gemfile.lock is a snapshot of which version of a gem was installed, where it came from, and it's dependencies, for reasons of portability. Given that you are using packaged software, unless you plan to distribute your code at some point in the future, lacking a Gemfile.lock is not the end of the world.
If you absolutely need a Gemfile.lock file, try changing your Gemfile and running bundle install again. Bundler installs a gem if it cannot find it already cached or installed. Since you are trying to install a fully-installed set of gems, Bundler may be glossing over the entire process without performing any work. Give it something to do by installing an arbitrary gem you don't already have, then maybe it will generate a new Gemfile.lock file for you.
Or I suppose the easiest way is to delete your entire gems folder then run bundle install. This is equivalent to starting over with a clean install, without nuking your data set.
Are you using version control? If you are try git reset --hard. Otherwise, no one can help you...
After installing RBEnv and rebuilding my ROR project, I now seem to have added many, many files to my project. They are in /vendor/local, and appear to duplicate what you would normally find in /Library/Ruby/Gems.
My project will not run without these files present (I get the message Could not find rake-0.9.2.2 in any of the sources.
I had difficulties with my RBEnv installation. I have what I suspect are other issues (like I have to bundle exec rails instead of just running rails). I suspect that I have done something wrong and should not have these files in my project. What I'd like to know is:
1) Should these files be there?
2) How best to fix this (if this is not how it is supposed to work)?
3) If the best approach is to start over and reinstall rbenv, how do I clear it all out?
It is true that using RBENV will end up putting copies of your gems in the project's /vendor/local folder. This is to remove any dependencies on your base gem set. These files need not be part of your source repository, as long as your 'gemfile' and your '.rbenv-version' file are included in the repository.
Another price you pay for using rbenv is that you must bundle exec rails <command> and bundle exec rake <command> from here on in.
I haven't upgrade my gems for a long time, just today, I decided to run a upgrade. I probably made a mistake at first running bundle install update, which didn't do anything. Then I ran bundle update, and it created a whole new folder called update in my rails directory containing all the gems, and it seems like my rails project is no longer linked to my rvm gem directory because if I remove the update folder it fuzzes about not being able to find gems. I'm just wondering if this is the new behavior to rails or it's because I did something wrong. Thanks!
Edit:
The output of bundle config is:
Settings are listed in order of priority. The top value will be used.
path
Set for your local app (/Users/X/dev/tasker/.bundle/config): "update"
disable_shared_gems
Set for your local app (/Users/X/dev/tasker/.bundle/config): "1"
This seems to be the problem. So how should I revert it to its state before by linking to the rvm gem directory? And is the problem caused by my 'bundle install update' command? Thanks!
Edit again:
Thanks for the help guys. After finding out the root issue of my problem, I found this solution: bundle install --system at How can I fix an accidental 'sudo bundle install dir_name'?. Now the problem is solved. Thanks!
I made same mistake.
Check command line options for bundle. bundle install accepts directory. and if you type bundle install update, it install the bundle onto the directory.
If you did, bundler create .bundle/config file and store the given path in the file.
I think, just removing .bundle directory and run "bundle" will bundle the needed files,
will use the gems in RVM (if RVM configured correctly).
I was trying to fix some garbage that was happening (frustratingly) by updating rubygems yesterday. To fix spork, I typed "bundle install spork" before I realized I hadn't actually typed "gem install spork" and it installed everything in a spork directory within my project folder. I removed that, and tried "bundle install ." which seemed to work. But I just went to do a commit and noticed I now had a ruby directory in my project.
I removed that, but now don't know how to get bundle to go back to installing somewhere outside my project directory. Does anyone know what command will accomplish this?
If you ever accidentally invoke bundle install foo then it will try to install your gems inside a foo directory, and also will set this as your permanent choice in .bundle. So, take a look at .bundle/config and make sure there isn't anything unwanted in there.
Needed to use bundle install --system to get it to revert back to the default directory.
bundle install with no path argument does it for me.
I have a Rails 3rc app on Ruby 1.9.2 that works fine, but Bundler keeps making a folder named "bandsintown" (bandsintown is a gem I use) in my project directory. From what I can tell, the folder has all my gems in it. I'm pretty sure that this never happened before. Is it normal behavior?
I think this might be interfering with running tests. I get a "Command failed with status (1)" error and then it mentions the "bandsintown" folder a few times.
I find it odd that Bundler names the folder "bandsintown" even when I comment out that gem in the gemfile. There's a "ruby" folder in that one, and a "1.9.1" folder inside the "ruby" folder. I don't understand why it says 1.9.1 when I'm using 1.9.2. The 1.9.1 folder has a bin, bundler, cache, doc, gems and specification folder inside of it.
I made a testapp with all the same gems and did a bundle install. It doesn't make a new folder with all my gems in it.
Anyway, my app works fine, but I'd appreciate it if anyone could help me out here. If I left out any need-to-know information, let me know. Thanks.
You are probably running the following command: bundle install bandsintown. That command tells bundler to install gems into the bandsintown subdirectory of your application. In order to install gems, all you need to do is modify your Gemfile and run bundle install.
Bundler will remember the location that you last specified in the .bundle/config file. So, in order to "reset" bundler's memory. In your application's directory, run rm -r .bundle/config.
Then, after updating your Gemfile, simply run bundle install