[前][次][番号順一覧][スレッド一覧]

ruby-changes:38098

From: nobu <ko1@a...>
Date: Wed, 8 Apr 2015 01:05:36 +0900 (JST)
Subject: [ruby-changes:38098] nobu:r50179 (trunk): rbinstall.rb: $script_mode

nobu	2015-04-08 01:05:21 +0900 (Wed, 08 Apr 2015)

  New Revision: 50179

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50179

  Log:
    rbinstall.rb: $script_mode
    
    * tool/rbinstall.rb: set script files permission to $script_mode.

  Modified files:
    trunk/tool/rbinstall.rb
Index: tool/rbinstall.rb
===================================================================
--- tool/rbinstall.rb	(revision 50178)
+++ tool/rbinstall.rb	(revision 50179)
@@ -659,10 +659,11 @@ end https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L659
         path = File.dirname(@gem.path)
         return if path == destination_dir
         File.chmod(0700, destination_dir)
+        mode = pattern == "bin/*" ? $script_mode : $data_mode
         install_recursive(path, without_destdir(destination_dir),
                           :glob => pattern,
                           :no_install => "*.gemspec",
-                          :mode => $data_mode)
+                          :mode => mode)
         File.chmod($dir_mode, destination_dir)
       end
     end
@@ -676,6 +677,15 @@ end https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L677
     end
   end
 end
+
+class Gem::Installer
+  generate_bin_script = instance_method(:generate_bin_script)
+  define_method(:generate_bin_script) do |filename, bindir|
+    generate_bin_script.bind(self).call(filename, bindir)
+    File.chmod($script_mode, File.join(bindir, formatted_program_filename(filename)))
+  end
+end
+
 # :startdoc:
 
 install?(:ext, :comm, :gem) do
@@ -725,7 +735,7 @@ install?(:ext, :comm, :gem) do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L735
       makedirs(bin_dir)
 
       execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}
-      install(execs, bin_dir, :mode => $prog_mode)
+      install(execs, bin_dir, :mode => $script_mode)
     end
   end
 end
@@ -764,8 +774,6 @@ install?(:ext, :comm, :gem) do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L774
       gemname = File.basename(gem)
       puts "#{" "*30}#{gemname}"
     end
-    # fix bindir permission
-    File.chmod($prog_mode, *Dir.glob(with_destdir(bindir)+"/*"))
     # fix directory permissions
     # TODO: Gem.install should accept :dir_mode option or something
     File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]