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:
parent
3873fc5c1c
commit
46fedb4782
3 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -15,5 +15,7 @@
|
|||
<% end -%>
|
||||
# Ignore all logfiles and tempfiles.
|
||||
/log/*
|
||||
<% if keeps? -%>
|
||||
!/log/.keep
|
||||
<% end -%>
|
||||
/tmp
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue