aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/rails/plugin
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Lint/UselessAssignment` cop to avoid unused variable warnings (#34904)Ryuta Kamizono2019-01-091-3/+3
| | | | | | | | | | | | | | * Enable `Lint/UselessAssignment` cop to avoid unused variable warnings Since we've addressed the warning "assigned but unused variable" frequently. 370537de05092aeea552146b42042833212a1acc 3040446cece8e7a6d9e29219e636e13f180a1e03 5ed618e192e9788094bd92c51255dda1c4fd0eae 76ebafe594fc23abc3764acc7a3758ca473799e5 And also, I've found the unused args in c1b14ad which raises no warnings by the cop, it shows the value of the cop.
* Remove `--skip-yarn` in favor of `--skip-javascript`bogdanvlviv2018-10-222-2/+2
| | | | | | Since #33079 Webpacker the default JavaScript compiler for Rails. Webpacker uses `yarn` so seems like it doesn't make sense for Rails to keep `--skip-yarn` option.
* Remove `:javascript` from `Rails::PluginBuilder::PASSTHROUGH_OPTIONS`bogdanvlviv2018-10-221-1/+1
| | | | `--javascript` option was removed by 42198064c35ff3b701496309f90df2abc229efbe
* Avoid `webpacker:install` if unnecessaryyuuji.yaginuma2018-10-091-0/+1
| | | | | `webpacker:install` also includes execution of yarn, it takes time to execute, so avoid unnecessary tests.
* Make Webpacker the default JavaScript compiler for Rails 6 (#33079)David Heinemeier Hansson2018-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use Webpacker by default on new apps * Stop including coffee-rails by default * Drop using a js_compressor by default * Drop extra test for coffeescript inclusion by default * Stick with skip_javascript to signify skipping webpack * Don't install a JS runtime by default any more * app/javascript will be the new default directory for JS * Make it clear that this is just for configuring the default Webpack framework setup now * Start using the Webpack tag in the default layout * Irrelevant test * jQuery is long gone * Stop having asset pipeline compile default application.js * Add rails-ujs by default to the Webpack setup * Add Active Storage JavaScript to application.js pack by default * Consistent quoting * Add Turbolinks to default pack * Add Action Cable to default pack Need some work on how to set the global consumer that channels will work with. @javan? * Require all channels by default and use a separate consumer stub * Channel generator now targets Webpack style * Update task docs to match new generator style * Use uniform import style * Drop the JS assets generator It was barely helpful as it was. It’s no longer helpful in a Webpacked world. Sayonara! * Add app/javascript to the stats directories * Simpler import style Which match the other imports. * Address test failures from dropping JS compilation (and compression) * webpacker-default: Modify `AssetsGeneratorTest` Before: ``` $ bin/test test/generators/assets_generator_test.rb Run options: --seed 46201 F Failure: AssetsGeneratorTest#test_assets [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:12]: Expected file "app/assets/javascripts/posts.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:10 . Finished in 0.031343s, 63.8101 runs/s, 95.7152 assertions/s. 2 runs, 3 assertions, 1 failures, 0 errors, 0 skips ``` After: ``` $ bin/test test/generators/assets_generator_test.rb Run options: --seed 43571 .. Finished in 0.030370s, 65.8545 runs/s, 65.8545 assertions/s. 2 runs, 2 assertions, 0 failures, 0 errors, 0 skips ``` * webpacker-default: Modify `ChannelGeneratorTest` Before: ``` $ bin/test test/generators/channel_generator_test.rb Run options: --seed 8986 .F Failure: ChannelGeneratorTest#test_channel_with_multiple_actions_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:43]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:34 .F Failure: ChannelGeneratorTest#test_channel_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:29]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:22 E Error: ChannelGeneratorTest#test_cable_js_is_created_if_not_present_already: Errno::ENOENT: No such file or directory @ apply2files - /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/fixtures/tmp/app/assets/javascripts/cable.js bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:60 F Failure: ChannelGeneratorTest#test_channel_suffix_is_not_duplicated [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:87]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:80 F Failure: ChannelGeneratorTest#test_channel_on_revoke [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:77]: Expected file "app/assets/javascripts/cable.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:68 Finished in 0.064384s, 108.7227 runs/s, 481.4861 assertions/s. 7 runs, 31 assertions, 4 failures, 1 errors, 0 skips ``` After: ``` $ bin/test test/generators/channel_generator_test.rb Run options: --seed 44857 ....... Finished in 0.060243s, 116.1961 runs/s, 697.1764 assertions/s. 7 runs, 42 assertions, 0 failures, 0 errors, 0 skips ``` * Fix shared generator tests. * webpacker-default: Modify `ControllerGeneratorTest` The JS assets generator was dropped. ref. https://github.com/rails/rails/commit/46215b179483d3e4d264555f5a4952f43eb8142a * Revert "Simpler import style". It's currently failing with an error of "TypeError: undefined is not an object (evaluating '__WEBPACK_IMPORTED_MODULE_2_activestorage___default.a.start')". Waiting for @javan to have a look. This reverts commit 5d3ebb71059f635d3756cbda4ab9752027e09256. * require webpacker in test app * Add webpacker without making the build hang/timeout. (#33640) * use yarn workspaces to allow for installing unreleased packages and only generate js/bootsnap when required * no longer need to have webpacker in env templates as webpacker moved this config to yml file * Fix rubocop violation * Got the test passing for the running scaffold * update expected lines of code * update middleware tests to account for webpacker * disable js in plugins be default to get the tests passing (#34009) * clear codeclimate report issues * Anything newer than currently released is good * Use Webpacker development version during development of Rails * Edge should get development webpacker as well * Add changelog entry for Webpacker change
* use "minitest" consistentlyXavier Noria2018-09-111-2/+1
| | | | | | | | | The name of the minitest library is spelled that way: regular font, and lowercase. Lowercase is used even at the beginning of sentences, see http://docs.seattlerb.org/minitest/ I double-checked this with @zenspider too (thanks!).
* Use canonical name for block localyuuji.yaginuma2018-09-071-12/+12
| | | | | | | | `spec` is the same variable name as gemspec generated by bundler, and its intention is easier to understand than a one-letter variable. https://github.com/bundler/bundler/blob/00fd58eaa69015092ee272c4cb5aa92a5e7ee45c/lib/bundler/templates/newgem/newgem.gemspec.tt#L11 This is follow up on 1c59b4840c58097186022f68427c46e0046c5d0d. `spec` is already in use there.
* Generate a gem that can't be pushed to Rubygems.org by defaultRafael Mendonça França2018-09-061-0/+9
| | | | | This will avoid gems that are made to be private to be pushed to public repositories.
* Enable Start/EndWith and RegexpMatch copsBart de Water2018-07-281-3/+3
| | | | | In cases where the MatchData object is not used, this provides a speed-up: https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
* Improve generated file `app/assets/javascripts/application.js` of pluginbogdanvlviv2018-02-231-0/+1
| | | | | | Add `//= require rails-ujs` Closes #32094
* Improve generated file `app/views/application.html.erb` of pluginbogdanvlviv2018-02-231-1/+5
| | | | | - Do not generate `javascript_include_tag` if `--skip-javascript` - Generate `<%= csp_meta_tag %>`. Related to #32018.
* Comment `require "active_storage/engine"` in `bin/rails` of plugin if ↵bogdanvlviv2018-02-231-1/+1
| | | | `--skip-active-storage`
* Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-167-7/+7
| | | | | Some places we can't remove because Ruby still don't have a method equivalent to strip_heredoc to be called in an already existent string.
* Revert "remove unnecessary `RAILS_ENV` setting"Aaron Patterson2017-12-081-0/+3
| | | | This reverts commit 9a80f52541ed2c93ebef02909ecab3aaf9127150.
* Deprecate an `after_bundle` callback in Rails plugin templatesyuuji.yaginuma2017-11-181-0/+4
| | | | | | | | | Since fbd1e98cf983572ca9884f17f933ffe92833632a, Rails plugin does not run `bundle install` when generating. Therefore, `after_bundle` callback is not actually executed after `bundle`. Since there is a difference between the name and the actual behavior, I think that should be remove.
* Merge pull request #30004 from npenzin/patch-1Yuji Yaginuma2017-11-151-1/+1
|\ | | | | Update plugin_generator.rb
| * Ensure plugin_generator adds to new line in GemfileNikita Penzin2017-11-141-1/+1
| | | | | | | | | | | | | | Ensure plugin_generator adds to new line in Gemfile, even if the Gemfile does not end with an empty line. [Lisa Ugray, Nikita Penzin]
* | Use .tt extension to all the template filesRafael Mendonça França2017-11-1322-0/+0
| | | | | | | | | | | | | | | | Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878.
* | Merge pull request #30770 from ↵Kasper Timm Hansen2017-11-121-0/+1
|\ \ | | | | | | | | | | | | y-yagi/do_not_create_credential_in_dummy_application Do not create credentials in dummy application
| * | Do not create credentials in dummy applicationyuuji.yaginuma2017-10-021-0/+1
| | | | | | | | | | | | | | | Because dummy application is only for use test, so credentials is unnecessary.
* | | Add --skip-active-storage and do so automatically when --skip-active-record ↵bogdanvlviv2017-11-064-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is used Closes #30102 Revert part 787fe90dc0a7c5b91bb5af51f2858ea8c4676268 --skip-active-storage pass throughs `rails plugin new` Add changelog entry about default initialization of Active Storage
* | | add _ for unused last argRenan Gurgel2017-10-241-1/+1
| | |
* | | Space between { and | missing.Renan Gurgel2017-10-231-1/+1
| | | | | | | | | Improve a code style recommendation following Rubocop instructions https://codeclimate.com/github/rails/rails/issues
* | | Avoid slicing from Thor's original HWIAAkira Matsuda2017-10-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Because `options` here is not AS::HWIA but an instance of Thor::CoreExt::HWIA that looks very similar to ours but behaves slightly different, we need to keep this object be an instance of Thor::CoreExt::HWIA. Since Ruby 2.5 has Hash#slice that returns a new Hash instance now, we need to avoid calling `slice` on this tricky object.
* | | [Railties] require_relative => requireAkira Matsuda2017-10-211-1/+1
|/ / | | | | | | This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
* | Explicitly require `test_unit/reporter` in test helperyuuji.yaginuma2017-09-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | If the user used the `bin/test` to execute the test, this file is automatically loaded, so require is unnecessary. https://github.com/rails/rails/blob/acea68de026ba657cb65c4dd0fc1f24ba67e1cf8/railties/lib/rails/plugin/test.rb#L4 However, when using `rake test`, an explicit require is required because the above file is not loaded. Fixes #30516
* | Merge pull request #30348 from koic/remove_frozen_string_literal_from_templatesGeorge Claghorn2017-08-2114-29/+0
|\ \ | | | | | | Remove frozen_string_literal magic comment from templates
| * | Remove frozen_string_literal magic comment from templatesKoichi ITO2017-08-2214-29/+0
| | |
* | | Update MIT licenses link [ci skip]Yoshiyuki Hirano2017-08-221-1/+1
|/ /
* | Move common tests from `AppGeneratorTest` and `PluginGeneratorTest` to ↵bogdanvlviv2017-08-172-0/+4
| | | | | | | | `SharedGeneratorTests`
* | Add --skip-yarn option to the plugin generatorbogdanvlviv2017-08-152-1/+5
| | | | | | | | | | Add SharedGeneratorTests#application_path This method will help to DRY in files app_generator_test.rb, plugin_generator_test.rb
* | Merge pull request #30239 from bogdanvlviv/improve-plugin_generator_codeRafael França2017-08-141-2/+1
|\ \ | | | | | | Improve plugin generator codebase
| * | Remove `:force` from PASSTHROUGH_OPTIONS for plugin generatorbogdanvlviv2017-08-131-1/+1
| | | | | | | | | | | | `:force` is setted inside the method `generate_test_dummy`
| * | Register `--api` option for plugin generator by PASSTHROUGH_OPTIONS constantbogdanvlviv2017-08-131-2/+1
| | |
* | | Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-1415-0/+30
|/ /
* | Merge pull request #30114 from yhirano55/remove_empty_line_from_dummy_manifestRafael França2017-08-111-1/+0
|\ \ | | | | | | Removed empty line from dummy_manifest
| * | Removed empty line from dummy_manifestYoshiyuki Hirano2017-08-071-1/+0
| | |
* | | Merge pull request #30116 from ↵Rafael Mendonça França2017-08-111-0/+15
|\ \ \ | | | | | | | | | | | | | | | | | | | | yhirano55/skip_unused_components_when_running_rails_command_in_plugin Skip unused components when running `bin/rails` in Rails plugin
| * | | Skip unused components when running in Rails pluginYoshiyuki Hirano2017-08-091-0/+15
| | | |
* | | | Merge pull request #30110 from yhirano55/add_git_sourceRafael Mendonça França2017-08-111-0/+1
|\ \ \ \ | | | | | | | | | | | | | | | Add git_source to Gemfile for plugin generator
| * | | | Add git_source to Gemfile for plugin generatorYoshiyuki Hirano2017-08-091-0/+1
| |/ / /
* | | | Merge pull request #30092 from bogdanvlviv/prevent-generation-extra-empty-linesRafael França2017-08-112-7/+6
|\ \ \ \ | | | | | | | | | | Prevent generation extra empty lines in a plugin's Rakefile
| * | | | Prevent generation extra empty lines in a plugin's Rakefilebogdanvlviv2017-08-092-7/+6
| | |/ / | |/| |
* | | | `--skip-action-cable` pass throughs `rails plugin new`bogdanvlviv2017-08-101-1/+1
| | | |
* | | | Merge pull request #30091 from yhirano55/fix_engine_commandRafael França2017-08-081-0/+2
|\ \ \ \ | |_|/ / |/| | | Fix engine command
| * | | Fix engine commandYoshiyuki Hirano2017-08-061-0/+2
| |/ /
* | | Merge pull request #30123 from yhirano55/fix_dummy_app_configurationRafael França2017-08-081-3/+5
|\ \ \ | | | | | | | | Fix dummy_app configuration
| * | | Fix dummy_app configurationYoshiyuki Hirano2017-08-081-3/+5
| |/ /
* / / Use `with_dummy_app?` in gitignoreYoshiyuki Hirano2017-08-081-1/+1
|/ /
* | Include active_storage in all generated application.rb filesDavid Heinemeier Hansson2017-08-041-0/+1
| | | | | | | | And deal with a temporary test fix until we allow you to skip active storage.