bin/mint in proutils-0.3.0 vs bin/mint in proutils-0.3.1

- old
+ new

@@ -4,10 +4,12 @@ require 'proutils/mint/copier' module Mint # Scaffolding Console Command + # + # IMPORTANT: When using system lookup, all globs must be in quotes!!! class Command # Start command. @@ -20,11 +22,11 @@ def initialize @options = {} @cmd = 'copy' # default command opts = GetoptLong.new( - ['--source', '-s', GetoptLong::NO_ARGUMENT], + ['--system', '-s', GetoptLong::NO_ARGUMENT], ['--dryrun', '--noharm', '-n', GetoptLong::NO_ARGUMENT], ['--skip', GetoptLong::NO_ARGUMENT], ['--replace', GetoptLong::NO_ARGUMENT], ['--help', '-h', GetoptLong::NO_ARGUMENT] ) @@ -35,17 +37,22 @@ @options[:dryrun] = true when '--safe' @options[:skip] = true when '--replace' @options[:force] = true + when '--system' + @options[:system] = true when '--help' @cmd = 'help' - when '--source' - @options[:special] = true end end + end + # + + def options + @options end # Start execution. def start @@ -53,20 +60,15 @@ end # Copy scaffolding. def copy - #if @source - # src = Mint.lookup(ARGV[0]) - # dst = ARGV[1] || '.' - #else - src = ARGV[0] - dst = ARGV[1] || '.' - #end - - if src - Copier.new(src, dst, @options).copy - else + begin + destination = ARGV.pop + resource = ARGV.dup + copier = Copier.new(resource, destination, options) + copier.copy + rescue LoadError puts "Unrecognized source, '#{src}'." exit 0 end end