aboutsummaryrefslogtreecommitdiffstats
path: root/railties
Commit message (Collapse)AuthorAgeFilesLines
* Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-174-5/+11
| | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* Clean up and consolidate .gitignoresbogdanvlviv2018-02-171-1/+5
| | | | | | | | | | | | | | | | * Global ignores at toplevel .gitignore * Component-specific ignores in each toplevel directory * Remove `actionview/test/tmp/.keep` for JRuby ``` rm actionview/test/tmp/ -fr cd actionview/ bundle exec jruby -Itest test/template/digestor_test.rb ``` Related to #11743, #30392. Closes #29978.
* Multipart file uploads are very rare in API only apps so don't include ↵Guillermo Iguaran2018-02-172-3/+3
| | | | Rack::TemfileReaper in default middleware stack for API only apps
* Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-173-14/+5
|
* Merge pull request #32002 from y-yagi/fix_set_serializerRafael França2018-02-171-0/+12
|\ | | | | Fix custome serializer setting
| * Fix custome serializer settingYuji Yaginuma2018-02-161-0/+12
| | | | | | | | | | | | | | | | The serializer should be set up in `after_initialize` so that it work properly even if the user specifies serializer with initializers. Also, since `custom_serializers` is `Array`, it needs to be flattened before setting the value.
* | Fix changelog entry [ci skip]Rafael Mendonça França2018-02-161-1/+7
| |
* | Merge pull request #31901 from Kevinrob/patch-1Rafael França2018-02-163-4/+51
|\ \ | | | | | | Use SuppressedSummaryReporter and Rails::TestUnitReporter only if needed
| * | Add SuppressedSummaryReporter and TestUnitReporter only if necessaryKevin Robatel2018-02-153-4/+51
| |/
* | Remove needless requiring 'active_support/core_ext/string/strip'Yoshiyuki Hirano2018-02-171-1/+0
| |
* | Remove needless printyuuji.yaginuma2018-02-171-1/+0
| | | | | | | | It seems to debug print.
* | Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-1615-46/+42
| | | | | | | | | | 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.
* | Remove support to Ruby 2.2Rafael Mendonça França2018-02-161-1/+1
| | | | | | | | Rails 6 will only support Ruby >= 2.3.
* | Add test parallelization to Railseileencodes2018-02-155-5/+97
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provides both a forked process and threaded parallelization options. To use add `parallelize` to your test suite. Takes a `workers` argument that controls how many times the process is forked. For each process a new database will be created suffixed with the worker number; test-database-0 and test-database-1 respectively. If `ENV["PARALLEL_WORKERS"]` is set the workers argument will be ignored and the environment variable will be used instead. This is useful for CI environments, or other environments where you may need more workers than you do for local testing. If the number of workers is set to `1` or fewer, the tests will not be parallelized. The default parallelization method is to fork processes. If you'd like to use threads instead you can pass `with: :threads` to the `parallelize` method. Note the threaded parallelization does not create multiple database and will not work with system tests at this time. parallelize(workers: 2, with: :threads) The threaded parallelization uses Minitest's parallel exector directly. The processes paralleliztion uses a Ruby Drb server. For parallelization via threads a setup hook and cleanup hook are provided. ``` class ActiveSupport::TestCase parallelize_setup do |worker| # setup databases end parallelize_teardown do |worker| # cleanup database end parallelize(workers: 2) end ``` [Eileen M. Uchitelle, Aaron Patterson]
* Don't overwrite config/master.key even on --forceclaudiob2018-02-122-2/+5
| | | | | | | | | | | | See https://github.com/rails/rails/pull/31957#issuecomment-364817423 The purpose of `--force` is not to have any prompt whether a file should be kept or overwritten. In general, all existing files should be overwritten. However, `config/master.key` is special because it is git-ignored, and overwriting it will cause the app not to run (since there won't be a way to decrypt the credentials). As a result, it's probably better to keep the existing config/master.key.
* Do not update `load_defaults` version when running `app:update` (#31951)Yuji Yaginuma2018-02-134-2/+26
| | | | | Incompatible settings are included in the settings set by `load_defaults`. So, I think that target version should be updated by a user when becomes available, and should not be updated with `app:update`.
* Respect --force option for config/master.keyclaudiob2018-02-112-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is similar to #30700 which ensures the `--quiet` option of `rails new` is respected by the `MasterKeyGenerator` (missing from #30067). Before this commit, running `rails new app --force` would still prompt the user what to do with the conflict in `config/master.key`: ``` … identical config/locales/en.yml conflict config/master.key Overwrite /Users/claudiob/Desktop/pizza/config/master.key? (enter "h" for help) [Ynaqdh] ``` After this commit, `config/master.key` is overwritten: ``` … identical config/locales/en.yml force config/master.key append .gitignore ``` The newly added test generates an app and then generates it again with `--force`. Without this commit, the test would just wait forever for user input.
* Merge pull request #31949 from rails/remove-moveClaudio B2018-02-091-2/+0
|\ | | | | Remove warning from 4 years ago [ci skip]
| * Remove warning from 4 years ago [ci skip]claudiob2018-02-091-2/+0
| | | | | | | | | | `config/initializers/assets.rb` has been a part of Rails apps since Rails 4.2 (30b56084). This comment is probably unnecessary by now.
* | Use heredoc with credentials templateYoshiyuki Hirano2018-02-092-4/+16
|/ | | | | * Use heredoc with credentials template. * Fix indentation for aws config
* Do not add master key when `RAILS_MASTER_KEY` env specified (#31922)Yuji Yaginuma2018-02-084-2/+27
| | | Fixes #31917
* Add nodoc to `CredentialsGenerator` and `MasterKeyGenerator` [ci skip]yuuji.yaginuma2018-02-032-2/+2
| | | | These classes are internally used only.
* Removed "private" generators from command list.Wojciech Wnętrzak2018-02-023-18/+5
| | | | | | | | | | | | | | | | | | | | Appropriate way to handle encrypted command is by `bin/rails credentials` and `bin/rails encrypted` It was displayed on `bin/rails generate` command: ``` Please choose a generator below. Rails: application_record assets channel controller encrypted_file encryption_key_file generator ... ```
* Fix `RuntimeError: Unknown version "6.0"`Yuji Yaginuma2018-01-311-0/+3
|
* Start Rails 6.0 development!!!Rafael Mendonça França2018-01-302-165/+4
| | | | :tada::tada::tada:
* Merge pull request #31830 from rafaelfranca/disable-csp-by-defaultRafael França2018-01-301-10/+10
|\ | | | | Disable CSP by default
| * Disable CSP by defaultRafael Mendonça França2018-01-301-10/+10
| | | | | | | | | | | | | | | | Before this patch, to be able to use webpacker and webconsole we were defining an used default in the script-src policy. White we don't implement the automatic nonce approach defined in https://github.com/rails/rails/issues/31689 it is better to not have any default configuration in Rails 5.2.
* | Add Rack::TempfileReaper to tests and docsGeorge Claghorn2018-01-301-2/+4
| |
* | Add Rack::TempfileReaper to the default middleware stackGeorge Claghorn2018-01-301-0/+1
|/
* Merge pull request #31769 from justjake/patch-2Matthew Draper2018-01-301-1/+1
|\ | | | | | | yarnpkg: correct exec syntax
| * yarnpkg: correct exec syntaxJake Teton-Landis2018-01-231-1/+2
| | | | | | Previous change didn’t expand this array of arguments
* | Remove extra whitespaceDaniel Colson2018-01-252-7/+7
| |
* | Use assert_empty and assert_not_emptyDaniel Colson2018-01-251-1/+1
| |
* | Use assert_predicate and assert_not_predicateDaniel Colson2018-01-2511-39/+39
| |
* | Change refute to assert_notDaniel Colson2018-01-251-1/+1
| |
* | Use respond_to test helpersDaniel Colson2018-01-253-5/+5
| |
* | Merge pull request #31750 from morygonzalez/consider-locale_selector-missingYuji Yaginuma2018-01-231-5/+16
|\ \ | |/ |/| Fix locale_selector JS bug in ActionMailer Preview
| * Fix locale_selector JS bug in ActionMailer PreviewHitoshi Nakashima2018-01-231-5/+16
| |
* | bin/yarn: Pass through arguments with spacesJake Teton-Landis2018-01-211-1/+1
|/ | | | | | Previously, the `bin/yarn` wrapper would "unquote" arguments to yarn like this: `yarn run add-copyright "(c) 2017, 2018 MyCompany"` That results in an ARGV of ['run', 'add-copyright', '(c) 2017, 2018 MyCompany'] in the yarn wrapper, but a ARGV in the yarn executable of ['run', 'add-copyright', '(c)', '2017,', '2018', MyCompany']
* 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.
* | Merge pull request #31732 from ↵Matthew Draper2018-01-191-2/+2
|\ \ | | | | | | | | | | | | koic/enable_autocorrect_for_lint_end_alignment_cop Enable autocorrect for `Lint/EndAlignment` cop
| * | Enable autocorrect for `Lint/EndAlignment` copKoichi ITO2018-01-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary This PR changes .rubocop.yml. Regarding the code using `if ... else ... end`, I think the coding style that Rails expects is as follows. ```ruby var = if cond a else b end ``` However, the current .rubocop.yml setting does not offense for the following code. ```ruby var = if cond a else b end ``` I think that the above code expects offense to be warned. Moreover, the layout by autocorrect is unnatural. ```ruby var = if cond a else b end ``` This PR adds a setting to .rubocop.yml to make an offense warning and autocorrect as expected by the coding style. And this change also fixes `case ... when ... end` together. Also this PR itself is an example that arranges the layout using `rubocop -a`. ### Other Information Autocorrect of `Lint/EndAlignment` cop is `false` by default. https://github.com/bbatsov/rubocop/blob/v0.51.0/config/default.yml#L1443 This PR changes this value to `true`. Also this PR has changed it together as it is necessary to enable `Layout/ElseAlignment` cop to make this behavior.
* | | Add locale selector to email preview (#31596)Hitoshi Nakashima2018-01-183-18/+97
| | | | | | | | | | | | - Add set_locale to detect suitable locale - Make feature compatible with Rails 5.x
* | | Merge pull request #31730 from ↵Eileen M. Uchitelle2018-01-181-1/+1
|\ \ \ | | | | | | | | | | | | | | | | bogdanvlviv/allow_false_for-config-generators-system_tests Allow `false` for `config.generators.system_tests=`
| * | | Allow `false` for `config.generators.system_tests=`bogdanvlviv2018-01-181-1/+1
| |/ / | | | | | | | | | | | | Mention `config.generators.system_tests` in the "Configuring Rails Applications" guide.
* | | Add test to properly test down with a blockeileencodes2018-01-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | down is only called with a block from the rake tasks where it passes a `SCOPE`. Technically this was tested but since we don't run all the migrations we're not actually testing the down works with a `SCOPE`. To ensure we're testing both we can run `db:migrate` again to migrate users and then run `down` with a scope to test that only the bukkits migration is reverted. Updates test to prevent having to fix regressions like we did in 4d4db4c.
* | | Revert "Merge pull request #31434 from olivierlacan/boot-feedback"Matthew Draper2018-01-191-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit edc54fd2068bc21f0d381228e55d97e32f508923, reversing changes made to a5922f132f4d163e2c7f770427087f5268c18def. As discussed, this is not an appropriate place to make assumptions about ARGV, or to write to stdout: config/boot.rb is a library and is required by other applictions, with which we have no right to interfere.
* | | Refactor migration to move migrations paths to connectioneileencodes2018-01-183-2/+14
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails has some support for multiple databases but it can be hard to handle migrations with those. The easiest way to implement multiple databases is to contain migrations into their own folder ("db/migrate" for the primary db and "db/seconddb_migrate" for the second db). Without this you would need to write code that allowed you to switch connections in migrations. I can tell you from experience that is not a fun way to implement multiple databases. This refactoring is a pre-requisite for implementing other features related to parallel testing and improved handling for multiple databases. The refactoring here moves the class methods from the `Migrator` class into it's own new class `MigrationContext`. The goal was to move the `migrations_paths` method off of the `Migrator` class and onto the connection. This allows users to do the following in their `database.yml`: ``` development: adapter: mysql2 username: root password: development_seconddb: adapter: mysql2 username: root password: migrations_paths: "db/second_db_migrate" ``` Migrations for the `seconddb` can now be store in the `db/second_db_migrate` directory. Migrations for the primary database are stored in `db/migrate`". The refactoring here drastically reduces the internal API for migrations since we don't need to pass `migrations_paths` around to every single method. Additionally this change does not require any Rails applications to make changes unless they want to use the new public API. All of the class methods from the `Migrator` class were `nodoc`'d except for the `migrations_paths` and `migrations_path` getter/setters respectively.
* | Provide a sensible default hostGeorge Claghorn2018-01-161-2/+0
| |