mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update git init when generating plugins
* Extract separate test, test with `--skip-git`
* Move `version_control` beneath `gitignore` to match `AppBuilder` from 8989a505
* Add changelog entry
This commit is contained in:
parent
71b6d721f7
commit
b7027099b1
3 changed files with 19 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
* Run `git init` when generating plugins.
|
||||
|
||||
Opt out with `--skip-git`.
|
||||
|
||||
*OKURA Masafumi*
|
||||
|
||||
* Add benchmark generator
|
||||
|
||||
Introduce benchmark generator to benchmark Rails applications.
|
||||
|
|
|
@ -57,6 +57,12 @@ module Rails
|
|||
template "gitignore", ".gitignore"
|
||||
end
|
||||
|
||||
def version_control
|
||||
if !options[:skip_git] && !options[:pretend]
|
||||
run "git init", capture: options[:quiet], abort_on_failure: false
|
||||
end
|
||||
end
|
||||
|
||||
def lib
|
||||
template "lib/%namespaced_name%.rb"
|
||||
template "lib/tasks/%namespaced_name%_tasks.rake"
|
||||
|
@ -161,12 +167,6 @@ task default: :test
|
|||
append_file gemfile_in_app_path, entry
|
||||
end
|
||||
end
|
||||
|
||||
def version_control
|
||||
if !options[:skip_git] && !options[:pretend]
|
||||
run "git init", capture: options[:quiet], abort_on_failure: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Generators
|
||||
|
|
|
@ -64,7 +64,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase
|
|||
end
|
||||
|
||||
def test_generating_without_options
|
||||
output = run_generator
|
||||
run_generator
|
||||
assert_file "README.md", /Bukkits/
|
||||
assert_no_file "config/routes.rb"
|
||||
assert_no_file "app/assets/config/bukkits_manifest.js"
|
||||
|
@ -79,7 +79,11 @@ class PluginGeneratorTest < Rails::Generators::TestCase
|
|||
assert_file "test/bukkits_test.rb", /assert_kind_of Module, Bukkits/
|
||||
assert_file "bin/test"
|
||||
assert_no_file "bin/rails"
|
||||
assert_match(/run git init/, output)
|
||||
end
|
||||
|
||||
def test_initializes_git_repo
|
||||
run_generator
|
||||
assert_directory ".git"
|
||||
end
|
||||
|
||||
def test_generating_in_full_mode_with_almost_of_all_skip_options
|
||||
|
@ -607,6 +611,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase
|
|||
assert_match name, contents
|
||||
assert_match email, contents
|
||||
end
|
||||
assert_no_directory ".git"
|
||||
end
|
||||
|
||||
def test_skipping_useless_folders_generation_for_api_engines
|
||||
|
|
Loading…
Reference in a new issue