提交 f42c7eee 编写于 作者: D Dmitrii Golub

Remove sqlite3 lines from .gitignore if the application is not using sqlite3.

上级 2ca3f338
* Remove sqlite3 lines from `.gitignore` if the application is not using sqlite3.
*Dmitrii Golub*
* Add public API to register new extensions for `rake notes`.
Example:
......
......@@ -172,6 +172,10 @@ def comment_if(value)
options[value] ? '# ' : ''
end
def sqlite3?
!options[:skip_active_record] && options[:database] == 'sqlite3'
end
class GemfileEntry < Struct.new(:name, :version, :comment, :options, :commented_out)
def initialize(name, version, comment, options = {}, commented_out = false)
super
......
......@@ -50,7 +50,7 @@ def configru
end
def gitignore
copy_file "gitignore", ".gitignore"
template "gitignore", ".gitignore"
end
def app
......
......@@ -7,10 +7,12 @@
# Ignore bundler config.
/.bundle
<% if sqlite3? -%>
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
<% end -%>
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
......@@ -408,7 +408,31 @@ def test_skip_spring
end
end
protected
def test_gitignore_when_sqlite3
run_generator
assert_file '.gitignore' do |content|
assert_match(/sqlite3/, content)
end
end
def test_gitignore_when_no_active_record
run_generator [destination_root, '--skip-active-record']
assert_file '.gitignore' do |content|
assert_no_match(/sqlite3/, content)
end
end
def test_gitignore_when_non_sqlite3_db
run_generator([destination_root, "-d", "mysql"])
assert_file '.gitignore' do |content|
assert_no_match(/sqlite3/, content)
end
end
protected
def action(*args, &block)
silence(:stdout) { generator.send(*args, &block) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册