Skip to content

Commit

Permalink
Fixed repair_executable so that it no longer destroys binary executables
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebayes committed Apr 2, 2010
1 parent 1b39af2 commit 97d91ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions sprout/lib/sprout/user.rb
Expand Up @@ -242,11 +242,12 @@ def execute_thread(tool, options='')
end
end

# Repair Windows Line endings
# found in non-windows executables
# (Flex SDK is regularly published
# with broken CRLFs)
def repair_executable(path)
# Repair Windows Line endings
# found in non-windows executables
# (Flex SDK is regularly published
# with broken CRLFs)
return unless should_repair_executable(path)

content = File.read(path)
if(content.match(/\r\n/))
Expand All @@ -257,6 +258,10 @@ def repair_executable(path)
end
end

def should_repair_executable(path)
return (File.exists?(path) && !File.directory?(path) && File.read(path).match(/^\#\!/))
end

def clean_path(path)
repair_executable path

Expand Down Expand Up @@ -335,7 +340,8 @@ def library
# Override from UnixUser and
# block behavior.
# I know this is smelly... Fixes?
def repair_executable(path)
def should_repair_executable(path)
false
end

def clean_path(path)
Expand Down Expand Up @@ -406,3 +412,4 @@ def alive?
end
end
end

2 changes: 1 addition & 1 deletion sprout/lib/sprout/version.rb
Expand Up @@ -3,7 +3,7 @@ module Sprout
module VERSION #:nodoc:
MAJOR = 0
MINOR = 7
TINY = 238
TINY = 239

STRING = [MAJOR, MINOR, TINY].join('.')
MAJOR_MINOR = [MAJOR, MINOR].join('.')
Expand Down

0 comments on commit 97d91ba

Please sign in to comment.