Despite the ruby and gems being pointed to correctly (I believe) as seen below:
Rubymine is not registering that the gem is installed.
Adding to the mystery: when running a file with RubyMine the gem appears to be found as when run via the RubyMine runner the output is:
/Users/me/.rvm/rubies/ruby-2.4.2/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/me/RubymineProjects/effective_testing_with_rspec_3/path_tests.rb
true
So it appears to be an issue mainly centered on editor. Any help would be super. I cannot find much info beyond suggestions to edit the Ruby SDK and Gems preferences but those appear correct to me. Thanks!
Related
I'm opening ruby file via RubyMine. IDE suggests installing RuboCop. I accept it, but after a few seconds it shows:
Following gems were not installed: rubocop (1.0.0): Cancelled
Documentation says its problem with interpreter path. Problem is its already set. Even when i try to add it like documentation says, it won't let me, because its already set.
Any ideas what i can do? I have been using VisualStudio Code without issues before it, but Ruby support is pretty poor, i had to use terminal, while for example python has full support and you can just run program with one button.
I have no knowledge in Ruby, but I need to run some tests in it. The code is in Ruby and Cucumber. I use intellij on Mac. When I first open intellij cucumber step definition where not recognised from feature file. In terminal I got:
Required ruby-2.1.2 is not installed.
To install do: 'rvm install "ruby-2.1.2"'
but
$ which ruby
/Users/myuser/.rvm/rubies/ruby-2.4.1/bin/ruby
so I run the install command as suggested and now I get
$ which ruby
/Users/myuser/.rvm/rubies/ruby-2.1.2/bin/ruby
Now my feature files connected to step definition as well. I will appreciate if anyone could explain me what happened. What prompted me to downgrade the version of Ruby and how it fixed cucumber.
Make sure you have ruby 2.1.2 set in File -> Settings -> Languages & Frameworks -> Ruby SDK and Gems
What I suspect is happening is you have run rvm use 2.1.2 in the terminal but when your IDE runs something it is using the ruby version set in the settings.
You probably have a .ruby_version file in the project root directory. This will enforce a specific version of Ruby. So the person who put it there is who to ask why the version was restricted like that. There may have been a good reason, such as that's what is being used by all your users.
It has nothing to do with Cucumber. rvm has some kind of operating system hook, I think, that runs whenever you cd into a directory. It looks for its special control fiels such as .ruby_version and .rvmrc file. This page describes this in more detail: https://rvm.io/workflow/projects.
I've read a ton about how El Capitan's SIP messes up brew, ruby, and it's gems. The most recent thing I read is that brew was updated to better support El Capitan, so I followed a number of commands from an article online and apparently cleaned my whole system up and reinstalled all gems. Now, from terminal, everything works great. I don't have to write anything special to install gems... just gem install <name>.
However, SublimeText seems to be using a different Ruby. If I type which ruby, it shows as /usr/local/bin/ruby. But in SublimeText, it's showing this error about not finding the right gem (mechanize in this case): /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire': cannot load such file -- mechanize (LoadError)`
I tried creating a different build system file for Ruby, which points to ruby at /usr/local/bin/ruby, but it still shows this error (but below, it shows [cmd: ['/usr/local/bin/ruby']...
This has also caused me major issues trying to get the shoes gem to install.
Long question shortened: is there a definitive way to clear my system of all past brew, ruby, gems, etc etc, and redo it in a proper way that actually works for El Capitan?
Checkout #paskal answer here: Ruby 'require' error: cannot load such file
Try changing require <file name> with require "./<File name>".
Ruby 2.2.2 on Ubuntu
I have been following the saasbook tutorial on Rails and am getting to grips with the workflow.
I am confused about debugger which some sources says us now 'included' post Ruby version 2. It fails to compile on the example projects and many people have the same issue.
I have found that any bundle install that I try to do with the examples. (see here) (possibly after a bundle update) will fail on trying to 'gem install debugger -v '1.6.x''.
I have found that by commenting out the debugger line in the Gemfile will get me around this hurdle and upon firing up the Rails server, everything seems to work. I also have to change the Ruby version to my current one (2.2.2).
I am assuming that I am working with pre version 2 Ruby examples and this is good to do post version 2.
Am I correct? What has happened to the debugger post version 2?
The debugger gem is not supported on Ruby 1.9. See the debugger readme on GitHub here. If you need a command line debugger for newer versions of Ruby you can use byebug.
You can use the basic built in debugger if you prefer. Simply put require 'debug' anywhere in your source code and the Ruby interpretor will stop at that point and allow you to inspect variables etc. You do not need to install or add any additional gems to your Gemfile to use this as it is built in. See the built in debugger documentation here
I am in the early stages of learning Ruby and want to learn how to debug a gem, but am having trouble finding learning resources around this. A simple example would go a long way for me.
Is debugger the preferred debugger? Where do I require it? How do I set breakpoints with it?
Note: I am making an educated guess that the debugging process may be different depending on the gem that needs debugging, so for reference I am particularly interested in debugging certain issues with Compass.
OK, figured this out on my own. Here were the steps I took..
I am running Ruby 1.9.3 (determined by running ruby -v), so after testing ruby-debug and ruby-debug19, I determined these debuggers were no longer maintained, or at least didn't work properly with my install of ruby1.9.3-p125. This lead me to debugger.
The install instructions that worked were:
$ gem install debugger -- --with-ruby-include=PATH_TO_HEADERS
The PATH_TO_HEADERS on my machine, was simply the source location of ruby:
/Users/myusername/.rvm/src/ruby-1.9.3-p125/
Since I was particularly determined to debug the Compass compiler, I did the following:
Cloned the source: $ git clone git://github.com/chriseppstein/compass.git
Checked existing compass version first $ compass -v which was 13.0
Edited VERSION.yml and increased the patch number (to 13.1) so it didn't conflict with my existing install.
Edited the .rb of the file I wanted to debug, which was lib/compass/compiler.rb and added this line at the top: require 'debugger'; debugger
Built the gem: gem build compass.gemspec
Installed the newly compiled gem: sudo gem install compass-0.13.2.058ead2.gem
Compiled an existing compass based project that I was experiencing problems with, and started debugging.
When I was done debugging, I uninstalled the debugging version with sudo gem uninstall compass and chose the number corresponding to Compass 13.2.
Note about step 7: Since debugger has the same debugging commands as ruby-debug/ruby-debug19, I was able to follow existing tutorials around debugging steps..
Such as this RailsCast:
http://railscasts.com/episodes/54-debugging-with-ruby-debug
And this blog (and linked cheat sheet):
http://pivotallabs.com/users/chad/blog/articles/366-ruby-debug-in-30-seconds-we-don-t-need-no-stinkin-gui-
If you have other debugger tutorials, pointers, tips, etc, please post them.