Permalink
Browse files

Added a generator option to remove the public/index.html file when ge…

…nerating a new Rails application

The option is:
-i, [--skip-index-html]        # Skip public/index.html file
  • Loading branch information...
1 parent b49a7dd commit 5c1109a68e098188803a6232be55dfff1e5e12eb @ivanvanderbyl ivanvanderbyl committed with Aug 23, 2011
View
3 railties/lib/rails/generators/app_base.rb
@@ -49,6 +49,9 @@ def self.add_shared_options_for(name)
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
5 railties/lib/rails/generators/rails/app/app_generator.rb
@@ -97,6 +97,11 @@ def log
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
7 railties/test/generators/app_generator_test.rb
@@ -240,6 +240,13 @@ def test_inclusion_of_javascript_runtime
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'

0 comments on commit 5c1109a

Please sign in to comment.