diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-15 00:45:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-15 00:45:10 +0000 |
commit | 37a8a2a26e607908207ca2854b82b5ff7db91d68 (patch) | |
tree | 81647a049c9cee930fc1f2c536ddf61362644a47 /tool | |
parent | 0255bac7b93cf322c5963b238de092cacc6ae6e3 (diff) | |
download | ruby-37a8a2a26e607908207ca2854b82b5ff7db91d68.tar.gz |
rbinstall.rb: do nothing if bin script is same
* tool/rbinstall.rb (check_executable_overwrite): do nothing if
the existing file equals to the wrapper script to be generated.
* tool/rbinstall.rb (generate_bin_script): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/rbinstall.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 12e8463abc..490f5f3281 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -695,6 +695,25 @@ module RbInstall first_line = File.open(path, "rb") {|file| file.gets} $script_installer.prolog(first_line) end + + def check_executable_overwrite(filename) + return if @wrappers and same_bin_script?(filename, @bin_dir) + super + end + + def generate_bin_script(filename, bindir) + return if same_bin_script?(filename, bindir) + super + end + + def same_bin_script?(filename, bindir) + path = File.join(bindir, formatted_program_filename(filename)) + begin + return true if File.binread(path) == app_script_text(filename) + rescue + end + false + end end end |