diff options
-rw-r--r-- | lib/fileutils.rb | 16 | ||||
-rw-r--r-- | lib/un.rb | 6 |
2 files changed, 19 insertions, 3 deletions
@@ -754,9 +754,20 @@ module FileUtils # FileUtils.install 'ruby', '/usr/local/bin/ruby', :mode => 0755, :verbose => true # FileUtils.install 'lib.rb', '/usr/local/lib/ruby/site_ruby', :verbose => true # - def install(src, dest, mode: nil, preserve: nil, noop: nil, verbose: nil) - fu_output_message "install -c#{preserve && ' -p'}#{mode ? (' -m 0%o' % mode) : ''} #{[src,dest].flatten.join ' '}" if verbose return if noop fu_each_src_dest(src, dest) do |s, d| st = File.stat(s) unless File.exist?(d) and compare_file(s, d) @@ -764,6 +775,7 @@ module FileUtils copy_file s, d File.utime st.atime, st.mtime, d if preserve File.chmod mode, d if mode end end end @@ -189,13 +189,17 @@ end # -p apply access/modification times of SOURCE files to # corresponding destination files # -m set permission mode (as in chmod), instead of 0755 # -v verbose # def install - setup("pm:") do |argv, options| options[:mode] = (mode = options.delete :m) ? mode.oct : 0755 options[:preserve] = true if options.delete :p dest = argv.pop argv = argv[0] if argv.size == 1 FileUtils.install argv, dest, options |