Archive

Posts Tagged ‘netbeans’

Ruby on Rails application in 10 minutes is a myth

April 2nd, 2009 5 comments

Lately netbeans remainded me about something that makes great marketing for Ruby on Rails – ability to create application in 10 minutes.

By example you can have a look on the netbeans tutorial. Everything looks great, sometimes You can even create the application in 10 minutes …

Lets think what You will get in this 10 minutes:

  • Scaffold of application … without head or legs

Thats all, the application generated in 10 minutes does not have authentication, it does not have administrative part. Of course there is a lot of plugins, that helps to add functionality to Yours application. But wait a minute, authors of this plugins cant catch up stable rails.

Each few months we have new rails version, and each version is requiring application changes, this is endless. After You finish migration to newest rails, after You find new plugins there is new rails version – and the  wheel spins again.

Comparing to other applications rails is getting new releases at least twice offten, that would be good if it would have one stable base, but not, the base is changing each few months.

And what is the plan, four months after rails 2.3 we will have rails 3.0, it will be more like rails or maybe more like merb? Hopefully it will start slowing down a bit, as it requires now very big efforts to maintain application and keep it up todate.

Somebody would say “You can freeze rails, gems and plugins” – yes I can, but I can not freeze my developers, they will learn new rails version, and after one year I will have a team of experienced developers in rails 4.0 or even rails 5.0 and application with frozen reail 2.3 … and try to migrate when the core was rewritten three times during last year.

Assuming having steady framewoirk with “broken tables” like Java or less broken DJango makes a lot more work on begining, but development stacks are available, the documentation is more complete, and the major version changes once for few years, this allows developer to understand and modify application code even after ten years.

Did You liked this post or maybe not, vote on it at dzone.

Categories: Development Tags: , ,

Missing netbeans passenger support – patch integrated to trunk

March 10th, 2009 Comments off

In one of previous posts (Missing netbeans passenger support – patch ready) I have informed that the patch is ready.

I just got information that the patch was integrated to the netbeans trunk, currently there is no nightly build available but I will post a message when this is ready.

Hope that we can play with passenger in Netbeans shortly.

Categories: Development Tags: , , ,

Missing netbeans passenger support – patch ready

February 11th, 2009 Comments off

I have just posted a patch that should enable  passanger support in netbeans, details can be viewed at netbeans issues.

Hope that will be shortly merged and everybody can use it.

I do not even know if this is fully functional, I got cold and had few other tasks on head, but this should be good start point.

Most of the logick required to get it running is already writen, so should be enough.

Categories: Development, Linux Tags: , ,

Missing netbeans passenger support

February 8th, 2009 3 comments

Netbeans is missing very important (for me) functionality – support for setting passenger as server. This is even described at netbeans issues: http://www.netbeans.org/issues/show_bug.cgi?id=135447

As I could not find any project that does this job I have already started codding, currently it’s only few lines, but I should get “something” shortly, please let me know if anyone is interested in testing or supporting me in anyway.

Categories: Development Tags: , ,

Preparing Ruby on Rails environment – firstapp

February 1st, 2009 2 comments

Now as we have all the environment prepared we can start with example application to check if everything is working.

For Begining we can check if postgres is working:

/etc/init.d/postgresql-8.3 status

If You did not added it to autostart it’s probably stopped, so You can start it with:

/etc/init.d/postgresql-8.3 start

And if it is not a big problem to have it running all the time add it to autostart:

rc-update add postgresql-8.3 default

Additional is needed as my previous instructions require additional step – adding postgresql support in ruby:

gem install postgres

Referring to my friend Andrzej instructions it should be ruby-pg, I’m not sure which one is better.

Following steps are very similar to instructions at netbeans docs so You can open it in separate window to have an overview of the GUI side.

Open netbeans from the console (in most distros netbeans will be in Yours applications menu and may be available on desktop):

/path_to_netbeans-6.5/bin/netbeans

Right click the empty area within Projects tab and choose “New Project”, there choose “Ruby” -> “Ruby on Rails Application” and click “Next >”. On the next screen You cna change nam of the application, You do not have to change all the params there, just click “Next >”. Following screen is “Database Configuration”, here You have to change the “Database Adapter” to “postgresql” enter Yours user name in the field “User Name” and press “Finish”.

That is Yours first application, now we will use famous functionality of rails – scaffold, right click the new project and select “Generate…”. From the “Generator:” list select scaffold, enter “Person” in “Model Name:”, enter “name:string” in “Attribute Pairs (field:type):” and press “OK”.

Worth explanation is feature of rails called pluralization, You can see in Models, that there is person.rb model, but in Controllers You have people_controller.rb controller, this is because rails calls “person”.pluralize before applying the name for controller or view. You can check this by navigating to the project “cd ~/NetBeansProjects/RailsApplication1” and entering “script/console”, here You can play with rails and Yours application.

Now after we have automaticly generated code of application we can continue with creating database for the application. Right click Your application, choose “Run/Debug Rake Task”, now choose “db:create” from the list and click the “Run” button. Ther will be no preaty message “Database created successfully”, but if You did not got any error message in few seconds it means everything went fine. Next step is to migrate database to current state – right click project, select “Migrate Database” -> “To Current Version”. In the output You should find somthing like this:

(in /home/mpapis/NetBeansProjects/RailsApplication1)
NOTICE:  CREATE TABLE will create implicit sequence “people_id_seq” for serial column “people.id”
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index “people_pkey” for table “people”
==  CreatePeople: migrating ===================================================
— create_table(:people)
-> 0.0209s
==  CreatePeople: migrated (0.0210s) ==========================================

The database is prepared for our application, now we have to change few default settings to make person the most important in our application. Please open Configuration / routes.rb file by double clicking it. Start search by CTRL+F in the Find box enter “map.root”, uncomment the found line and change “welcome” to “people”. Last step is to rename the auto generated index.html file in the public folder, right click the file, chose rename and add suffix “_old” to the displayed index in the edit box.

Thats all, click the green triangle in the toolbox on the top of netbeans. This should open Your browser with the new app, You can check it by navigating through it.

Small hint for Firefox users, there might be needed change in netbeans to open correctly – please anvigate to Menu “Tools” -> “Options” choose “Firefox” in the “Web Browser” list and click “Edit” button. Here replace “Arguments” edit box content with:

“{URL}”

In the next article we will start our application through apache passanger instead of using rails built in WEBrick.

Categories: Development, Linux Tags: , , ,