Permalink
Browse files

r3410@asus: jeremy | 2005-12-09 10:48:32 -0800

 Apply [3258] to stable.  Fix shebang handling for empty files.  Closes #2927.


git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@3259 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1b4470c commit 256d28d3308de0f14bcac38e5cef759b18b1ccbb @jeremy jeremy committed Dec 9, 2005
Showing with 3 additions and 4 deletions.
  1. +3 −4 railties/lib/rails_generator/commands.rb
@@ -220,12 +220,11 @@ def file(relative_source, relative_destination, file_options = {}, &block)
if block_given?
df.write(yield(sf))
else
- line = sf.gets || ''
if file_options[:shebang]
df.puts("#!#{file_options[:shebang]}")
- df.puts(line) if line !~ /^#!/
- else
- df.puts(line)
+ if line = sf.gets
+ df.puts(line) if line !~ /^#!/
+ end
end
df.write(sf.read)
end

0 comments on commit 256d28d

Please sign in to comment.