unable to install gems
Hey,
for 5 hours now I am trying to install a gem that allows me to create an excel file (like this one: https://rubygems.org/gems/excel_rails) in RubyMine and for my life I can't figure out how to do it.
I am able to install all kinds of gems using the command prompt with Ruby and Rails, but the gems then don't show up in RubyMine (at least when I look at Settings - Languages - JavaScript - Ruby SDK and Gems). When I try to access the gems in RubyMine they don't work either, so I guess they are not installed in RubyMine (?!).
I searched online how to install gems in RubyMine, but the best I found was that if I access Settings - Languages - JavaScript - RubySDK and Gems there will be an option "Install new Gem". But that option does not show up in my program, so that was no help.
I tried to just type "install gem 'excel_rails'" and "install gem excel_rails" in my RubyMine project file but that did not have the desired result either.
I have the Bundler Gem/Tool and I tried to click "Install" and then it asks me for arguments... but I don't know what to put there and all commands I can think of (e.g. as mentioned above) did not work either.
If I try to implement the gem in my projects without installing it, RubyMine thankfully detects that the actual Gem is missing and trys to help with giving me the option "install", which again opens the Bundler asking me for an argument.
I confess (and you might have noticed), I am fairly new to Ruby and RubyMine. I have been searching for tutorials etc. for my problam, but either they don't work or they are described in ways that I don't understand...
After 5 hours I am giving up on trying to solve it on my own. Can someone help me?
Thanks so much in advance
Please sign in to leave a comment.
Hello,
Thanks for detailed description, but it's still not clear why you don't use Bundler to install gem? I've put this gem into Gemfile and run bundle install, then gem is available. Do you use Gemfile? if not, please describe your project a bit, i.e. attach the project structure?
By the way, description on Github says that this gem works only with Rails 3, please see https://github.com/asanghi/excel_rails.
Hey Anna,
thanks for both hints! So many websites post the gemfile together with the install code, but it was not clear to me until now which one exactly to use, where exactly to put it and what to do with the bundler.
For future readers: I posted the gem = the code you get on the website (in my case: gem 'excel_rails', '~> 0.3.1') into my gemfile.rb file in my project. It didn't work when I ran the project, but pressing Alt-Enter or clicking on the gem in the gemfile opened the Bundler to install the gem. I always thought I had to enter something as an argument in the Bundler, but it actually only works if you don't enter anything, but just click install.
Thanks, Anna, also for the hint about the Rails version. I will try if it works with my Rails Version tomorrow. If not, I am totally fine to download another gem, now that I know how to install it ;).
It might seem very dumb to you that I couldn't find out how to install an easy gem, but I was really checking so many websites and none gave clear instructions... very relieved I could figure it out with your help...!
Thanks so much - I wish you the best!
Hope you will manage to install gems using Bundler. And yes, it's possible not to put any arguments and Bundler will use default place to install gem and default options. Anyway all available options are listed here http://bundler.io/v1.3/man/bundle-install.1.html.