Skip to content

Commit

Permalink
Convert bin/watchr to yardoc
Browse files Browse the repository at this point in the history
  • Loading branch information
mynyml committed Feb 10, 2010
1 parent 1d3f506 commit 6a86ad6
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions bin/watchr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ require 'watchr'

module Watchr
# Namespaced to avoid defining global methods
module Bin #:nodoc:
#
# @private
module Bin
extend self

DEFAULT_SCRIPT_PATH = Pathname.new('specs.watchr')
Expand All @@ -25,13 +27,13 @@ module Watchr

# Absolute path to script file
#
# The script's path is either first arg or DEFAULT_SCRIPT_PATH. If neither
# exist, the script immediatly aborts with an appropriate error message.
# Unless set manually, the script's path is either first arg or
# `DEFAULT_SCRIPT_PATH`. If neither exists, the script immediatly aborts
# with an appropriate error message.
#
# @return [Pathname]
# absolute path to script
#
# ===== Returns
# <Pathname>:: absolute path to script
#--
# raise instead?
def path!
return @path unless @path.nil?
rel = relative_path or abort( usage )
Expand All @@ -40,15 +42,14 @@ module Watchr

# Find a partial path name in load path
#
# ===== Params
# path<Pathname>:: partial pathname
# @param [Pathname] path
# partial pathname
#
# ===== Returns
# <Pathname>::
# @return [Pathname]
# absolute path of first occurence of partial path in load path, or nil if not found
#--
# Adds '.' for ruby1.9.2
#
def find_in_load_path(path)
# Adds '.' for ruby1.9.2
dir = (['.'] + $LOAD_PATH).uniq.detect {|p| Pathname(p).join(path).exist? }
dir ? path.expand_path(dir) : nil
end
Expand Down

0 comments on commit 6a86ad6

Please sign in to comment.