I'm new to Ruby on Rails. Here’s what I’ve done so far:
I’ve installed XCode, Homebrew, RVM, Ruby and Rails.
Now how do I get Sublime Text 2 to work with Ruby on Rails?
First thing you should do is install Package Control if you haven't already. This will make downloading packages and plugins way easier. Then you can look at some of the Rails specific packages to make your life easier when coding with Sublime Text.
Sublime Text has native support for syntax coloring in .rb files, so you don't have to install anything for that. Dragging your project folder and dropping it on Sublime Text will open it.
Keep in mind, though, that Sublime Text is simply a text-editor - not an IDE. You won't get a lot of help like code completion (although there are plugins that can help a bit) or complaining when your syntax is wrong (again, there might be a plugin for this). For that, look at something like Netbeans or IntelliJ IDEA.
You can download and install Sublime Text if you haven't done yet from sublimetext.com.
Here is an installation guide for OS X Terminal that I found cool.
You should install Package Control for Sublime Text.
Then I suggest you check out these videos:
Sublime Text 2 Tutorials #1 - Installing & Overview
Perfect Workflow in Sublime Text 2
It's worth spending time with it once, and it will save a lot of time in the future.
I am used to using an IDE like Eclipse or Netbeans when coding in Java and having a small code assist appear to give me a small description on each of the methods available. Now code assist does work in Aptana Studio 3 for Ruby on rails, but it does not give you a small description of what the methods do, they just give you a list of the methods only. Is there any IDE or Text based editor that can give me code definition while coding or is there a way to configure Aptana Studio to do so?
As I am new to ruby, I do not want to invest and buy an IDE or Text Based Editor as of yet (though feel free to tell me if the payed ones are the ONLY ones to do what I am asking). I am running Windows 7. But if my only option is to run a VM with Linux so as to get what I am asking than please suggest the name of the IDE or Text-based editor.
Thank you.
RadRails must have a code definition according to it's description but i personally prefer not expensive most featured RubyMine
it uses RDoc so you have to be sure you have generated help during gems installation (see docs)...
(another way to browse local gem's docs is RubyGems Documentation - just run $ gem server from console but this is out of the answer to your question)
I have created my application under package music. Now I want to change my package to com.mp3.songs.music.
One way is I can manually create the package for grails-app. Is there anything else that I need to take care while changing the package name.
Alternatively, is there a command in grails which can be used to change the package.
I found a way out in the below link. But this works only when you create new files. What if you want to change the package of the older files.
http://www.goto20.nl/tech/groovy/configuring-the-default-package-name-for-a-grails-project/
Thanks!
IntelliJ IDEA has very good support for rename refactoring. I believe it is currently the best (9.0.3 stable) chance you'll have of any major refactoring jobs in Grails. They have a 30 day trial, so it is worth a try.
Why not use Spring Source Tool Suite. Its a great IDE with solid support for Groovy n Grails.
I do Ruby on Rails development pretty much exclusively. I currently develop in OS X using TextMate. I have a virtual machine running to emulate as closely as possible the environment my app will be deployed into, and I mount the code on a Samba share into OS X from the VM guest. From there I open with TextMate and code away.
I'm beginning to think that with the proper plugins and time spent learning, I could be much more productive in vim directly on the VM. Right now my TextMate is basically stock, though I do find the ProjectPlus plugin indispensable. What I'm looking for are some suggestions of vim resources and plugins (if that's the right terminology) to closely emulate the features I am unwilling to give up in TextMate. Or at least, compelling reasons why I should be willing to give them up. Here's a short list:
Ability to have a (preferably) collapsible project tree visible either at all times or easily toggle-able.
Ability to see SCM status at a glance, either within this project tree (preferable) or otherwise. (I use git almost exclusively if this makes any difference.)
Being able to view a side-by-side diff from within vim would be great too
Ability to search through the entire project at will (I suppose :stop; grep -nr; fg; would accomplish this, unless there's a better way to do it.)
Code completion, if possible
The NERD Tree plugin gives you a collapsible project tree. Personally, I find that the netrw plugin is more than sufficient, and this usually comes installed with Vim. Whereas the NERD tree feels as though it tries to emulate the behaviour of other IDEs (and TextMate's project drawer), I feel that the netrw plugin does things the Vim way. I suggest you try both out, and see which one you prefer.
The fugitive plugin provides a git interface to Vim (See Vimcasts: parts 1, 2, 3, 4 and 5).
The ack plugin is great for searching an entire project. You'll want to read up on Vim's quickfix list to get the most out of this.
TextMate's word completion is triggered with esc, and shift-esc. In Vim, you get similar autocomplete functionality using ctrl-n and ctrl-p in insert mode. Check :help ins-completion for (much!) more info.
I am running a series of screencasts about learning Vim over at vimcasts.org. My background is with TextMate, but I've been using Vim fulltime for a while now. As I write this, I'm only 6 episodes in, but I do plan on covering each of the points you've raised in future episodes. I'll try and come back to edit this answer with links to the screencasts as they become available.
And snipMate : TextMate-style snippets for Vim
I'm currently in a similar position to you (moving from TextMate to Vim)
One really good resource is this:
http://robots.thoughtbot.com/post/166073596/intro-rails-vim
Good luck with it!
For file navigation is simply love CommandT
This functions very much the same as the beloved commandT function in textmate.
You might want to start with my Ruby/Rails related vimfiles which includes support for rvm and git.
This screencast is great as well http://blip.tv/file/1372096
I do use VIM and i specially like how to rotate from model/view and controller related..
Check out the blog post: From Textmate to VIM for Rails coders.
The comments there may also valuable for you.
All of the other answers plus:
Ability to have a (preferably) collapsible project tree visible either at all times or easily toggle-able.
The project.vim plugin doesn't really work like TextMate's Project drawer but it's close.
With NERDTree, you can setup bookmarks and make it work a little like a project drawer.
:help mkview and :help mksession can help, too.
Ability to see SCM status at a glance, either within this project tree (preferable) or otherwise. (I use git almost exclusively if this makes any difference.)
vcscommand.vim provides the same set of commands for multiple SCMs, it works with Git, SVN, Mercurial…
You can use the aforementioned fugitive plugin to display the Git status in the status line, :help fugitive-statusline.
Being able to view a side-by-side diff from within vim would be great too
fugitive provides the :Gdiff command that does just that.
A recently released plugin called Gitv tries to emulate GitK in Vim. I like it a lot and the author is very responsive. In the tree view, hit <CR> to open a previous commit in another window and D to see a double diff.
Code completion, if possible
There are a few solutions, if you don't need it to be automatic <C-x><C-o>, <C-n> and <C-p> will be more than enough, if you want "autocompletion" you may try these few plugins. My favorite is autocomplpop.
Search an entire project here.
Code completion: Normally done with ctrl-X then ctrl-O while in insert mode.
Git Integration: git.vim
Project Tree: Nerdtree.vim
Good luck
I published an extended post on this topic today, in which I explain how to replicate 100 features from Textmate within VIM. It's the product of a great deal of hours research.
For example I explain:
How to replicate a Project Drawer
How to manage tabs
How to do Rails specific commands (Lets face it: A lot of Textmate users are Rails programmers)
How to do find and replaces
How to do project wide searches
Read Original Article: Textmate To VIM
I've been using vi/vim since '97 for various quick edits and
administration tasks, but have only recently considered using it to
replace Netbeans as my ruby editor of choice. One thing I find
extremely useful in both Netbeans and Eclipse is the Ctrl+Click "Go to
definition" feature, where you can ctrl+click on a class or method and
it will take you to the definition.
Now, I've played with exuberant ctags and rails.vim, and it's close,
but no cigar. Here's what I want: by default in Netbeans and Eclipse,
you can ctrl+click a local method or class in your local rails
project, but you can also ctrl+click on things defined in gems or in
the system libraries that are coded in Ruby. Netbeans for example
parses all ruby files in the default system paths and makes them
navigable for you. If there are multiple files that define a method,
it will present you with a list and allow you to choose between them.
How can one accomplish this within vim? If it can be done, I may be
able to make the jump full time.
You can use multiple tag files in Vim as follows:
:set tags=./tags,c:/ruby/lib/tags
Using g] will give you options for multiple entries found.