Skip to content

Commit

Permalink
Optionally store the absolute path to a thor file on install
Browse files Browse the repository at this point in the history
  • Loading branch information
cypher committed May 19, 2008
1 parent b92ddb8 commit aa042e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/thor/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def initialize_thorfiles(relevant_to = nil)
map "-T" => :list, "-i" => :install, "-u" => :update

desc "install NAME", "install a Thor file into your system tasks, optionally named for future updates"
method_options :as => :optional
method_options :as => :optional, :absolute => :boolean
def install(name, opts = {})
initialize_thorfiles
begin
Expand Down Expand Up @@ -60,7 +60,9 @@ def install(name, opts = {})
FileUtils.touch(yaml_file)
yaml = thor_yaml

yaml[as] = {:filename => Digest::MD5.hexdigest(name + as), :location => name, :constants => constants}
location = (opts["absolute"] && !is_uri) ? File.expand_path(name) : name

yaml[as] = {:filename => Digest::MD5.hexdigest(name + as), :location => location, :constants => constants}

save_yaml(yaml)

Expand Down

0 comments on commit aa042e1

Please sign in to comment.