def input(path)
chdir = attributes[:chdir] || "."
if path =~ /.=./ && !File.exists?(chdir == '.' ? path : File.join(chdir, path))
origin, destination = path.split("=", 2)
if File.directory?(origin) && origin[-1,1] == "/"
chdir = chdir == '.' ? origin : File.join(chdir, origin)
source = "."
else
origin_dir = File.dirname(origin)
chdir = chdir == '.' ? origin_dir : File.join(chdir, origin_dir)
source = File.basename(origin)
end
else
source, destination = path, "/"
end
if attributes[:prefix]
destination = File.join(attributes[:prefix], destination)
end
destination = File.join(staging_path, destination)
logger["method"] = "input"
begin
::Dir.chdir(chdir) do
begin
clone(source, destination)
rescue Errno::ENOENT => e
raise FPM::InvalidPackageConfiguration,
"Cannot package the path '#{File.join(chdir, source)}', does it exist?"
end
end
rescue Errno::ENOENT => e
raise FPM::InvalidPackageConfiguration,
"Cannot chdir to '#{chdir}'. Does it exist?"
end
self.license = "unknown"
self.vendor = [ENV["USER"], Socket.gethostname].join("@")
ensure
logger.remove("method")
end