Test Coverage Calculation For JRuby Rails Application - ruby-on-rails

I'm looking for a tool to generate code coverage statistics for my JRuby-backed Rails application. I've looked into things like simplecov, but they don't seem to support JRuby. As far as I can see, none of the 'common' libraries support JRuby. I haven't been able to find any good tools to do this for me.
I am using Rails 3.1.3 with Ruby 1.9.2.

There is a known issue with current JRuby coverage lib: http://jira.codehaus.org/browse/JRUBY-6106.
As the issue status states it is fixed in JRuby 1.7, which is currently in RC stage and will be out very soon.

Related

Where can I find the gem package for simplecov that are supporting ruby 1.8

I have a rather old ruby 1.8.7 + Rails 2.3.8 project which I still need to support. In the project there is a lot of unit test which I use.
And, I would like to have a code coverage report as I had for many years ago using SimpleCov.
But I cannot find the gem files any more. Every gem I can find is only for Ruby 1.9+....
Can you help me?
I found the answer my self. SimpleCov is ONLY for Ruby 1.9+. If I want to see my code coverage I should use rcov, which is ONLY for ruby <=1.8.7.
That solution is perfect for me.

How to upgrade big Ruby on Rails project from Rails version 4.2.2 to 6.0.2.2?

I have a huge rails web application with wide user base which runs on Rails 4.2.2 and Ruby 2.2.2 as of now. I simply want to upgrade the whole application to the latest version of Ruby i.e. 2.5.0 and Rails 6.0.2.2.
The reason for upgrade being I want to integrate a completely separate React.js frontend and a separate Rails backend. Other reasons for upgradation being deprecating older version of gems and rails.
I have tried researching a lot for this. I have also tried the : https://guides.rubyonrails.org/upgrading_ruby_on_rails.html guides. But everything out there is so vague and haphazard. I havent found any clear cut method until now following which I can upgrade my rails application smoothly.
Please help.
What i would recommend you to do is to upgrade to Rails 5.x.x first and than to 6.x.x you can use those guides and follow step by step:
https://www.ombulabs.com/blog/rails/upgrades/upgrade-rails-from-4-2-to-5-0.html
https://selleo.com/blog/how-to-upgrade-to-rails-6
I would recommend a progressive update for both Ruby and Rails. I would for example start by updating Ruby from 2.2.2 to 2.3, using the Release notes as guide of what things have changed:
https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released
Once that work (which would be easy to check if you have high test coverage), I would continue with Ruby 2.4 and so on.
Ruby minor releases (for example 2.2.2 to 2.2.3) shouldn't include breakable changes, so you can just go from 2.2.2 to 2.3, 2.4, 2.5 ...
Also, note that the last version Ruby is 2.7.1 and not 2.5.0. Another good reason to update your Ruby version is that it is not maintained any more and it does not receives security fixes. 2.5.8 is in security maintenance phase, which means that it won't be maintained anymore soon. You may want to update to at least Ruby 2.6.
Regarding Rails, you can find the release notes here: https://guides.rubyonrails.org/5_0_release_notes.html (just change the number in url to get the information of a different release).

What happen if i use ruby version 2.5.1 with rails version 2.3.18?

What happen if i use ruby version 2.5.1 with rails version 2.3.18 ?
I had rails application built on rails 2.3.18 and ruby 1.9.2p320,
I want to upgrade version of ruby only not the rails is it possible ?
What are the challenges i have to face with this ?
GitHub maintain a public fork that has branches for older Rails versions, with various changes, that they've been running over time. For some time, they were running older Rails releases on newer Ruby versions than they were originally supported on, so you might find some useful hints around what needs backporting there. They haven't used 2.3 for a few years now, though, so at best it will make less work.
In general, Ruby versions make few incompatible changes, but with a codebase the size and variety of Rails, most of those few changes do hit somewhere. This seems like a bad idea to me: any security fixes in newer Ruby versions, for example, will be vastly outweighed by the known vulnerabilities in such an old Rails release.
If you're doing this because your application uses the system Ruby and you're upgrading/replacing the OS, I would instead suggest using rbenv / chruby / ruby-build / ruby-install to install the old version for this app.
It should go without saying that running such an old Rails version is highly discouraged, and exposing it to the Internet is outright dangerous -- but I'll say it anyway.
Rails LTS apparently provides a service backporting security fixes to Rails 2.3, which may make it slightly safer. They also seem to currently support running Rails 2.3 with Ruby 2.3; while that's not 2.5, it might get you closer, or be good enough.

How is jekyll related to ruby?

I have a pretty general question regarding Jekyll. When I try to install it on my mac I get an error saying I don't have write permissions to the ruby directory. After looking around online I've found that you can fix this by installing a ruby version manager. My question is why does this work? Is Jekyll essentially an extended version of Ruby? How are they related architecturally?
Thanks!
I think Jekyll is a Ruby Gem. So that would mean it is written in Ruby, and needs the Ruby interpreter on your system to install/run it.
RVM is just a tool to help you manage your different Ruby versions (because you could potentially install multiple versions at the same time, for different users for example).
Jekyll is built in Ruby and is available as rubygem. That's why it requires Ruby to build. It provides command line interface to carry out deploy and other operations and provides minimalistic HTTP server.
It is also equipped to convert markdown to HTML using redcarpet ruby gem.
It's AWESOME.

Changing a project from Ruby on Rails to JRuby on Rails

What do I need to modify to change my ordinary Ruby on Rails project into a JRuby on Rails project? In addition, is it likely that a gem I included in my RoR project will be broken in the JRuby version of my project?
Lastly is there any way to create a JRuby on Rails app in APTANA or any other editor?
You will need to switch to Jruby instead of Ruby and this could be done using RVM. (www.beginrescueend.com)
You will have problems with gem compatibility when you switch to jruby not all gems will work. Usually gems with C extensions.
Lastly, for an IDE I am sure aptana is fine. You are still writing ruby code. Just when you run your code you will be using the JVM.
The main advantage of jruby instead of normal ruby is we can call the java libraries. And if you want you can even use Hibernate.
And switching if you are on a windows machine you need to use PIK(RVM for windows).
Like ericraio said there may be some gem dependency but most of the time the bundler will take care of that, so you don't need to worry about things(Most of the time).
If you want to check a particular gem please visit this site http://rubygems.org/
For my development I'm using NetBeans 6.9.1. If you want any help regarding how to make you first program in netbeans I'm ready to help.
I prefer to use command prompt to create and run rails project

Resources