lib/l5m-tools/application.rb in l5m-tools-0.0.4 vs lib/l5m-tools/application.rb in l5m-tools-0.0.5
- old
+ new
@@ -5,15 +5,19 @@
TEMPLATE_DIR = Pathname.new(__FILE__).parent + 'template'
class Application
require 'l5m-tools/tools'
include Tools
def duplicate_app(*args)
+ delete = args.delete('-d')
replacements = {args[1] => args[2]}
File.open(args[0], "r") do |infile|
while (line = infile.gets)
- line = line.chomp.strip
- duplicate_and_replace( line.chomp , replacements ) if line.length > 0 && line[0] != '#'
+ line = line.chomp.strip
+ if line.length > 0 && line[0] != '#'
+ duplicate_and_replace( line.chomp , replacements )
+ FileUtils.rm(line, :force => true) if delete
+ end
end
end
end
def make_app(package, application, use_base_worker, &block)
application[0] = application[0].capitalize
@@ -36,6 +40,6 @@
end
end
-end
\ No newline at end of file
+end