1 autoload :Pathname, 'pathname'
6 syms.flatten.each do |sym|
7 class_eval "def #{sym}(&block);block.call(@#{sym}) if block_given?;@#{sym};end"
14 def relative_path_from(dir)
15 Pathname.new(File.expand_path(self)).relative_path_from(Pathname.new(File.expand_path(dir))).to_s
19 relative_path_from(Dir.pwd)
22 def remove_leading_parents
23 Pathname.new(".#{Pathname.new("/#{self}").cleanpath}").cleanpath.to_s
27 def install_D(src, dst)
28 _pp "INSTALL", src.relative_path, dst.relative_path
30 mkdir_p File.dirname(dst)
34 def _pp(cmd, src, tgt=nil, indent: nil)
35 return if Rake.application.options.silent
38 template = indent ? "%#{width * indent}s %s %s" : "%-#{width}s %s %s"
39 puts template % [cmd, src, tgt ? "-> #{tgt}" : nil]