Skip to content

Instantly share code, notes, and snippets.

@henrik
Created April 8, 2010 12:23

Revisions

  1. henrik revised this gist Apr 8, 2010. 1 changed file with 1 addition and 9 deletions.
    10 changes: 1 addition & 9 deletions find_closest_spec_helper.rb
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,2 @@
    root = '/Users/henrik/Sites/auktion/spec/models/auction'

    max = root.scan('/').length + 1
    x = max.times { |i|
    path = "#{root}/#{'../'*i}spec_helper.rb"
    unless (found = Dir[path]).empty?
    break(File.expand_path(found.first))
    end
    }
    p x
    p (root.scan('/').length+1).times { |i| unless (r = Dir["#{root}/#{'../'*i}spec_helper.rb"]).empty?; break(File.expand_path(r.first)); end }
  2. henrik renamed this gist Apr 8, 2010. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. henrik created this gist Apr 8, 2010.
    10 changes: 10 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    root = '/Users/henrik/Sites/auktion/spec/models/auction'

    max = root.scan('/').length + 1
    x = max.times { |i|
    path = "#{root}/#{'../'*i}spec_helper.rb"
    unless (found = Dir[path]).empty?
    break(File.expand_path(found.first))
    end
    }
    p x