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 and source code …

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 of plugins to …

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
React Example Application

React Example Application


Bookmark and Share

This article is continuation of my React series, On the first article we went through react basics and some react syntax, now i want to demonstrate a sample application with es6 syntax. ES6 is the future of javascript, so we use ES6 in our projects. Complete code is available on github, you can use below links.

Example Application

React – Rails Store Example Application

 

React Rails Tutorial

React Rails Store Application

Before we start, we must familiarize with gulp and some gulp tasks. Gulp is a frontend tool to automate our tasks like sass/scss to css, coffeescript to javascript, minimization etc.. In this project we use babelify, it help us to write code in ES6, In ES6 mode, we can use import statement, classes in javascript, and double arrow functions.

We use ES6, so we can use class, import and =>

Now we can start our code, It is actually a ruby on rails project. Our files are inside javascript/react folder, we use main.js file where we import all other javascript modules, which again convert …

Read More
Vim tutorial for beginners

Vim tutorial for beginners


Bookmark and Share

Vim stands for Vi Improved which is a clone of Bill Joy’s vi editor for Linux. It is designed for use both from a command line interface and as a standalone application in a graphical user interface. Vim is basically a open source application that is released under a license which includes some charityware clauses.Even though vim is available both in command line as well as an application with GUI, vim is widely used in command line and the full functionality is expressed through its command line mode.

Without further ado lets get started..There are 2 modes in vim say INSERT mode and NORMAL mode.Mode in which you are currently in is displayed in editor.Pressing i will take you to insert mode and press escape key to return to normal mode. As the names suggest, all commands are typed in COMMAND mode, and text is inserted in INSERT mode

Navigating through the text file.

 In contrast to the normal text editors, it uses keys h,j,k,l to move the cursor. To navigate the text in terms of words, keys w,b and e are used.B moves cursor to the beginning  of the word,E to the end and …

Read More