Dear Cologne Rubyists: Your user group needs you!
In November 2005 we’ve started the first Ruby usergroup in cologne. Back then we’ve been 4 people who met for beers. This was nearly exactly 6 years ago. Unfortunately the meetup has soon become inactive – actually I can not remember when that was and how it happened.
After that, I guess in 2007 the rurug.de started with greater success. It was a meetup which first took place in the rooms of the Chaos Computer Club Cologne. Sadly I haven’t participated in that meetup very activly :( *bad bumi*
Early this year the meetup then has moved to cowoco and renewed itself with about 30+ people attending. The following events had been awesome! Great talks and even better discussions. Unfortunatelly, after summer we’ve became very inactive again. Not many people participated on the mailing list and the event hasn’t taken place in the last two months.
WE NEED TO CHANGE THIS!!
And now is the time to rethink the meetup.
I know we have so many awesome ruby developers here in cologne, working on exciting projects!
We need to connect, share, teach in our local ruby community!
Let’s work together to bring back one of the best tech meetups in Cologne!
To get this started again I propose the following things:
- changing the mailing list to something that is more accessible.
This is something I’ve heard several times. The current mailinglist is kinda hard to follow and it’s hard for people to get into the conversation. -this is especially the case for new people.
I also think the mailing list has some spam issues?! - maybe using a google group for now. I do not really like google groups but it works for cologneJS.
- better organizations/archiving of the talk material like slides etc. – obviously ;)
- inviting more speakers
speakers exchange is a great. I herby invite @joshkalderimis from Amsterdam to tell us about travis-ci - meetup for some delicious Glühwein on the christmas market to discuss these things
Date: 14th Dez. 07:00pm at Heumarkt
What do you think? How do you feel about the cologne ruby meetup? Who joins me?
Cologne.rb let’s unite!
Git autocomplete in bash on a Mac
I’ve been using Linux and bash for great chunk of time for web development, and it always had great features like autocomplete, that I didn’t get by default on a Mac.
So, I’ve decided to take matters into my on hands, and leave a post for all those, who are also bugged by no git autocomplete in bash on a Mac.
Thankfully, git already has its autocomplete script, so it’s a matter of just two commands:
But I like to take it one step beyond. To save some keystrokes, I’ve added some aliases to my ~/.gitconfig:
Now I can tab on git co
No magic behind it but everytime worth to remember
Rspec Refactoring and Shared Example Groups
Today we had lightning talks about specs refactoring. Jan showed us some tricks based on his experiences from our latest open source project: railsrunners.org (Github):
Some simple spec principles
- Use clear descriptions for your specs in combination of using “describe”-, “context”-blocks
- Use contexts and descriptions properly, e.g.:
describe "#edit"; context "with valid params"; etc. - Use the –format documentation parameter to check your descriptions for specs, describes, and contexts. E.g.:
rspec spec/controllers/participants_controller_spec.rb --format documentation - Instead of manually creating associated models in your tests just to pass validations, FactoryGirl can automatically create them for you, e.g.:
- Then instead of:
- You’d simply have:
- Write one assertion per test.
- Stub requests using FakeWeb (Update: or WebMock or any other Request-Mocking-Helper), e.g.: FakeWeb.register_uri(:get, “http://static-maps-generator.appspot.com/url?msid=#{@future_run.msid}&size=950×300″, :body => response)
- Controller specs should only test the behaviour of your controller. Model specs test the behaviour of your model. Don’t mix the two! E.g.: do not test after_ or before_ save callbacks in your controller tests.
Take a look at the railsrunners Github repository: Github
Shared example groups
Sometimes you want to test the same behaviour in various specs or contexts. To keep your code DRY, you can use RSpec’s shared example groups:
If needed, you can move the shared example group to a spec helper and require that wherever you need to test for ‘successful responses’.
Further reading:
https://www.relishapp.com/rspec/rspec-core/v/2-0/docs/example-groups/shared-example-group
http://rspec.info/documentation/
http://blog.davidchelimsky.net/2010/11/07/specifying-mixins-with-shared-example-groups-in-rspec-2/
Global Day of Coderetreat Cologne / Bonn
Corey Haines is organizing a Global Day of Coderetreat for the 3rd of December. Many cities world-wide will collaborate and hold local code retreat events. Cologne, especially the Coworkingspace Gasmotorenfabrik is one of the hosts. For future details and registration check out:
Installing MacVim with Ruby support and Command T on OSX Lion
When I set up my new Macbook Air recently, I ran into some unexpected problems setting up MacVim – mostly related to Ruby versions linked against MacVim and the Command T plugin. Here are some notes that might help you.
Note
In case you wonder: MacVim uses it own separate version of vim (installed here: /Applications/MacVim.app/Contents/MacOS/Vim), which is not linked against your own /user/local/bin/vim (or wherever your vim resides), which you or your package manager installed separately. The reason I’m mentioning this is that if you lack Ruby support in MacVim, compiling vim by hand won’t help, since MacVim doesn’t use it.
Howto
- activate your favourite version of Ruby via RVM or rbenv.
in my case:
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.1]
- run (in case you haven’t already, download and install the excellent Homebrew):
$ brew install macvim
* start MacVim with
$ mvim
run :version and make sure it lists +ruby (instead of -ruby)
test Ruby support by invoking
:ruby nil[]
which should return a NoMethodError
- $ mkdir ~/.vim
- install Pathogen (better management of vim plugins, each living in its own subfolder inside ~/.vim/bundle)
- to install Command T:
$ cd ~/.vim
$ git submodule add git://git.wincent.com/command-t.git bundle/command-t
$ git submodule init
$ git clone git://git.wincent.com/command-t.git bundle/command-t
- with the same version of Ruby activated you used to install MacVim (Ruby 1.9.2p290 in my case), run:
$ cd ~/.vim/bundle/command-t
$ rake make
more details in section 4 “MANAGING USING PATHOGEN” of: https://github.com/wincent/Command-T/blob/master/doc/command-t.txt
$ ln -s /usr/local/Cellar/macvim/7.3-62/MacVim.app /Applications/MacVim.app
Troubleshooting
1) Lacking Ruby support inside MacVim
Symptom: Plugins written in Ruby, like Command T or Lusty Juggler, don’t work.
Check: $ mvim –version or :version inside of MacVim should list “-ruby”, if your version lacks Ruby support (“+ruby” if it has Ruby support built in).
Cause: This happens when your version of MacVim was compiled without the –enable-rubinterp flag. This usually happens when you install a binary off MacVim’s Google Code Project.
Remedy: Best use Homebrew to install MacVim from source. Although the Homebrew command’s output does not explicitly list the –enable-rubyinterp flag, you should be fine and :version should list +ruby.
2) Can’t compile MacVim or vim
Cause: You probably didn’t install Xcode. Unfortunately you need proprietary Cocoa headers for MacVim, which are not included in this Kenneth Reitz’ GCC OSX installer (https://github.com/kennethreitz/osx-gcc-installer; cf. related problem: https://github.com/mxcl/homebrew/issues/7576).
Remedy: Install the full Xcode package via Apple’s App Store. Make sure to check your Launchpad for download activity – it took me half an hour to figure out that the app store’s Install button was actually doing something and not broken.
3) Command T complains about lacking C extensions
Symptom: Command T doesn’t start and informs me about missing C extensions.
Remedy: run rake make inside ~/.vim/bundle/command-t
4) Command T causes SIGTERMS
Symptom: After having compiled Command T’s C extensions, as soon as you try to invoke Command T inside MacVim, it causes the program to crash with a SIGTERM exception.
Cause: Usually the reason for the SIGTERM is that your MacVim was compiled with a link to a different version of Ruby than Command T. However, I encountered the same problem when linking everything against system Ruby (1.8.7 in my case).
Remedy: Be very careful about your RVM/rbenv settings and ensure the exact same version of Ruby is active when you compile MacVim (installing via Homebrew triggers a compilation process) or Command T. My issue was resolved by using Ruby 1.9.2 instead of system Ruby.
Resources
- https://github.com/ralph/dotvim Ralph’s .vim files – certainly more well-honed and better organized than my own.
- https://github.com/paulwittmann/vimrc-osx my current .vimrc & plugins on OSX. Still lacking some features, but more cleaned up than my old one for Ubuntu.