Tuesday, December 15, 2009

Play Virtual Emo World

Rails Quick Start

As a friend recently I presented the possibility framework Ruby On Rails also crossed my mind to somehow prove their achievements - during the preparation of presentation tidied up a bit of knowledge.
know, I know ... There are thousands of these tutorials, but I will try to explain the process of creating a web application with particular emphasis on the testing process and use Rails built-in capabilities to automate the test process.

I also have a plan to attempt in future posts to compare Rails with Django or PHP ZendFramework . We'll see what will come out so far:

Let's get started!

Firstly, if you do not have to deal with Ruby on Rails is as the name suggests, this framework is based on Ruby. Like the PHP language is dynamic - that is, we write scripts that could be immediately launched by the interpreter. Interpreters for interpreted
Ruby is available in several versions - best-known and stable for the moment is version 1.8.6 (it will refer to throughout the specification). There are also versions 1.8.7 and 1.9.1 (which in future will eventually replace the line 1.8.6). Maybe less known, but worth mentioning feature is the ability to use JRuby . In this case, the interpreter is run by a Java environment - which is interesting JRuby can be significantly faster than implementations written in pure C. This may be due to the fact that optimizes the Java virtual machine executes code during runtime. In addition, the Sun guys have great experience in matters takich jak zarządzanie pamięcią ( garbage collector ). Siła Javy może ujawnić się szczególnie w przypadku kodu wielowątkowego - istniejące w Ruby implementacja wątków jest typu Green Thread - JRuby zastępuje ją wsparciem wątków jakie oferuje Java.
Przed wejściem w świat Ruby on Rails warto zapoznać się choćby pobieżnie ze składnią Ruby - w tym celu warto zajrzeć na stronę www.ruby-lang.org . Znajdują się tam (także po polsku) informacje na temat składni oraz wprowadzenia dla osób potrafiących już programować w innych językach. Jeśli chcemy czuć comfortable reading Ruby code, we should at least be familiar with such structures characteristic of this language as
- blocks
- dopants (mixings)

Installation Environment (Windows):

standard language interpreter can be installed in two ways - by downloading the package in an archive zip file or selecting one-click-installer version available for ruby-1.8.6. All relevant instructions are provided in the documentation available which I will not duplicate. However, for its part, I can only suggest making sure that we can run after you install the interactive interpreter Language (IRB), which means that you need to check whether the user's path has been appended to the bin folder of the folder where you installed Ruby (default is C: \\ ruby \u200b\u200b\\ bin on Windows).
In fact, after using the option one-click-installer we are ready to start playing with Rails.

Ruby libraries are distributed in the form of so-called. Games. If someone had been in contact with the type of distributions Debian / Ubuntu installer or the PEAR library for PHP - gem package manager is the equivalent of those systems.
exercising command gem install rails easily find on your disk All you need to start playing components.

After installation, we are now ready to generate the application. Installing Ruby on Rails scripts directory completed a series of commands for application management Rails. To generate the skeleton of the project, use the command:

rails crud_example

script will copy the directory of the project all the necessary files and creates a skeleton application.
If we enter into that directory: cd

crud_example

we can run the generated application (in fact the skeleton) by:

script \\ server

If we now introduce you open the browser and the address http://localhost:3000/ you should see the home page of our application.

And that's when it comes to running. Next time I will setup access to the database and will create a simple working prototype.

0 comments:

Post a Comment