1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Omit .keep in .gitignore when generated with --skip-keeps.

This commit is contained in:
Ben Pickles 2015-05-22 13:24:48 +01:00
parent 3873fc5c1c
commit 46fedb4782
3 changed files with 12 additions and 2 deletions

View file

@ -174,6 +174,10 @@ module Rails
options[value] ? '# ' : ''
end
def keeps?
!options[:skip_keeps]
end
def sqlite3?
!options[:skip_active_record] && options[:database] == 'sqlite3'
end
@ -355,7 +359,7 @@ module Rails
end
def keep_file(destination)
create_file("#{destination}/.keep") unless options[:skip_keeps]
create_file("#{destination}/.keep") if keeps?
end
end
end

View file

@ -15,5 +15,7 @@
<% end -%>
# Ignore all logfiles and tempfiles.
/log/*
<% if keeps? -%>
!/log/.keep
<% end -%>
/tmp

View file

@ -138,7 +138,11 @@ module SharedGeneratorTests
def test_skip_keeps
run_generator [destination_root, '--skip-keeps', '--full']
assert_file('.gitignore')
assert_file '.gitignore' do |content|
assert_no_match(/\.keep/, content)
end
assert_no_file('app/mailers/.keep')
end
end