diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2011-04-16 19:59:13 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2011-04-16 19:59:21 +0200 |
commit | 5952d4f86055ed612aba66c66a4dc3092e6d4e42 (patch) | |
tree | 5cf90bb7b6ba8d040f9335f8b1290222ef555e63 /railties/lib | |
parent | 1a1e4d484a2686ff8dda3c86ae29fb069f2d81b2 (diff) | |
download | rails-5952d4f86055ed612aba66c66a4dc3092e6d4e42.tar.gz rails-5952d4f86055ed612aba66c66a4dc3092e6d4e42.tar.bz2 rails-5952d4f86055ed612aba66c66a4dc3092e6d4e42.zip |
Fix plugin new generator to work with new javascript/stylesheets conventions
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb | 31 |
2 files changed, 22 insertions, 13 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 8d74fe2c94..4df68d67c7 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -138,7 +138,7 @@ module Rails def vendor_stylesheets empty_directory_with_gitkeep "vendor/assets/stylesheets" end - + def vendor_plugins empty_directory_with_gitkeep "vendor/plugins" end @@ -166,7 +166,7 @@ module Rails if !options[:skip_active_record] && !DATABASES.include?(options[:database]) raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}." end - + if !options[:skip_javascript] && !JAVASCRIPTS.include?(options[:javascript]) raise Error, "Invalid value for --javascript option. Supported for preconfiguration are: #{JAVASCRIPTS.join(", ")}." end diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb index 3cf8410d1e..e7f4bab9de 100644 --- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb @@ -94,26 +94,35 @@ task :default => :test end def stylesheets - empty_directory_with_gitkeep "public/stylesheets" if options[:mountable] + if options[:mountable] + empty_directory_with_gitkeep "app/stylesheets" + copy_file "#{app_templates_dir}/app/assets/stylesheets/application.css", + "app/assets/stylesheets/application.css" + end end def javascripts return unless options[:mountable] - empty_directory "#{app_templates_dir}/public/javascripts" - - unless options[:skip_javascript] - copy_file "#{app_templates_dir}/public/javascripts/#{options[:javascript]}.js", "public/javascripts/#{options[:javascript]}.js" - copy_file "#{app_templates_dir}/public/javascripts/#{options[:javascript]}_ujs.js", "public/javascripts/rails.js" + if options[:skip_javascript] + empty_directory_with_gitkeep "vendor/assets/javascripts" + else + copy_file "#{app_templates_dir}/app/assets/javascripts/application.js.tt", + "app/assets/javascripts/application.js" + copy_file "#{app_templates_dir}/vendor/assets/javascripts/#{options[:javascript]}.js", + "vendor/assets/javascripts/#{options[:javascript]}.js" + copy_file "#{app_templates_dir}/vendor/assets/javascripts/#{options[:javascript]}_ujs.js", + "vendor/assets/javascripts/#{options[:javascript]}_ujs.js" if options[:javascript] == "prototype" - copy_file "#{app_templates_dir}/public/javascripts/controls.js", "public/javascripts/controls.js" - copy_file "#{app_templates_dir}/public/javascripts/dragdrop.js", "public/javascripts/dragdrop.js" - copy_file "#{app_templates_dir}/public/javascripts/effects.js", "public/javascripts/effects.js" + copy_file "#{app_templates_dir}/vendor/assets/javascripts/controls.js", + "vendor/assets/javascripts/controls.js" + copy_file "#{app_templates_dir}/vendor/assets/javascripts/dragdrop.js", + "vendor/assets/javascripts/dragdrop.js" + copy_file "#{app_templates_dir}/vendor/assets/javascripts/effects.js", + "vendor/assets/javascripts/effects.js" end end - - copy_file "#{app_templates_dir}/public/javascripts/application.js", "public/javascripts/application.js" end def script(force = false) |