Minimize parentheses in Textmate

Posted by jamie Wed, 07 Nov 2007 21:32:15 GMT

Found a handy Textmate shell variable that can be used to remove parentheses when using snippets. I prefer this as I generally don’t use parentheses for assertions in tests and if I want them, I can add them myself.

It will for example, alter the asrt snippet from:


assert_respond_to(object, :method)

to:


assert_respond_to object, :method

Just click the ‘Advanced’ tab in preferences and then ‘Shell Variables’, add a variable named TM_MINIMIZE_PARENS with the value of ‘yes’ and you’re good to go.

Posted in ,  | Tags , , ,  | no comments

Rails: Using Autotest with UnitRecord

Posted by jamie Wed, 05 Sep 2007 20:00:06 GMT

Myself and a colleague have just managed to waste away a good couple of hours trying to figure out Autotests strange ‘style’ mechanism to add the ability to test in the way Jay Fields explains using UnitRecord.

You can grab our plugin to enable UnitRecord when using Autotest below:

http://svn.soniciq.com/public/rails/plugins/iq_autotest

By default, running autotest in the Rails directory will run the unit tests. To run the functional tests, do: AUTOTEST='functional' autotest

I hope this saves some people some time!!

Posted in ,  | Tags , , , ,  | 3 comments

SonicIQ Hiring! - UK, Ruby on Rails Developer Required

Posted by jamie Tue, 28 Aug 2007 00:01:21 GMT

We are looking for a Ruby on Rails, XHTML & CSS Developer to join our team at SonicIQ. Head over to 43folders job board to view our ad.

These are exiting times with projects like Propel’r in the pipeline, along with the ever-growing opportunities for new and interesting client projects.

If you are a highly motivated developer and can see yourself in a Ruby on Rails position in sunny (sometimes) Bournemouth, UK then apply at 43folders.

Posted in , ,  | Tags , , , ,  | no comments

Using Rcov to measure the test coverage of Rails plugins

Posted by jamie Fri, 24 Aug 2007 18:44:35 GMT

To view the coverage of your plugins using Rcov, first install the rcov gem with sudo gem install rcov, then copy and paste the following onto the end of the Rakefile inside your plugin directory:

desc 'Measures test coverage using rcov'
task :rcov do
  rm_f "coverage"
  rm_f "coverage.data"
  rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib"
  system("#{rcov} --html #{Dir.glob('test/**/*_test.rb').join(' ')}")
  system("open coverage/index.html") if PLATFORM['darwin']
end

You can now simply run rake rcov from inside your plugin directory which will generate a coverage directory with the results. Open coverage/index.html (if you are on OSX this will open automatically) in a browser to view the results.

Thanks to Mike Clark for his Rcov rake task for Rails which this task is based on.

Posted in , ,  | Tags , , , ,  | 1 comment

Typo 4.1 slow comment posting

Posted by jamie Fri, 17 Aug 2007 00:38:07 GMT

Is anyone else having problems with Typo 4.1 taking ages to process new comments. If anyone has any suggestions I would love to hear them (If you can be bothered to wait for the comment to go through!)

Posted in , ,  | Tags , ,  | no comments

Autotest Growl Fail/Pass Smilies

Posted by jamie Mon, 30 Jul 2007 14:19:37 GMT

John Nunemaker posted a handy tip on setting up autotest to work with Growl

I use this all the time now however I didn’t like the ugly smilies (call me shallow if you like). I used Wolfgang Bartelme’s Smily Devkit to make a couple of PNG’s slightly more pleasing to the eye.

Autotest Fail image Autotest Pending image Autotest Pass image

The zip file can be downloaded here: autotest_images.zip

Update 17-08-07: Added ‘pending’ image for RSpec as requested by Aslak Hellesøy

Posted in , , ,  | Tags , , , ,  | 6 comments

TheLucid Typo theme now works with version 4.1

Posted by jamie Tue, 24 Jul 2007 23:03:00 GMT

TheLucid Typo theme finally works with version 4.1 of Typo.

Please bear in mind that this is quick-fix and and there will still be a Version 2 release sometime in the near future.

The new release can be downloaded below:

lucid-typo-theme-1-1.zip

There are a couple of improvements such as cookies remembering which colour scheme and layout have been selected along with some IE fixes.

Thanks to everyone who notified me of browser issues etc. and I hope to release v2.0 as soon as possible (for both Typo and Mephisto).

Posted in , ,  | Tags , , ,  | 12 comments

Rails Edge: Getting your view extensions ready for edge

Posted by jamie Wed, 16 May 2007 13:07:43 GMT

Following my previous post, below is a modified version of John Nunemaker’s ‘Renaming RHTML to ERB to take into account the format in the extension, and handle the RJS issues I was having.

namespace 'views' do
  desc 'Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder and .haml to .html.haml'
  task 'rename' do
    Dir.glob('app/views/**/[^_]*.rhtml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`
    end

    Dir.glob('app/views/**/[^_]*.rjs').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rjs$/, '.js.rjs')}`
    end

    Dir.glob('app/views/**/[^_]*.rxml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rxml$/, '.xml.builder')}`
    end

    Dir.glob('app/views/**/[^_]*.haml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.haml$/, '.html.haml')}`
    end
  end
end

Update

Added haml conversion.

Posted in , , ,  | Tags , , , ,  | 8 comments

Rails Edge: View file extention functionality has changed

Posted by jamie Wed, 16 May 2007 12:19:43 GMT

It seems that on edge revision 6502 and later, the way that view file extensions has changed considerably.

I couldn’t work out why my tests were breaking when doing an xhr request to a new action which had a respond_to block setup for both html and js. It was returning the html instead of the rjs??

It turns out (after tearing my hair out for over three hours) that Changeset 6499 changes things in such a way that the normal new.rjs naming will not get picked up on an xhr request, you now need to add the request format to the extension before the template type i.e. new.js.rjs

This seemed a little odd at first but I am guessing it means you could have a new.js.erb file which is pretty cool as you could achieve the same as Dan Webb’s MinusR plugin.

What does seem a little odd is that a new.rjs will get picked up if you don’t give a respond_to at-all (I don’t know if this is a “feature” or a bug).

I’m am hoping that this may save someone some time.

Posted in , ,  | Tags , , ,  | no comments

SonicIQ are hiring - Junior Rails Developer Wanted in UK

Posted by jamie Thu, 08 Mar 2007 12:20:14 GMT

SonicIQ are looking for a Junior Ruby on Rails Developer.

We are based in Bournemouth, Dorset, UK. Anyone interested in working professionally with Rails on some exciting projects please drop us your CV.

Posted in , , , ,  | 1 comment

Older posts: 1 2 3