aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorBen Alpert2009-08-31 22:34:42 -0600
committerMax Howell2009-09-01 11:15:25 +0100
commitb71b8e39727a89b825b62d0fa734d9c03020db96 (patch)
tree3faf53fc20a53240c887c52707ab63ac5575c4c8 /Library
parent8b64f33eb2b06180bb28c58bcedd3e908d64415b (diff)
downloadbrew-b71b8e39727a89b825b62d0fa734d9c03020db96.tar.bz2
Dict.org client formula
Added Formula::etc() Added Pathname::write() convenience function which can write a string out to the file it points too, raising if it would have to overwrite.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb1
-rw-r--r--Library/Homebrew/pathname+yeast.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 282876df4..0d9503599 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -80,6 +80,7 @@ class Formula
def bin; prefix+'bin' end
def sbin; prefix+'sbin' end
def doc; prefix+'share'+'doc'+name end
+ def etc; prefix+'etc' end
def lib; prefix+'lib' end
def libexec; prefix+'libexec' end
def man; prefix+'share'+'man' end
diff --git a/Library/Homebrew/pathname+yeast.rb b/Library/Homebrew/pathname+yeast.rb
index c34b6684f..a24532db1 100644
--- a/Library/Homebrew/pathname+yeast.rb
+++ b/Library/Homebrew/pathname+yeast.rb
@@ -53,6 +53,13 @@ class Pathname
return self+src
end
end
+
+ # we assume this pathname object is a file obviously
+ def write content
+ raise "Will not overwrite #{f}" if exist? and not ARGV.force?
+ dirname.mkpath
+ File.open(self, 'w') {|f| f.write content }
+ end
def cp dst
if file?