28 March 2008

DRY

At last, my first Rails plugin!

  • generates a report of duplicate lines in your code to help you to follow the DRY principle


  • integrates nicely withand


  • integrates with :

# With RSpec
it { rails_application.
with_threshold_of_duplicate_lines(4).
should be_DRY }

# With Test::Unit
assert_DRY(ruby_code_in_rails_plugin("dont_repeat_yourself"))

To start playing:

ruby script/plugin install http://dryplugin.rubyforge.org/svn/vendor/plugins/dont_repeat_yourself/
rake dry:report:html
or rake dry:report:textmate if you're an happy mac user

If you want to contribute, please use the git repository:
http://github.com/garnierjm/dry-report/tree/master/rails_plugin/vendor/plugins/dont_repeat_yourself/

The doc:

Your FeedBACK is more than welcome! Post a comment in this blog or contact me

Cool DRY logo by CodeSmack (Please send me the t-shirt guys!)


Based on Simian (Similarity Analyser) by Simon Harris from RedHill Consulting, see http://www.redhillconsulting.com.au/products/simian/
Copyright (c) 2003-08 RedHill Consulting Pty. Ltd. All rights reserved.

27 March 2008

Marco is my svn master

I am using netbeans as an IDE for my work. This is a great IDE but sometimes a bit limited when dealing with subversion commands. I always ask a colleague of mine, Marco , who types faster than his shadow and knows everything about command lines some help about svn. In this post, I will compile what I have learned.

How to remove all svn properties from a folder


svn propdel svn:ignore tasks/
property 'svn:ignore' deleted from 'tasks'.
jeanmichel@21x100:~/ruby/projects/linqia/linqia_portal/lib$ svn status
M .
M tasks
? solr_reindexing/rspec_bcn_on_rails.rb
jeanmichel@21x100:~/ruby/projects/myproject/lib$ svn commit tasks -m "Should remove the weird properties on tasks folder"
Sending tasks
Committed revision 2208.

How to generate a diff between 2 versions

go to the folder where trunk / branch / tag is

svn diff -r 2114:2167 > text_file.diff


Merging



svn merge --dry-run svn://svn.linqia.com/lalala/production@2354 svn://svn.linqia.com/klikee-website/lalala/production@2355
Skipped missing target: 'script/sql/import/update_user_languages.sql'
U lib/tasks/import_communities.rake
jeanmichel@21x100:~/ruby/projects/linqia/linqia_portal$ svn merge svn://svn.linqia.com/klikee-website/klikee/branches/production-v-1.1-08-04-2008@2354 svn://svn.linqia.com/klikee-website/klikee/branches/production-v-1.1-08-04-2008@2355
Skipped missing target: 'script/sql/import/update_user_languages.sql'
U lib/tasks/import_communities.rake