diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-10 09:27:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-10 09:27:53 +0000 |
commit | 31a974dfdb4ce245cd85cf58050e73f0d1a45ef5 (patch) | |
tree | 481b718b81c15fc72098bd98ea0f7c37f35630aa /tool | |
parent | 61d197a62da53b11518f40a1dfb793f8ef85d89b (diff) |
* 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
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/rbinstall.rb | 23 |
1 files changed, 11 insertions, 12 deletions
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 |