CSC/ECE 517 Fall 2014/ch1a 26 gn: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Debugging with Rails using Pry==
== Debugging in Rails using Pry==


Pry in literal sense means one who enquirers too closely about others. Pry is a powerful alternative to the standard IRB shell for Ruby. It features syntax highlighting, a flexible plugin architecture, runtime invocation and source and documentation browsing. <i> as quoted by [http://pryrepl.org/ PRY Website].</i>
[[File: Pry_logo.png‎|thumb|alt=A cartoon centipede reads books and types on a laptop.|''[[Pry]]'' an IRB alternative and runtime developer console.]]
Ruby on Rails is a Web application framework for Ruby. It was first released to the public in July 2004. Within months, it was a widely used development environment. Many multinational corporations are using it to create Web applications. It is the standard Web-development framework for Ruby. Models are objects that represent the components of an application that perform information processing in the problem domain. Views are objects that display some aspect of the model. They are the output mechanism for the models. Controllers are objects that control how user actions are interpreted. They are the input mechanism for the views and models.


Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
Since a Rails application goes beyond the model view controller, like Mailers, Routes (REST, HTTP-Verbs, Constraints), Environments and Initializers, Caching (Redis, Memcached), Assets (CSS, SASS,, JavaScript, CoffeeScript, Pipelining), Bundler and dependency management, Tests (RSpec, Capybara), gems, plugins and engines used in the application, one needs to know a lot of stuff to master debugging their own application. Debugging is one of the things a developer has to do most and there exists debuggers for Rails that are suitable for browsers and lack the ability to allow moving around in the call-stack and inspecting objects at runtime.  


Pry in literal sense means to look or inquire closely, curiously, or impertinently. Pry is a powerful alternative to the standard IRB shell for Ruby. It not only for debugging but also (and mainly) for inspecting objects. It features syntax highlighting, a flexible plugin architecture, runtime invocation and source and documentation browsing. It enables the user to browse source code, inspect objects, eliminates all the iteration- and startup time when running red/green cycles and is especially useful when you don’t know exactly how something should function in the first place.


__TOC__
__TOC__


=== Subsection 3===
=== Introduction and Installation for Pry===
This has some code


==== Pry: super-fast, painless, debugging for the (ruby) masses. ====
Pry aims to be more than an IRB replacement; it is an attempt to bring REPL driven programming to the Ruby language. Pry is also fairly flexible and allows significant user customization making it a good choice for implementing custom shells. The pry console gives you access to the method that raised the exception, you can use it to inspect the values of variables (no more print statements!), the source code of methods (no more flapping around with a text editor!), and even move up and down the call stack (like a real debugger!).
Because the shell opens as though the exception were just about to be raised, you don't even need to re-run your program from the beginning in order to start debugging. It's optimized for the "exceptions-happen" workflow that you need when developing code.
<code>
<code>


Line 17: Line 22:
</code>
</code>


==== Sub-subsection 1====
==== Installation====


We can put anything we want in here
We can put anything we want in here
Line 41: Line 46:
=References=
=References=
: [http://en.wikipedia.org/wiki/Help:Wiki_markup#Links_and_URLs Wiki Manual]
: [http://en.wikipedia.org/wiki/Help:Wiki_markup#Links_and_URLs Wiki Manual]
:http://pryrepl.org
:http://nofail.de/2013/10/debugging-rails-applications-in-development/
:http://www.jackkinsella.ie/2014/06/06/debugging-rails-with-pry-debugger.html

Revision as of 21:36, 19 September 2014

Debugging in Rails using Pry

A cartoon centipede reads books and types on a laptop.
Pry an IRB alternative and runtime developer console.

Ruby on Rails is a Web application framework for Ruby. It was first released to the public in July 2004. Within months, it was a widely used development environment. Many multinational corporations are using it to create Web applications. It is the standard Web-development framework for Ruby. Models are objects that represent the components of an application that perform information processing in the problem domain. Views are objects that display some aspect of the model. They are the output mechanism for the models. Controllers are objects that control how user actions are interpreted. They are the input mechanism for the views and models.

Since a Rails application goes beyond the model view controller, like Mailers, Routes (REST, HTTP-Verbs, Constraints), Environments and Initializers, Caching (Redis, Memcached), Assets (CSS, SASS,, JavaScript, CoffeeScript, Pipelining), Bundler and dependency management, Tests (RSpec, Capybara), gems, plugins and engines used in the application, one needs to know a lot of stuff to master debugging their own application. Debugging is one of the things a developer has to do most and there exists debuggers for Rails that are suitable for browsers and lack the ability to allow moving around in the call-stack and inspecting objects at runtime.

Pry in literal sense means to look or inquire closely, curiously, or impertinently. Pry is a powerful alternative to the standard IRB shell for Ruby. It not only for debugging but also (and mainly) for inspecting objects. It features syntax highlighting, a flexible plugin architecture, runtime invocation and source and documentation browsing. It enables the user to browse source code, inspect objects, eliminates all the iteration- and startup time when running red/green cycles and is especially useful when you don’t know exactly how something should function in the first place.

Introduction and Installation for Pry

Pry: super-fast, painless, debugging for the (ruby) masses.

Pry aims to be more than an IRB replacement; it is an attempt to bring REPL driven programming to the Ruby language. Pry is also fairly flexible and allows significant user customization making it a good choice for implementing custom shells. The pry console gives you access to the method that raised the exception, you can use it to inspect the values of variables (no more print statements!), the source code of methods (no more flapping around with a text editor!), and even move up and down the call stack (like a real debugger!).

Because the shell opens as though the exception were just about to be raised, you don't even need to re-run your program from the beginning in order to start debugging. It's optimized for the "exceptions-happen" workflow that you need when developing code.

printf("Hello--How are you");

Installation

We can put anything we want in here

Installing Ruby:

We can also put some

This is how to part of a sentence.

You van learn more about installing and working with ruby.

section 1

/*Fill the text here*/

Subsection 2

/*Fill the text here*/


References

Wiki Manual
http://pryrepl.org
http://nofail.de/2013/10/debugging-rails-applications-in-development/
http://www.jackkinsella.ie/2014/06/06/debugging-rails-with-pry-debugger.html