APIdock / Ruby
/
method

install

ruby latest stable - Class: FileUtils
install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil, noop: nil, verbose: nil)
private

If src is not same as dest, copies it and changes the permission mode to mode. If dest is a directory, destination is dest/src. This method removes destination before copy.

FileUtils .install  'ruby', '/usr/local/bin/ruby', :mode => 0755, :verbose => true
FileUtils .install  'lib.rb', '/usr/local/lib/ruby/site_ruby', :verbose => true
# File lib/fileutils.rb, line 766
 def install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil,
 noop: nil, verbose: nil)
 if verbose
 msg = +"install -c"
 msg << ' -p' if preserve
 msg << ' -m ' << mode_to_s(mode) if mode
 msg << " -o #{owner}" if owner
 msg << " -g #{group}" if group
 msg << ' ' << [src,dest].flatten.join(' ')
 fu_output_message msg
 end
 return if noop
 uid = fu_get_uid(owner)
 gid = fu_get_gid(group)
 fu_each_src_dest(src, dest) do |s, d|
 st = File.stat(s)
 unless File.exist?(d) and compare_file(s, d)
 remove_file d, true
 copy_file s, d
 File.utime st.atime, st.mtime, d if preserve
 File.chmod fu_mode(mode, st), d if mode
 File.chown uid, gid, d if uid or gid
 end
 end
 end

AltStyle によって変換されたページ (->オリジナル) /