RoR development-environment setup - ruby-on-rails

I'm interested to play around with RoR a bit. Apart from literature i should read, i'm particularly interested about how to setup development environment.
Here's a good example how to setup environment for Java from Noda Time project wiki pages.
I want something similar but for RoR.
As far as i know - unix operation systems fits way much better (have toyed on windows 1 1/2 year ago - pure nightmare). So it would be nice to get some recommendations about linux distros and how to make it run next to win7/xp.
Basically - i want to shorten endless searching and improvisation until i can play with some code.
P.s. bonus for simple sample project. :)

The single quickest way to get up and running might be to simply grab Netbeans and develop against its built-in JRuby instance. It will walk you through setting up a Rails project and even give you some nice-to-haves like autocompletion.
Baring that, the easiest method is likely to download a Linux VM Appliance pre-Customized for Rails Development and a copy of VMWare Player.

The best 2 ways to go are OS X and Linux, I use Ubuntu just because it's the nicest package that I've found (there will no doubt be a variety of opinons on this.)
For Rails, I like to not use the packages or pre-installed versions, and instead build my own so I can test against various versions of ruby if need be. Hivelogic has a nice post about how to do it for OS X 10.6.
From there, you can just run:
rails myproject
cd myproject
./script/generate scaffold post title:string body:text
rake db:migrate
rm public/index.html
./script/server --debugging
And then connect to http://localhost:3000/posts to get to your application.
Once you get more comfortable, check out running Passenger instead, so you can have multiple applications running at the same time. On OSX there's even a nice Prefpane to easily set up new sites. This also ins't too hard in Ubuntu with the examples provided in the passenger docs.
For editing the application I think the IDEs (Aptana, Netbeans, etc.) are still too heavyweight, especially for small starter projects. I like Textmate (like everyone else) for OSX and gedit with gedit-mate.
Once you're writing applications, you'll find that railsapi has the best interface for browsing all of the various methods not only in Rails, but ruby, authlogic, and a bunch of other common gems.
Lastly, you'll want to look into source control, with git being preferred in the Rails community at the moment.
Good luck!

Get VMWare player
Get ubuntu vm
If it's server version - install desktop x or whatever it's called
Mess around with sudos, visudos
Mess around with vi editor to save newly created account to sudoers list
Mess around with vertical mouse scrolling which apparently does not
work on vmware+ubuntu
Finally install netbeans
Through plugins, install ruby on rails
Some global updating
Enjoy toying
tadaaaa...
Something like that i wanted - with each point explained a bit (no doubt that my steps aren't best ones and sounds funny for those who knows).
I guess that i forgot to mention that i lack knowledge of unix systems in general too.
Anyway - got what i was looking for. :)

Related

Ruby on Rails RubyMine setup for win 7

I am trying to find a tutorial or a document or what ever which will show all the real steps with details how to setup my win 7 pc in order to debug - deploy a rails app through rubymine. I have found only spare pieces of the puzzle which i don't know how to connect.
I am newbie to ruby stuff, that's why i need details steps.
I will appreciate any help.
Download the rails installer.
http://railsinstaller.org
And then rubymine, and you should be good to.
That said, windows is less than ideal to do ruby develoment on. I did it for a while, and I spent to much time fighting the fact that ruby is best on a Unix based system. You can install ubuntu on a virtual machine and used than for your rails needs.
I think the best day to do this is to use vagrant. Check this http://www.confreaks.com/videos/2368-rmw2013-ready-to-code-automate-your-development-environment

VM image with ready-to-use Rails development environment?

So... I've been trying to start developing Rails, and I'm having a horrible time setting up my environment.
Installed Ubuntu 12.10 in a VM. Installed RVM. Installed Ruby 1.9.3. Installed Rails. Then Rails console didn't work because I didn't have readline, and I had to start futzing with rvm commands from here and from a Stack Overflow thread, only to get numerous incomprehensible errors.
And that's just me trying to get off the ground and start running. Please oh please, isn't there a ready VirtualBox VM file with a machine preconfigured for development work?
If you would just like one built for you go to: https://railsbox.io
Tutorial will set you you with vagrant/rails much like the other answers are talking about. I haven't used it but it looks solid:
https://gorails.com/guides/using-vagrant-for-rails-development
You could also simply use a remote vm that is setup and available anywhere:
https://c9.io/
There are other similar options out there.
I have used both of them and they function excellently for this purpose, they also troubleshoot well on google because you have multiple people using the same environment. If you are new to Rails/Ruby and are unfamiliar with using a nix environment I highly suggest this route. You will also be able to access them more or less anywhere through a browser.
I know it is rather an old thread but since it came up so easily in a search and the answer wasn't entirely satisfactory when I had found it previously I thought I would broaden the list of options.
Found this: https://github.com/rails/rails-dev-box
Hoping it's going to help; consistent with Branden's comment above.

Where is best place to post a Ruby on Rails Installer?

I've figured out a really simple way to install Ruby on Rails with all the latest modules on Windows & created two installers for it. One with WAMP and one without that.
With that it takes only about 5 minutes to install Ruby and Rails + WAMP. As opposed to the hours that it might take to load and compile all the modules.
I'd like to share this with as many people as possible because I think more people could learn this great language and framework, if the installation of it wasn't such a hassle!
What would be the best place where I could upload these installers and where people who look for such thing would find it?
Host your project on github, and update/inform the ROR wiki about it, which would help others know about your installations and use them

What components make VIM a good (great) ruby editor?

I'm learning ruby on rails on a linux box and dusting off my VIM skills (skillz?).
When I got started on VIM way back in my c++ days, I had a friend with a great vimfiles folder that had tons of stuff to get started. Starting from scratch, vim is great, but it feels like it could be a lot better.
I currently have:
vim-ruby
buffer explorer
xml-edit (though I don't have it currently working with erb files)
I know that barely scratches the surface of what some more experienced vim/ruby devs have (including the one offs in the vim.rc file).
Is there a list somewhere (or could we create one) of a bunch of the standard vim configurations needed to make programming ruby (and rails) more fun? Is there a zip/tarball somewhere with a good base setup?
take a look at tim pope's repos on git hub. Many, many awesome vim plugins and extensions for working with ruby and rails
http://github.com/tpope
snipMate (GitHub repo) is highly recommended. It enables you to use TextMate-style snippets in Vim.
snipMate is not Ruby-specific: by default, it comes with one file containing Ruby-specific snippets. If you are going to work a lot on Ruby-based code (Rails, RSpec, Shoulda, and the like), it's probably better to use one of the available snippets' collections and customize it as you see fit rather than writing your own snippets from scratch.
There is a pretty nice setup for your VIM environment.
http://github.com/akitaonrails/vimfiles
Just follow the instructions and in a minute or two you will have everything ready for Ruby(on Rails) development.
As Jed has mentioned above - tpope plugin is a "must have" and it is part of the akita vimfiles.
I have this in my ~/.vimrc to quickly see the output of a file I'm working on:
map <Leader>r :w! <bar> !ruby %<CR>
For rails, two essential plugins are rails.vim and the NERD tree, for navigating the directory of the rails project you're working on.

tips and tricks for using vim with ruby/ruby on rails

I'm one of those developers who isn't using TextMate with any of his Ruby/Ruby on Rails work. My particular loyalty in this arena lies with vim. What are your favorite tips/tricks for using vim with Ruby and/or Ruby on Rails to make you as efficient as possible when working?
Most important
Get a copy of rails.vim it is awesome on millions of levels. Read the doc. There are way too many tips, :Rview customer, :RSmodel foo, :Rinvert, gf, :Rextract, :Rake and the list goes on and on. You will probably want NERDTree as well for easy navigation (which you can access using :Rtree)
Second most important
Follow tpope on twitter (the author of fugative, rails.vim, haml.vim, vividchalk theme, cucumber.vim and so on), he seems to be posting new related to Rails vim plugins quite regularly (be it syntax highlighting or git integration).
You might want to checkout my ruby/rails specific vimfiles.
Its a useful starting point and has many useful Ruby/Rails plugins bundled and configured.
The one thing that really sucks about Textmate is that it doesn't run on Linux. My vim/gvim config is the same on Mac, Windows and Linux. Same fonts, same themes, same plugins and same customizations.
I mostly use Textmate for snippets and quick evaluations for posting here.
I wrote an in depth guide on using Textmate features (especially Rails related features) in VIM. It's very relevant to this question.
http://www.jackkinsella.ie/2011/09/05/textmate-to-vim.html
I don't use vim, instead, I'm like those millions of developers using Textmate. Nevertheless, a colleague does use vim/gvim.
By looking at him work, one of the things I wish I could do in Textmate is the ease of working on multiple files at the same time. Basically, you can easily manipulate multiple windows, which is quite handy.

Resources