diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/stylesheets/USAGE | 5 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb | 9 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css (renamed from railties/lib/rails/generators/rails/app/templates/public/stylesheets/application.css) | 0 |
8 files changed, 18 insertions, 1 deletions
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 5f93dbf18f..9bc019b152 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -26,6 +26,7 @@ module Rails :orm => '-o', :resource_controller => '-c', :scaffold_controller => '-c', + :stylesheets => '-y', :template_engine => '-e', :test_framework => '-t' }, @@ -50,6 +51,7 @@ module Rails :resource_controller => :controller, :scaffold_controller => :scaffold_controller, :singleton => false, + :stylesheets => true, :test_framework => nil, :template_engine => :erb }, diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index f7644c3280..192792d078 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -142,7 +142,7 @@ module Rails::Generators end def create_public_stylesheets_files - directory "public/stylesheets" + empty_directory_with_gitkeep "public/stylesheets" end def create_prototype_files diff --git a/railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory diff --git a/railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory b/railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory diff --git a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb index bd156f399c..779f933785 100644 --- a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb @@ -7,6 +7,7 @@ module Rails remove_class_option :actions hook_for :scaffold_controller, :required => true + hook_for :stylesheets end end end diff --git a/railties/lib/rails/generators/rails/stylesheets/USAGE b/railties/lib/rails/generators/rails/stylesheets/USAGE new file mode 100644 index 0000000000..59e5495d0b --- /dev/null +++ b/railties/lib/rails/generators/rails/stylesheets/USAGE @@ -0,0 +1,5 @@ +Description: + Copies scaffold stylesheets to public/stylesheets/. + +Examples: + `rails generate stylesheets` diff --git a/railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb b/railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb new file mode 100644 index 0000000000..ce68443c39 --- /dev/null +++ b/railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb @@ -0,0 +1,9 @@ +module Rails + module Generators + class StylesheetsGenerator < Base + def copy_stylesheets_file + template "scaffold.css", "public/stylesheets/scaffold.css" if behavior == :invoke + end + end + end +end diff --git a/railties/lib/rails/generators/rails/app/templates/public/stylesheets/application.css b/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css index ea3dc9b8b5..ea3dc9b8b5 100644 --- a/railties/lib/rails/generators/rails/app/templates/public/stylesheets/application.css +++ b/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css |