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 bin; prefix+'bin' end
|
||||||
def sbin; prefix+'sbin' end
|
def sbin; prefix+'sbin' end
|
||||||
def doc; prefix+'share'+'doc'+name end
|
def doc; prefix+'share'+'doc'+name end
|
||||||
|
def etc; prefix+'etc' end
|
||||||
def lib; prefix+'lib' end
|
def lib; prefix+'lib' end
|
||||||
def libexec; prefix+'libexec' end
|
def libexec; prefix+'libexec' end
|
||||||
def man; prefix+'share'+'man' end
|
def man; prefix+'share'+'man' end
|
||||||
|
|||||||
@ -54,6 +54,13 @@ class Pathname
|
|||||||
end
|
end
|
||||||
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
|
def cp dst
|
||||||
if file?
|
if file?
|
||||||
FileUtils.cp to_s, dst
|
FileUtils.cp to_s, dst
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user