diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-12-09 18:47:23 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-12-09 18:47:23 +0000 |
commit | b056adf03bd8b331db80f40f484126795d5d9323 (patch) | |
tree | 7613737c7396c8dcca5038411971dc5046c502d8 /railties/lib/rails_generator/commands.rb | |
parent | 3fb58286211b0cf23b18aa26ba0a37fef6bf8745 (diff) | |
download | rails-b056adf03bd8b331db80f40f484126795d5d9323.tar.gz rails-b056adf03bd8b331db80f40f484126795d5d9323.tar.bz2 rails-b056adf03bd8b331db80f40f484126795d5d9323.zip |
Fix shebang handling for empty files. References #2927.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3258 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails_generator/commands.rb')
-rw-r--r-- | railties/lib/rails_generator/commands.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb index bd5754b72d..93d22ddef4 100644 --- a/railties/lib/rails_generator/commands.rb +++ b/railties/lib/rails_generator/commands.rb @@ -220,12 +220,11 @@ module Rails 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 |