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

Merge pull request #5530 from malclocke/add_option_to_skip_index.html_on_rails_generate

Added a generator option to skip the public/index.html file
This commit is contained in:
José Valim 2012-04-30 00:26:45 -07:00
commit 64a54c3f9e
3 changed files with 15 additions and 0 deletions

View file

@ -49,6 +49,9 @@ module Rails
class_option :skip_javascript, :type => :boolean, :aliases => "-J", :default => false,
:desc => "Skip JavaScript files"
class_option :skip_index_html, :type => :boolean, :aliases => "-I", :default => false,
:desc => "Skip public/index.html and app/assets/images/rails.png files"
class_option :dev, :type => :boolean, :default => false,
:desc => "Setup the #{name} with Gemfile pointing to your Rails checkout"

View file

@ -97,6 +97,11 @@ module Rails
def public_directory
directory "public", "public", :recursive => false
if options[:skip_index_html]
remove_file "public/index.html"
remove_file 'app/assets/images/rails.png'
git_keep 'app/assets/images'
end
end
def script

View file

@ -250,6 +250,13 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
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"
end
def test_creation_of_a_test_directory
run_generator
assert_file 'test'