cleaner: port to generic OS. (#447)

This commit is contained in:
Mike McQuaid 2016-07-04 16:10:24 +01:00 committed by GitHub
parent 883b201c09
commit fe29cc2920
3 changed files with 19 additions and 1 deletions

View File

@ -66,6 +66,10 @@ class Cleaner
end
end
def executable_path?(path)
path.text_executable?
end
# Clean a top-level (bin, sbin, lib) directory, recursively, by fixing file
# permissions and removing .la files, unless the files (or parent
# directories) are protected by skip_clean.
@ -87,7 +91,7 @@ class Cleaner
path.unlink
else
# Set permissions for executables and non-executables
perms = if path.mach_o_executable? || path.text_executable?
perms = if executable_path?(path)
0555
else
0444
@ -103,3 +107,5 @@ class Cleaner
end
end
end
require "extend/os/cleaner"

View File

@ -0,0 +1,5 @@
require "cleaner"
if OS.mac?
require "extend/os/mac/cleaner"
end

View File

@ -0,0 +1,7 @@
class Cleaner
private
def executable_path?(path)
path.mach_o_executable? || path.text_executable?
end
end