lib/scaffoldhub/template_file.rb in scaffoldhub-0.0.7 vs lib/scaffoldhub/template_file.rb in scaffoldhub-0.0.8
- old
+ new
@@ -1,11 +1,12 @@
module Scaffoldhub
class TemplateFile < RemoteFile
- def initialize(src, dest, local, base_url, status_proc)
+ def initialize(src, dest, rename, local, base_url, status_proc)
@src = src
@dest = dest || ''
+ @rename = rename
@local = local
@base_url = base_url
super(url, status_proc)
end
@@ -16,10 +17,14 @@
@local_path
end
end
def dest
- File.join(@dest, File.basename(@src))
+ if @rename
+ File.join(@dest, @rename)
+ else
+ File.join(@dest, File.basename(@src))
+ end
end
def download!
if @local
raise Errno::ENOENT.new(src) unless File.exists?(src)