From 86b489e3d6a9efbefbc62e8531d0f5850934d4e1 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Wed, 9 Jan 2019 08:09:51 -0500 Subject: Move all npm packages to @rails scope Fixes #33083 --- .../rails/app/templates/app/javascript/channels/consumer.js | 2 +- .../rails/app/templates/app/javascript/packs/application.js.tt | 4 ++-- railties/lib/rails/generators/rails/app/templates/package.json.tt | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'railties/lib/rails/generators') diff --git a/railties/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js b/railties/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js index 76ca3d0f2f..eec7e54b8a 100644 --- a/railties/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +++ b/railties/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js @@ -1,6 +1,6 @@ // Action Cable provides the framework to deal with WebSockets in Rails. // You can generate new channels where WebSocket features live using the `rails generate channel` command. -import ActionCable from "actioncable" +import ActionCable from "@rails/actioncable" export default ActionCable.createConsumer() diff --git a/railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt b/railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt index 4d7a145cd6..de91713546 100644 --- a/railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +++ b/railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt @@ -3,7 +3,7 @@ // a relevant structure within app/javascript and only use these pack files to reference // that code so it'll be compiled. -import Rails from "rails-ujs" +import Rails from "@rails/ujs" Rails.start() <%- unless options[:skip_turbolinks] -%> @@ -12,7 +12,7 @@ Turbolinks.start() <%- end -%> <%- unless skip_active_storage? -%> -import * as ActiveStorage from "activestorage" +import * as ActiveStorage from "@rails/activestorage" ActiveStorage.start() <%- end -%> <%- unless options[:skip_action_cable] -%> diff --git a/railties/lib/rails/generators/rails/app/templates/package.json.tt b/railties/lib/rails/generators/rails/app/templates/package.json.tt index 7174116989..07207e1747 100644 --- a/railties/lib/rails/generators/rails/app/templates/package.json.tt +++ b/railties/lib/rails/generators/rails/app/templates/package.json.tt @@ -2,10 +2,10 @@ "name": "<%= app_name %>", "private": true, "dependencies": { - "rails-ujs": ">=5.2.1"<% unless options[:skip_turbolinks] %>, - "turbolinks": "5.1.1"<% end -%><% unless skip_active_storage? %>, - "activestorage": ">=5.2.1"<% end -%><% unless options[:skip_action_cable] %>, - "actioncable": ">=5.2.1"<% end %> + "@rails/ujs": "^6.0.0-alpha"<% unless options[:skip_turbolinks] %>, + "turbolinks": "^5.2.0"<% end -%><% unless skip_active_storage? %>, + "@rails/activestorage": "^6.0.0-alpha"<% end -%><% unless options[:skip_action_cable] %>, + "@rails/actioncable": "^6.0.0-alpha"<% end %> }, "version": "0.1.0" } -- cgit v1.2.3 From f897263768f01ba8d5351806431ebe25d9c9283c Mon Sep 17 00:00:00 2001 From: okuramasafumi Date: Fri, 11 Jan 2019 13:35:40 +0900 Subject: Replace `secrets` with `credentials` in comments In comments in templates for `config/database.yml`, there is a reference to `secrets.yml` which is now deprecated. They should be replaced with `credentials.yml` so that everyone using latest Rails can understand. --- .../generators/rails/app/templates/config/databases/frontbase.yml.tt | 2 +- .../rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt | 2 +- .../rails/generators/rails/app/templates/config/databases/jdbc.yml.tt | 2 +- .../generators/rails/app/templates/config/databases/jdbcmysql.yml.tt | 2 +- .../rails/app/templates/config/databases/jdbcpostgresql.yml.tt | 2 +- .../rails/generators/rails/app/templates/config/databases/mysql.yml.tt | 2 +- .../rails/generators/rails/app/templates/config/databases/oracle.yml.tt | 2 +- .../generators/rails/app/templates/config/databases/postgresql.yml.tt | 2 +- .../generators/rails/app/templates/config/databases/sqlserver.yml.tt | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'railties/lib/rails/generators') diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt index 33f422c622..6ab4a26084 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt @@ -24,7 +24,7 @@ test: <<: *default database: <%= app_name %>_test -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt index 681c765e93..e422aa31fc 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt @@ -60,7 +60,7 @@ test: <<: *default database: <%= app_name[0,4] %>_tst -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt index af69f12059..678455c622 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt @@ -54,7 +54,7 @@ test: <<: *default url: jdbc:db://localhost/<%= app_name %>_test -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt index f39593372c..b5a0efef47 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt @@ -27,7 +27,7 @@ test: <<: *default database: <%= app_name %>_test -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt index 2383fe97d3..009a81a6b8 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt @@ -43,7 +43,7 @@ test: <<: *default database: <%= app_name %>_test -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt index b6c2e7448a..386eb511e5 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt @@ -32,7 +32,7 @@ test: <<: *default database: <%= app_name %>_test -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt index 8d9d33ba6c..f7b6dfafab 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt @@ -33,7 +33,7 @@ test: <<: *default database: <%= app_name %>_test -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt index 2f51030756..44dafbd0c0 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt @@ -59,7 +59,7 @@ test: <<: *default database: <%= app_name %>_test -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt index 0246fb0d02..27e8f2f35d 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt @@ -26,7 +26,7 @@ test: <<: *default database: <%= app_name %>_test -# As with config/secrets.yml, you never want to store sensitive information, +# As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # -- cgit v1.2.3 From 3f6449f4bf928a4adeb99dfb1bd146aab069cdee Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Thu, 10 Jan 2019 13:54:13 +0000 Subject: Add info about `config.action_mailer.delivery_job` to the guide [ci skip] Also, add mention to `new_framework_defaults_6_0.rb` that `ActionMailer::Parameterized::DeliveryJob` is default for parameterized mail and will be removed. Related to #34692 --- .../templates/config/initializers/new_framework_defaults_6_0.rb.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails/generators') diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt index a3aca27500..d25552e923 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt @@ -25,8 +25,8 @@ # Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail. # -# The default delivery job (ActionMailer::DeliveryJob), will be removed in Rails 6.1. -# This setting is not backwards compatible with earlier Rails versions. +# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob), +# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions. # If you send mail in the background, job workers need to have a copy of # MailDeliveryJob to ensure all delivery jobs are processed properly. # Make sure your entire app is migrated and stable on 6.0 before using this setting. -- cgit v1.2.3 From fc95836f8776b708ac30e4f1b83cc2a3cddfa77d Mon Sep 17 00:00:00 2001 From: Vladimir Dementyev Date: Sun, 13 Jan 2019 22:53:46 -0500 Subject: Add connection_test to app generator --- railties/lib/rails/generators/rails/app/app_generator.rb | 2 ++ .../test/channels/application_cable/connection_test.rb.tt | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt (limited to 'railties/lib/rails/generators') diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 33002790d4..e777590be8 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -213,6 +213,7 @@ module Rails empty_directory_with_keep_file "test/helpers" empty_directory_with_keep_file "test/integration" + template "test/channels/application_cable/connection_test.rb" template "test/test_helper.rb" end @@ -440,6 +441,7 @@ module Rails if options[:skip_action_cable] remove_dir "app/javascript/channels" remove_dir "app/channels" + remove_dir "test/channels" end end diff --git a/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt b/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt new file mode 100644 index 0000000000..cc8337fc6d --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require "test_helper" + +class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase + # test "connects with cookies" do + # cookies.signed[:user_id] = 42 + # + # connect + # + # assert_equal connection.user_id, "42" + # end +end -- cgit v1.2.3 From a43052cbbcb4f6671cf16fa45c906984fe601fa0 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Wed, 16 Jan 2019 15:14:35 +0000 Subject: Remove `frozen_string_literal` from Action Cable's template files Related to 837f602fa1b3281113dac965a8ef96de3cac8b02 Fix the testing guide. --- .../app/templates/test/channels/application_cable/connection_test.rb.tt | 2 -- 1 file changed, 2 deletions(-) (limited to 'railties/lib/rails/generators') diff --git a/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt b/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt index cc8337fc6d..800405f15e 100644 --- a/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require "test_helper" class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase -- cgit v1.2.3