From 31a974dfdb4ce245cd85cf58050e73f0d1a45ef5 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 10 Dec 2010 09:27:53 +0000 Subject: * tool/rbinstall.rb (install_recursive): always skip default ignored files. if block is given, call it instead of calling install. * tool/rbinstall.rb (bin-comm): use install_recursive. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ tool/rbinstall.rb | 23 +++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99343a0155..7248cd4111 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Dec 10 18:27:49 2010 Nobuyoshi Nakada + + * tool/rbinstall.rb (install_recursive): always skip default ignored + files. if block is given, call it instead of calling install. + + * tool/rbinstall.rb (bin-comm): use install_recursive. + Fri Dec 10 18:12:31 2010 Nobuyoshi Nakada * test/mkmf/base.rb (TestMkmf#config_value): extract macro value from diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 908b586934..bfb65dcbcc 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -197,7 +197,8 @@ def install_recursive(srcdir, dest, options = {}) noinst = opts.delete(:no_install) glob = opts.delete(:glob) || "*" subpath = (srcdir.size+1)..-1 - prune = skip = FalseProc + prune = [] + skip = [] if noinst if Array === noinst prune = noinst.grep(/#{File::SEPARATOR}/o).map!{|f| f.chomp(File::SEPARATOR)} @@ -209,10 +210,10 @@ def install_recursive(srcdir, dest, options = {}) skip = [noinst] end end - skip |= %w"#*# *~ *.old *.bak *.orig *.rej *.diff *.patch *.core" - prune = path_matcher(prune) - skip = path_matcher(skip) end + skip |= %w"#*# *~ *.old *.bak *.orig *.rej *.diff *.patch *.core" + prune = path_matcher(prune) + skip = path_matcher(skip) File.directory?(srcdir) or return rescue return paths = [[srcdir, dest, true]] found = [] @@ -239,7 +240,11 @@ def install_recursive(srcdir, dest, options = {}) makedirs(d) else makedirs(File.dirname(d)) - install src, d, opts + if block_given? + yield src, d, opts + else + install src, d, opts + end end end end @@ -435,12 +440,7 @@ install?(:local, :comm, :bin, :'bin-comm') do else trans = proc {|base| base} end - for src in Dir[File.join(srcdir, "bin/*")] - next unless File.file?(src) - s = src.downcase - next if %w(old bak orig rej diff patch core).include? File.extname(s) - next if /^\.\#|(~|core)$/i =~ File.basename(s) - + install_recursive(File.join(srcdir, "bin"), bindir) do |src, cmd| name = RbConfig.expand(trans[File.basename(src)]) shebang = '' @@ -457,7 +457,6 @@ install?(:local, :comm, :bin, :'bin-comm') do shebang.sub!(/\r$/, '') body.gsub!(/\r$/, '') - cmd = File.join(bindir, name) cmd << ".#{$cmdtype}" if $cmdtype open_for_install(cmd, $script_mode) do case $cmdtype -- cgit v1.2.3