1. 05 10月, 2018 2 次提交
  2. 04 10月, 2018 1 次提交
  3. 03 10月, 2018 1 次提交
  4. 01 10月, 2018 1 次提交
    • D
      Make Webpacker the default JavaScript compiler for Rails 6 (#33079) · 4838c171
      David Heinemeier Hansson 提交于
      * 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
      4838c171
  5. 29 9月, 2018 3 次提交
    • Y
      Add `Style/RedundantFreeze` to remove redudant `.freeze` · aa3dcabd
      Yasuo Honda 提交于
      Since Rails 6.0 will support Ruby 2.4.1 or higher
      `# frozen_string_literal: true` magic comment is enough to make string object frozen.
      This magic comment is enabled by `Style/FrozenStringLiteralComment` cop.
      
      * Exclude these files not to auto correct false positive `Regexp#freeze`
       - 'actionpack/lib/action_dispatch/journey/router/utils.rb'
       - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb'
      
      It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333
      Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed.
      
      * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required
      
       - 'actionpack/test/controller/test_case_test.rb'
       - 'activemodel/test/cases/type/string_test.rb'
       - 'activesupport/lib/active_support/core_ext/string/strip.rb'
       - 'activesupport/test/core_ext/string_ext_test.rb'
       - 'railties/test/generators/actions_test.rb'
      aa3dcabd
    • Y
      445a74e1
    • G
      4775d3d0
  6. 27 9月, 2018 3 次提交
  7. 26 9月, 2018 1 次提交
  8. 24 9月, 2018 1 次提交
    • E
      Eagerly define attribute methods in production · 3b954786
      Eugene Kenny 提交于
      The attribute methods for a model are currently defined lazily the first
      time that model is instantiated, even when `config.eager_load` is true.
      This means the first request to use each model incurs the cost, which
      usually involves a database round trip to fetch the schema definition.
      
      By defining the attribute methods for all models while the application
      is booting, we move that work out of any individual request. When using
      a forking web server, this also reduces the number of times the schema
      definition is queried by doing it once in the parent process instead of
      from each forked process during their first request.
      3b954786
  9. 23 9月, 2018 2 次提交
    • S
      Remove private def · 0fe2bb81
      Sakshi Jain 提交于
      0fe2bb81
    • Y
      Enable `Performance/UnfreezeString` cop · 1b86d901
      yuuji.yaginuma 提交于
      In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`.
      
      ```ruby
      # frozen_string_literal: true
      
      require "bundler/inline"
      
      gemfile(true) do
        source "https://rubygems.org"
      
        gem "benchmark-ips"
      end
      
      Benchmark.ips do |x|
        x.report('+@') { +"" }
        x.report('dup') { "".dup }
        x.compare!
      end
      ```
      
      ```
      $ ruby -v benchmark.rb
      ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
      Warming up --------------------------------------
                        +@   282.289k i/100ms
                       dup   187.638k i/100ms
      Calculating -------------------------------------
                        +@      6.775M (± 3.6%) i/s -     33.875M in   5.006253s
                       dup      3.320M (± 2.2%) i/s -     16.700M in   5.032125s
      
      Comparison:
                        +@:  6775299.3 i/s
                       dup:  3320400.7 i/s - 2.04x  slower
      
      ```
      1b86d901
  10. 22 9月, 2018 1 次提交
    • R
      Make sure this test check the issue solved in #31135 · d3b95218
      Rafael Mendonça França 提交于
      Before this change this test was passing even if we revert #31135. The
      reason for that is that `app 'development'` will load the environment in
      the test process and it is happening before db_create_and_drop is
      called.
      
      This was not asserting that the environment was loaded in the db:create
      task itself.
      
      To test it we enhance the db:create task with a block that writes to a
      tmp file the value of the config. If the environment is loaded before
      that task enhancement runs the content of the file will have "true"
      insteand of "false".
      d3b95218
  11. 21 9月, 2018 2 次提交
    • S
      Switch to supports_cache_versioning? check to a class method · 3424bd83
      schneems 提交于
      - Moving the `supports_cache_versioning?` check to a class method. 
      - Shorten the method doc. 
      - Expand on the error message.
      3424bd83
    • S
      [close #33907] Error when using "recyclable" cache keys with a store that does not support it · 135d3e15
      schneems 提交于
      If you are using the "in cache versioning" also known as "recyclable cache keys" the cache store must be aware of this scheme, otherwise you will generate cache entries that never invalidate.
      
      This PR adds a check to the initialization process to ensure that if recyclable cache keys are being used via 
      
      ```
      config.active_record.cache_versioning = true
      ```
      
      Then the cache store needs to show that it supports this versioning scheme. Cache stores can let Rails know that they support this scheme by adding a method `supports_in_cache_versioning?` and returning true.
      135d3e15
  12. 20 9月, 2018 3 次提交
  13. 15 9月, 2018 1 次提交
  14. 14 9月, 2018 2 次提交
  15. 13 9月, 2018 2 次提交
    • Y
      Validate if `utf8mb4` character set and longer index key prefix is supported · be021a80
      Yasuo Honda 提交于
      Once #33608 merged If users create a new database using MySQL 5.1.x, it will fail to create databases
      since MySQL 5.1 does not know `utf8mb4` character set.
      
      This pull request removes `encoding: utf8mb4` from `mysql.yml.tt`
      to let create_database method handles default character set by MySQL server version.
      
      `supports_longer_index_key_prefix?` method will need to validate if MySQL 5.5 and 5.6 server configured
      correctly to support longer index key prefix, but not yet.
      be021a80
    • R
      Add a test that exercice better the behavior we expect in the query cache · a8359d83
      Rafael Mendonça França 提交于
      In production the query cache was already being loaded before the first
      request even without #33856, so added a test to make sure of it.
      
      This new test is passing even if #33856 is reverted.
      a8359d83
  16. 12 9月, 2018 5 次提交
  17. 11 9月, 2018 2 次提交
  18. 08 9月, 2018 1 次提交
    • K
      Run yarn install relative to Rails.root · f443aac3
      Kevin Dew 提交于
      We may not always have binstubs relative to the directory we are running
      the rake task from. The particular case for this is with a mountable
      Rails engine and dummy app that is created to test it. This sets all the
      tasks up to run under an `app` namespace in
      railties/lib/rails/tasks/engine.rake
      
      This change resolves a problem whereby running `app:yarn:install` would
      have no effect as it would try to run in the plugins bin directory
      rather than the test/dummy/bin. This also means that it installs from
      test/dummy/package.json and into test/dummy/node_modules which is
      behaviour consistent with a normal Rails app.
      
      On a rails engine:
      
      ```
      ➜  tmp rails plugin new rails-plugin --mountable
      ➜  tmp cd rails-plugin
      ```
      
      Before this change:
      
      ```
      ➜  rails-plugin rake app:yarn:install
      ➜  rails-plugin
      ```
      
      After this change:
      
      ```
      ➜  rails-plugin rake app:yarn:install
      yarn install v1.9.4
      info No lockfile found.
      [1/4] 🔍  Resolving packages...
      [2/4] 🚚  Fetching packages...
      [3/4] 🔗  Linking dependencies...
      [4/4] 📃  Building fresh packages...
        Done in 0.07s.
      ```
      
      When this change is ran against a normal rails install there is not a
      behavioural change:
      
      ```
      ➜  tmp rails new full-app
      ➜  tmp cd full-app
      ➜  full-app git:(master) ✗ rake yarn:install
      yarn install v1.9.4
      info No lockfile found.
      [1/4] 🔍  Resolving packages...
      [2/4] 🚚  Fetching packages...
      [3/4] 🔗  Linking dependencies...
      [4/4] 📃  Building fresh packages...
        Done in 0.09s.
      ```
      f443aac3
  19. 07 9月, 2018 4 次提交
  20. 04 9月, 2018 2 次提交