lib/ric/files.rb in ric-0.11.9 vs lib/ric/files.rb in ric-0.11.10

- old
+ new

@@ -9,10 +9,11 @@ =end def xcopy(from,to,glob_files, opts={}) n_actions = 0 puts "+ Travasing: #{yellow from} ==> #{green to}" verbose = opts.fetch :verbose, true + dryrun = opts.fetch :dryrun, true # i scared of copying files! unless File.exists?("#{to}/.git") fatal 11,"Sorry cant travase data to an unversioned dir. Please version it with git (or add a .git dir/file to trick me)" exit 1 end @@ -22,10 +23,12 @@ end # With this i can understand what has been deleted, with lots of magic from git on both ends.. :) deb "+ First the differences:" deb `diff -qr #{from} #{to} |egrep -v '\\.git' ` + + puts "Dryrun is: #{azure dryrun}" puts "+ Files: #{cyan glob_files}" Dir.chdir(from) Dir.glob(glob_files).each{ |file| from_file = "#{from}/#{file}" @@ -40,10 +43,10 @@ # mkdir dest AND copy file pred "Hey, Dir '#{destdir}' doesnt exist! Creating it.." command = "mkdir -p \"#{destdir}\" && cp \"#{from_file}\" \"#{to_file}\"" end - if opts.fetch(:dryrun, false) + if dryrun puts "[DRYRUN] Skipping #{gray command}" else ret = `#{command} 2>&1` puts "EXE: #{gray command}" if verbose n_actions += 1 \ No newline at end of file