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.
This commit is contained in:
parent
8b64f33eb2
commit
b71b8e3972
@ -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
|
||||
|
||||
@ -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?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user