Navigation Menu

Skip to content

Commit

Permalink
Fix shebang handling for empty files. References #2927.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3258 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Dec 9, 2005
1 parent 3fb5828 commit b056adf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions railties/lib/rails_generator/commands.rb
Expand Up @@ -220,12 +220,11 @@ def file(relative_source, relative_destination, file_options = {}, &block)
if block_given? if block_given?
df.write(yield(sf)) df.write(yield(sf))
else else
line = sf.gets || ''
if file_options[:shebang] if file_options[:shebang]
df.puts("#!#{file_options[:shebang]}") df.puts("#!#{file_options[:shebang]}")
df.puts(line) if line !~ /^#!/ if line = sf.gets
else df.puts(line) if line !~ /^#!/
df.puts(line) end
end end
df.write(sf.read) df.write(sf.read)
end end
Expand Down

0 comments on commit b056adf

Please sign in to comment.