lib/noe/go.rb in noe-1.7.4 vs lib/noe/go.rb in noe-1.7.5
- old
+ new
@@ -1,5 +1,6 @@
+require 'fileutils'
module Noe
class Main
#
# Instantiate a project template using a .noespec file
#
@@ -294,14 +295,19 @@
end # class Rm
class FileInstantiate < DoSomething
def run
- relocated.open('w') do |out|
- dialect = entry.wlang_dialect
- braces = entry.wlang_braces
- variables.methodize!
- out << WLang::file_instantiate(entry.realpath.to_s, variables, dialect, braces)
+ source = entry.realpath.to_s
+ target = relocated
+ if dialect = entry.wlang_dialect
+ target.open('w') do |out|
+ braces = entry.wlang_braces
+ variables.methodize!
+ out << WLang::file_instantiate(source, variables, dialect, braces)
+ end
+ else
+ FileUtils.cp(source, target)
end
end
def to_s
"wlang #{entry.path} > #{relocated}"