PRY- Alternative for IRB


Bookmark and Share

What is PRY? Why do we need PRY? Why read an article on PRY? Some of these questions might pop up in your mind when you read the title of this blog. Let me explain why you should be knowing about PRY.

 

PRY

 

PRY is an attempt to remake IRB, the interactive Ruby interpreter, in a way that makes more sense for mordern programmers. Some of the most important features of PRY are syntax highlighting, code indentation and code debugging. In other words, instead of coding inside a REPL session, you can start a REPL session inside your code execution with the help of PRY.

Installing PRY

Since PRY is a Ruby gem, installing it is straightforward. The following commands will work:

Features

PRY colorizes the syntax as it is typed into the console just like most mordern editors. In addition to this, PRY also auto-indents code thus allowing ensuring that the ‘end’ words line up with the lines that open the block.

pry(main) > class User
pry(main)*   def greet
pry(main)*     puts “Hello world”
pry(main)*   end
pry(main)* end

Another cool feature of PRY, as per my opinion, is it’s ability to show a method’s documentation …

Read More

Jenkins – Continuous Integration


Bookmark and Share

header_logo (1)

In this article am going to explain about Jenkins. So what is jenkins?

Jenkins is the leading open source continuous integration server. Built with java. Jenkin is a CI so first we need to know what is continuos integration. Nowadays developers are working from different corners of the world. When same code is modified by different users the chance for conflicts are very high, this consume large amout of time to solve the issue.To avoid this we use continuos integration. This is a practice of merging all developers working copies into a repository many times aday. There are different continuous integration tools available, some of them are Bamboo, Apache Continuum, DeployBot, Hudson, Jenkins etc

So many continuous integrations tools are available then why we choose Jenkins?

Jenkins is an extensible continuous integration engine forked from Hudson and Hudson team has moved to develop Jenkins, large number of plugins are available in Jenkins and the authers are choosen to support their plugins on Jenkins, Jenkins make incremental itrative improvement to the code,
Jenkins provide hundreds …

Read More

Setting Up RSpec in Rails Application


Bookmark and Share

This article describes the RSpec setup process in your Rails application.

Installing RSpec

When generating a new Rails project, just add the flag –skip-test-unit to supress creation of the test directory associated with the default Test::Unit framework as won’t be needing that.

In the Gemfile, add:

RSpec-Rails has a dependency to RSpec, so we don’t need to include it separately.

Yeah, we need it in development env too. Let’s see why :

  • The development mode RSpec files add RSpec-specific generators
  • Test mode includes files to run the tests

Once you have run bundle install, Run this snippet to configure Rails to use RSpec in place of Test::Unit rails generate rspec:install

This single command would generate you 4 new files :

We’ll cover more in detail regarding those later.

Updating the test database

Check for pending migrations and load the test schema rake db:test:prepare

N.B Preparing your test database

Run your test suit

rspec

Yup, Its simple as that… 🙂

Read More