lib/buildmaster/cotta/cotta_file.rb in BuildMaster-0.9.1 vs lib/buildmaster/cotta/cotta_file.rb in BuildMaster-1.0.6
- old
+ new
@@ -3,12 +3,12 @@
module BuildMaster
class CottaFile
attr_reader :system, :path
def initialize(system, path)
- @system = system
@path = path
+ @system = system
end
def cotta
return Cotta.new(system)
end
@@ -36,15 +36,23 @@
def copy_to(target_file)
target_file.parent.mkdirs
@system.copy_file(path, target_file.path)
end
+ def copy_to_path(target_path)
+ copy_to(cotta.file(target_path))
+ end
+
def move_to(target_file)
target_file.parent.mkdirs
@system.move_file(path, target_file.path)
end
+ def move_to_path(target_path)
+ move_to(cotta.file(target_path))
+ end
+
def save(content = '')
write {|file| file.printf content.to_s}
end
def write(&block)
@@ -76,10 +84,14 @@
return false unless other.kind_of? CottaFile
return @system == other.system && @path == other.path
end
def to_s
- return "#{super}-#@system-#@path"
+ @path
+ end
+
+ def inspect
+ return "#{self.class}:#{self.object_id}-#{@system.inspect}-#@path"
end
private
def open(*args)
\ No newline at end of file