From ceb05bd1b2f083c252980d4820346bc986c83e39 Mon Sep 17 00:00:00 2001 From: Derek Prior Date: Wed, 12 Sep 2012 20:15:38 -0500 Subject: change app/plugin generators to be more SCM agnostic Users of other SCM's can now generate rails apps that will add the "empty" directories to source control, but will not have a useless .gitignore or mis-named .gitkeep files. * Change `rails new` and `rails plugin new` generators to name the `.gitkeep` as `.keep` in a more SCM-agnostic way. * Change `--skip-git` option to only skip the `.gitignore` file and still generate the `.keep` files. * Add `--skip-keeps` option to skip the `.keep` files. It closes #2800. --- railties/test/generators/app_generator_test.rb | 8 ++++---- railties/test/generators/shared_generator_tests.rb | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index c294bfb238..3ceb8c22a0 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -250,10 +250,10 @@ class AppGeneratorTest < Rails::Generators::TestCase end def test_generator_if_skip_index_html_is_given - run_generator [destination_root, "--skip-index-html"] - assert_no_file "public/index.html" - assert_no_file "app/assets/images/rails.png" - assert_file "app/assets/images/.gitkeep" + run_generator [destination_root, '--skip-index-html'] + assert_no_file 'public/index.html' + assert_no_file 'app/assets/images/rails.png' + assert_file 'app/assets/images/.keep' end def test_creation_of_a_test_directory diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index e78e67725d..a4bdfcf438 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -127,6 +127,18 @@ module SharedGeneratorTests # generated. assert_file 'Gemfile' end + + def test_skip_git + run_generator [destination_root, '--skip-git', '--full'] + assert_no_file('.gitignore') + assert_file('app/mailers/.keep') + end + + def test_skip_keeps + run_generator [destination_root, '--skip-keeps', '--full'] + assert_file('.gitignore') + assert_no_file('app/mailers/.keep') + end end module SharedCustomGeneratorTests -- cgit v1.2.3