aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/app_base.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Bump Gemfile entry jbuilder versionAnton Rieder2019-05-231-1/+1
| | | | | | | | | | jbuilder 2.6.4 is the first version that relaxes the version constraint to allow Rails 6. I also did some more tests in #25183, although not with 2.6.4 explicitly. To simplify the version requirement, I went for 2.7. https://github.com/rails/jbuilder/blob/v2.6.4/jbuilder.gemspec https://github.com/rails/rails/issues/25183#issuecomment-494342406
* Use a better requirement for sass-rails 6 prereleasesDavid Rodríguez2019-05-091-1/+1
| | | | | | | | This is the behavior I naively expect for the operator when used with a single digit, but it's definitely an edge case for it, and it doesn't seem to work as expected for including prereleases. Using >= works fine and make the intention more clear anyways.
* Allow sass-rails greater than 5.x in new appsGuillermo Iguaran2019-04-221-1/+1
|
* Don't lock the webpacker gem by its patch versionSharang Dashputre2019-03-091-1/+1
|
* Use the latest stable release of webpackerSharang Dashputre2019-03-091-1/+1
|
* Changed webserver to web server.alkesh262019-01-221-2/+2
|
* Use released webpackerRafael Mendonça França2019-01-171-1/+1
|
* Move application generator naming and database code to concernsGannon McGibbon2019-01-091-32/+2
|
* Preserve Bundle configuration during app generation (#34755)Marco Costa2019-01-091-9/+11
| | | | | | | | | | | | | | | | | | | | | | | When generating a new rails application (rails new) using a custom template that includes gems from an authenticated source, the user has to provide credentials to bundler. One way to do this is by exporting environment variables, for example: export BUNDLE_GITHUB__COM=user:pass: provides credentials for bundler to fetch gems from github.com. The problem this PR addresses is that we are currently scrubs all /BUNDLE_.*/ environment variables by wrapping our system calls in Bundler.with_clean_env. We do this because we don't want our commands executed against the generated project to use the generator's bundler environment (e.g. our gems): the generated project should use it's own configuration. The problem with Bundler.with_clean_env is that, on top of restoring environment variables to their original state, it also scrubs any /BUNDLE_.*/ variables, which is harmful for authenticated gem sources. This PR replaces Bundler.with_clean_env with Bundler.with_original_env, which only restores environment variables to their initial state, without additional scrubbing.
* Add `--skip-action-text` option to `rails new`bogdanvlviv2019-01-051-1/+9
| | | | | Since PR#34816 was merged in c6ef670aee186a2880b7be59c4c6892b5c983e58, we should add this option for flexibility, and consistency.
* Merge pull request #34816 from ↵Rafael Mendonça França2019-01-031-1/+4
|\ | | | | | | | | | | bogdanvlviv/add-skip-action-mailbox-option-to-rails-new-cmd Add `--skip-action-mailbox` option to `rails new`
| * Add `--skip-action-mailbox` option to `rails new`bogdanvlviv2018-12-281-1/+4
| | | | | | | | Related to https://github.com/rails/rails/commit/ddaf06779aa51d5d1ca462c21c53f2ed169a0d2f
* | Don't load Action Mailbox when Active Storage is skippedGeorge Claghorn2018-12-291-1/+1
|/
* Don't load Action Mailbox when Active Record is skippedGeorge Claghorn2018-12-281-1/+6
|
* Do not show post install message on rails newRafael Mendonça França2018-12-131-4/+4
|
* Remove `--skip-yarn` in favor of `--skip-javascript`bogdanvlviv2018-10-221-3/+0
| | | | | | 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.
* Add `skip-webpack-install` optionyuuji.yaginuma2018-10-091-1/+5
| | | | | This option is useful when want to check only the files generated by `rails new`, or if want to do something before `webpacker:install`.
* Make Webpacker the default JavaScript compiler for Rails 6 (#33079)David Heinemeier Hansson2018-09-301-45/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Remove mysql2 gem version requirement "< 0.6.0"Yasuo Honda2018-09-141-1/+1
| | | | Suggested at https://github.com/rails/rails/pull/33876#issuecomment-421176221
* Merge pull request #33202 from deivid-rodriguez/bundler_binstubsEileen M. Uchitelle2018-08-111-0/+6
|\ | | | | Bundler binstubs
| * Generate bundler-compatible bundler binstubDavid Rodríguez2018-06-231-0/+6
| |
* | Enable Start/EndWith and RegexpMatch copsBart de Water2018-07-281-1/+1
|/ | | | | 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
* Don't include bootsnap by default in apps generated under JRubyGuillermo Iguaran2018-04-201-1/+1
|
* Support mysql2 0.4.x and 0.5.xAaron Stone2018-03-201-1/+1
|
* Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-161-1/+0
| | | | | 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.
* Merge pull request #31641 from ckoenig/remove_frozen_string_literalYuji Yaginuma2018-01-201-4/+6
|\ | | | | Use dup'ed options hash
| * Work on a dup'ed options hashChristof Koenig2018-01-091-4/+6
| | | | | | | | | | | | | | | | | | | | Otherwise, at least using JRuby, the replacements in convert_database_option_for_jruby won't work. Thus a call to bundle exec rails app:update fails. Simply replacing those replace statements doesn't seem to work either, since the options hash seems to be frozen, too.
* | PostgreSQL: Allow pg-1.0 gem to be used with ActiveRecordLars Kanis2018-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | pg-1.0.0 is just released and most Gemfiles don't restrict it's version. But the version is checked when connecting to the database, which leads to the following error: Gem::LoadError: can't activate pg (~> 0.18), already activated pg-1.0.0 See also this pg issue: https://bitbucket.org/ged/ruby-pg/issues/270/pg-100-x64-mingw32-rails-server-not-start Preparation for pg-1.0 was done in commit f28a331023fab, but the pg version constraint was not yet relaxed.
* | Merge pull request #31534 from claudiob/kaspth-approachKasper Timm Hansen2018-01-091-10/+0
|\ \ | |/ |/| Don't include Active Storage migrations in new apps
| * Don't run rails active_storage:install in new appsclaudiob2017-12-141-10/+0
| | | | | | | | See #31315 for full discussion
* | Implicitly skip bootsnap for `rails new --dev`yuuji.yaginuma2017-12-191-1/+1
| | | | | | | | | | | | | | Specifying the `--dev` option is when want to change the codebase, as it is not necessary to cache it. Context: https://github.com/rails/rails/pull/31485#issuecomment-352452653
* | Add `skip_bootsnap` optionyuuji.yaginuma2017-12-161-0/+7
|/ | | | | | `bootsnap` is a useful gem normally. However, `bootsnap` is unnecessary when generating a Rails application to be used only for testing. So I want to control whether use this or not by option.
* Use same version constraint in mysql adapter and generated applicationyuuji.yaginuma2017-11-281-1/+1
| | | | Follow up of 924a368f5c654f5304e575c767eb0fc64adc8659
* Use Puma 3.11 in newly generated applicationsyuuji.yaginuma2017-11-271-1/+1
| | | | | | | In order to use early hints, need to use Puma 3.11.0 or higher. So, I think that should specify that version in newly generated applications. Ref: https://github.com/puma/puma/commit/f6f3892f4d82638fb7a2a57d993641b1486ee88a
* Use released arelRafael Mendonça França2017-11-141-5/+2
|
* Change output log about skipping instalation of Active Storagebogdanvlviv2017-11-081-1/+1
| | | | Using of "`" is preferable over "'" to express console command in output log
* Do not run `active_storage:install` when bundle install is skippedyuuji.yaginuma2017-11-081-1/+5
| | | | | | | In order to execute the `rails` command, need to run bundle install in advance. Therefore, if skipped bundle install, `rails` command may fail and should not do it.
* Execution of `active_storage:install` should respect `--quiet` during `rails ↵bogdanvlviv2017-11-061-1/+1
| | | | new`
* `rails new` runs `rails active_storage:install`bogdanvlviv2017-11-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit `rails activestorage:install` for jdbcmysql, jdbc and shebang tests AppGeneratorTest#test_config_jdbcmysql_database rails aborted! LoadError: Could not load 'active_record/connection_adapters/mysql_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (compressed) bin/rails:4:in `<main>' Tasks: TOP => activestorage:install => environment (See full trace by running task with --trace) AppGeneratorTest#test_config_jdbc_database rails aborted! LoadError: Could not load 'active_record/connection_adapters/jdbc_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (compressed) bin/rails:4:in `<main>' Tasks: TOP => activestorage:install => environment (See full trace by running task with --trace) AppGeneratorTest#test_shebang_is_added_to_rails_file /home/ubuntu/.rbenv/versions/2.4.1/bin/ruby: no Ruby script found in input (LoadError) Prevent PendingMigrationError in tests * Run `bin/rails db:migrate RAILS_ENV=test` in test_cases before start tests to prevent PendingMigrationError * FileUtils.rm_r("db/migrate") * --skip-active-storage Fix failed tests in `railties/test/railties/engine_test.rb` Related to #30111 Imporve `SharedGeneratorTests#test_default_frameworks_are_required_when_others_are_removed` - Explicitly skip active_storage - Ensure that skipped frameworks are commented - Ensure that default frameworks are not commented Fix error `Errno::ENOSPC: No space left on device - sendfile` Since `rails new` runs `rails active_storage:install` that boots an app. Since adding Bootsnap 0312a5c67e35b960e33677b5358c539f1047e4e1 during booting an app, it creates the cache: 264K tmp/cache/bootsnap-load-path-cache 27M tmp/cache/bootsnap-compile-cache * teardown_app must remove app
* Add --skip-active-storage and do so automatically when --skip-active-record ↵bogdanvlviv2017-11-061-49/+74
| | | | | | | | | | | | is used Closes #30102 Revert part 787fe90dc0a7c5b91bb5af51f2858ea8c4676268 --skip-active-storage pass throughs `rails plugin new` Add changelog entry about default initialization of Active Storage
* [Railties] require_relative => requireAkira Matsuda2017-10-211-2/+2
| | | | This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
* redis-rb 4.0 supportJeremy Daer2017-10-081-1/+1
| | | | | | | | * Use `gem 'redis', '~> 4.0'` for new app Gemfiles * Loosen Action Cable redis-rb dep to `>= 3.3, < 5` * Bump redis-namespace for looser Redis version dep * Avoid using the underlying `redis.client` directly * Use `Redis.new` instead of `Redis.connect`
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Use duktape gem as default JS engine on Windows-MINGW and MS-Visual-C buildsLars Kanis2017-08-011-0/+2
| | | | | | | | The fallback javascript engine on Windows is Windows Script Host (JScript). However this engine isn't able to process the default assets, because it supports ES3 only but the coffeescript compiler requires ES5. Fixes #30014
* [Railties] require => require_relativeAkira Matsuda2017-07-011-2/+2
|
* Replace therubyracer with mini_racerSam2017-05-301-1/+1
|
* Do not show --webpack option in the plugin help messageash2017-05-261-4/+0
|
* Use released sass-rails instead of master versionRafael Mendonça França2017-04-191-1/+1
|
* Merge pull request #28546 from claudiob/drop-j-optionRafael Mendonça França2017-03-271-8/+0
|\ | | | | | | Remove -j (--javascript) option from `rails new`