diff options
author | Robin Dupret <robin.dupret@gmail.com> | 2015-07-23 17:52:51 +0200 |
---|---|---|
committer | Robin Dupret <robin.dupret@gmail.com> | 2015-07-23 18:27:15 +0200 |
commit | 67863aa8440805628477647e1015372d11913ca7 (patch) | |
tree | 5e05513e4a79c3296be386567b044563978e4b18 /railties/lib/rails | |
parent | 9a7f011da196f93cec285a6227ad9499434da4d1 (diff) | |
download | rails-67863aa8440805628477647e1015372d11913ca7.tar.gz rails-67863aa8440805628477647e1015372d11913ca7.tar.bz2 rails-67863aa8440805628477647e1015372d11913ca7.zip |
Skip assets, helpers and views generation for API plugins
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/plugin_generator.rb | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index 84f67069c6..c986066aa8 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -17,15 +17,22 @@ module Rails def app if mountable? - directory 'app' - empty_directory_with_keep_file "app/assets/images/#{namespaced_name}" + if api? + directory 'app', exclude_pattern: %r{app/(views|helpers)} + else + directory 'app' + empty_directory_with_keep_file "app/assets/images/#{namespaced_name}" + end elsif full? empty_directory_with_keep_file 'app/models' empty_directory_with_keep_file 'app/controllers' - empty_directory_with_keep_file 'app/views' - empty_directory_with_keep_file 'app/helpers' empty_directory_with_keep_file 'app/mailers' - empty_directory_with_keep_file "app/assets/images/#{namespaced_name}" + + unless api? + empty_directory_with_keep_file "app/assets/images/#{namespaced_name}" + empty_directory_with_keep_file 'app/helpers' + empty_directory_with_keep_file 'app/views' + end end end @@ -213,15 +220,15 @@ task default: :test end def create_public_stylesheets_files - build(:stylesheets) + build(:stylesheets) unless api? end def create_javascript_files - build(:javascripts) + build(:javascripts) unless api? end def create_images_directory - build(:images) + build(:images) unless api? end def create_bin_files |