model_stubbing in Rails 1.2.x

Posted by jacqui maher on April 18, 2008 at 03:58 PM

I really like technoweenie’s plugin model_stubbing. It’s a nice alternative to fixtures, and an even nicer way to create stubs in your tests and specs.

Unfortunately the StreetEasy codebase is still on Rails 1.2.x which caused compatibility problems with the plugin. Rails 2 refactored Fixtures and database statements a bit.

I had to modify the plugin to get it to work with older versions of Rails. I forked the project on github and post about it to help anyone who’d like to use the plugin but is not upgraded to Rails 2 yet.

github homepage: forked model_stubbing
public clone url: git@github.com:jacqui/model_stubbing.git

[edit] btw, simplelog was munging the href for the public clone url; it seems to like prepending http:// to links, so i just removed the anchor tags from it.

fixing a bad commit with git-svn

Posted by jacqui maher on March 25, 2008 at 05:28 PM

I do this fairly often, mostly because I haven’t migrated all of our svn pre-commit hooks to git. I really ought to do that..

$ git tag bad 012345 # or any other valid git reference
$ git checkout bad
$ # make changes here and update the index
$ git add
$ git commit –amend
$ git rebase –onto HEAD bad master # where ‘master’ is the branch in question
$ git tag -d bad

thanks to sebastian delmont for this.

Comments: 2 (view/add your own) Tags: git, svn

better git status

Posted by jacqui maher on March 07, 2008 at 05:01 PM

My typical morning usually goes like this:

- put the laptop on desk & turn it on
- get coffee :)
- open adium/textmate/firefox/terminal/etc.
- type: git status in my project’s RAILS_ROOT
- try to recall what I did in those local modifications, and then either copied and pasted (ugh I hate having to use the mouse!) the paths for each file, or tab-completed each file path, to open it in Textmate… or opened the project, cmd-T, searching for each.

The thought had occured to me several times that there must be a better way.

This is what I came up with, and so far, it works for me.

   1  tinsel:bin jm$ ./gitstatus -h
2 Usage: gitstatus [options] [paths ...]
3
4 Specific Options:
5 -d, --diff Show git diff output for each locally modified file.
6 -t, --textmate Open each locally modified file in Textmate.
7 -h, --help Show this message


Example:

   1  tinsel:workspace jm$ ~/bin/gitstatus -d
2 [MODIFIED]: app/controllers/listings_controller.rb, app/models/listing_criteria.rb, config/environment.rb, plugins/criteria/lib/criteria/criteria.rb
3 [DELETED]: spec/rcov.opts
4 [UNTRACKED]: script/import/nnj/njtransit.rb, spec/fixtures/nyc_data_pad_addresses.yml, spec/fixtures/nyc_data_pad_buildings.yml, spec/fixtures/nyc_data_street_names.yml
5
6 ************app/controllers/listings_controller.rb************
7 diff --git a/app/controllers/listings_controller.rb b/app/controllers/listings_controller.rb
8 index 74a0e6c..4d11c1e 100644
9 --- a/app/controllers/listings_controller.rb
10 +++ b/app/controllers/listings_controller.rb
11 @@ -141,10 +141,10 @@ class ListingsController < ApplicationController
12
13 def search
14 -
15 +debugger
16 - if(@criteria[:area] && @criteria[:area].index(",") == nil)
17 + if(@criteria[:area] && @criteria[:area].index(",") == nil)
18
19
20 open in textmate? [Yn] _


If you want it, go ahead and grab it: gitstatus.rb