railties 5.1.7 → 5.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +77 -241
- data/RDOC_MAIN.rdoc +61 -43
- data/README.rdoc +1 -2
- data/exe/rails +3 -2
- data/lib/minitest/rails_plugin.rb +9 -13
- data/lib/rails.rb +4 -2
- data/lib/rails/all.rb +3 -0
- data/lib/rails/api/generator.rb +10 -1
- data/lib/rails/api/task.rb +11 -1
- data/lib/rails/app_loader.rb +18 -5
- data/lib/rails/app_updater.rb +34 -0
- data/lib/rails/application.rb +90 -18
- data/lib/rails/application/bootstrap.rb +2 -0
- data/lib/rails/application/configuration.rb +79 -36
- data/lib/rails/application/default_middleware_stack.rb +7 -1
- data/lib/rails/application/finisher.rb +3 -1
- data/lib/rails/application/routes_reloader.rb +21 -3
- data/lib/rails/application_controller.rb +3 -1
- data/lib/rails/backtrace_cleaner.rb +3 -1
- data/lib/rails/cli.rb +2 -0
- data/lib/rails/code_statistics.rb +2 -0
- data/lib/rails/code_statistics_calculator.rb +2 -0
- data/lib/rails/command.rb +3 -1
- data/lib/rails/command/actions.rb +6 -4
- data/lib/rails/command/base.rb +5 -3
- data/lib/rails/command/behavior.rb +2 -0
- data/lib/rails/command/environment_argument.rb +14 -1
- data/lib/rails/command/helpers/editor.rb +35 -0
- data/lib/rails/commands.rb +2 -0
- data/lib/rails/commands/application/application_command.rb +2 -0
- data/lib/rails/commands/console/console_command.rb +2 -3
- data/lib/rails/commands/credentials/USAGE +40 -0
- data/lib/rails/commands/credentials/credentials_command.rb +72 -0
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +18 -7
- data/lib/rails/commands/destroy/destroy_command.rb +2 -0
- data/lib/rails/commands/encrypted/encrypted_command.rb +77 -0
- data/lib/rails/commands/generate/generate_command.rb +2 -0
- data/lib/rails/commands/help/help_command.rb +2 -0
- data/lib/rails/commands/new/new_command.rb +2 -0
- data/lib/rails/commands/plugin/plugin_command.rb +2 -0
- data/lib/rails/commands/rake/rake_command.rb +2 -0
- data/lib/rails/commands/runner/USAGE +3 -0
- data/lib/rails/commands/runner/runner_command.rb +7 -3
- data/lib/rails/commands/secrets/secrets_command.rb +15 -10
- data/lib/rails/commands/server/server_command.rb +24 -3
- data/lib/rails/commands/test/test_command.rb +18 -23
- data/lib/rails/commands/version/version_command.rb +2 -0
- data/lib/rails/configuration.rb +2 -0
- data/lib/rails/console/app.rb +2 -0
- data/lib/rails/console/helpers.rb +2 -0
- data/lib/rails/dev_caching.rb +2 -1
- data/lib/rails/engine.rb +3 -1
- data/lib/rails/engine/commands.rb +2 -0
- data/lib/rails/engine/configuration.rb +2 -0
- data/lib/rails/engine/railties.rb +2 -0
- data/lib/rails/engine/updater.rb +3 -1
- data/lib/rails/gem_version.rb +5 -3
- data/lib/rails/generators.rb +8 -3
- data/lib/rails/generators/actions.rb +53 -24
- data/lib/rails/generators/actions/create_migration.rb +2 -0
- data/lib/rails/generators/active_model.rb +2 -0
- data/lib/rails/generators/app_base.rb +94 -57
- data/lib/rails/generators/base.rb +40 -1
- data/lib/rails/generators/css/assets/assets_generator.rb +3 -1
- data/lib/rails/generators/css/scaffold/scaffold_generator.rb +5 -3
- data/lib/rails/generators/erb.rb +2 -0
- data/lib/rails/generators/erb/controller/controller_generator.rb +2 -0
- data/lib/rails/generators/erb/controller/templates/{view.html.erb → view.html.erb.tt} +0 -0
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +2 -0
- data/lib/rails/generators/erb/mailer/templates/{view.html.erb → view.html.erb.tt} +0 -0
- data/lib/rails/generators/erb/mailer/templates/{view.text.erb → view.text.erb.tt} +0 -0
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -0
- data/lib/rails/generators/erb/scaffold/templates/{_form.html.erb → _form.html.erb.tt} +4 -4
- data/lib/rails/generators/erb/scaffold/templates/{edit.html.erb → edit.html.erb.tt} +0 -0
- data/lib/rails/generators/erb/scaffold/templates/{index.html.erb → index.html.erb.tt} +4 -4
- data/lib/rails/generators/erb/scaffold/templates/{new.html.erb → new.html.erb.tt} +0 -0
- data/lib/rails/generators/erb/scaffold/templates/{show.html.erb → show.html.erb.tt} +0 -0
- data/lib/rails/generators/generated_attribute.rb +3 -1
- data/lib/rails/generators/js/assets/assets_generator.rb +3 -1
- data/lib/rails/generators/migration.rb +2 -0
- data/lib/rails/generators/model_helpers.rb +2 -0
- data/lib/rails/generators/named_base.rb +35 -45
- data/lib/rails/generators/rails/app/app_generator.rb +64 -23
- data/lib/rails/generators/rails/app/templates/{Gemfile → Gemfile.tt} +17 -6
- data/lib/rails/generators/rails/app/templates/{README.md → README.md.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/{Rakefile → Rakefile.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +3 -0
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/{cable.js → cable.js.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/{application.css → application.css.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/{channel.rb → channel.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/{connection.rb → connection.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +1 -4
- data/lib/rails/generators/rails/app/templates/app/helpers/{application_helper.rb → application_helper.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/app/jobs/{application_job.rb → application_job.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/app/mailers/{application_mailer.rb → application_mailer.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/app/models/{application_record.rb → application_record.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/bin/bundle.tt +2 -0
- data/lib/rails/generators/rails/app/templates/bin/{rails → rails.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/bin/{rake → rake.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +5 -5
- data/lib/rails/generators/rails/app/templates/bin/update.tt +7 -3
- data/lib/rails/generators/rails/app/templates/bin/{yarn → yarn.tt} +3 -3
- data/lib/rails/generators/rails/app/templates/{config.ru → config.ru.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/{application.rb → application.rb.tt} +2 -1
- data/lib/rails/generators/rails/app/templates/config/{boot.rb → boot.rb.tt} +1 -0
- data/lib/rails/generators/rails/app/templates/config/{cable.yml → cable.yml.tt} +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/{frontbase.yml → frontbase.yml.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/databases/{ibm_db.yml → ibm_db.yml.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/databases/{jdbc.yml → jdbc.yml.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/databases/{jdbcmysql.yml → jdbcmysql.yml.tt} +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/{jdbcpostgresql.yml → jdbcpostgresql.yml.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/databases/{jdbcsqlite3.yml → jdbcsqlite3.yml.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/databases/{mysql.yml → mysql.yml.tt} +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/{oracle.yml → oracle.yml.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/databases/{postgresql.yml → postgresql.yml.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/databases/{sqlite3.yml → sqlite3.yml.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/databases/{sqlserver.yml → sqlserver.yml.tt} +2 -2
- data/lib/rails/generators/rails/app/templates/config/{environment.rb → environment.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +7 -1
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +12 -7
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +8 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/{application_controller_renderer.rb → application_controller_renderer.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/{backtrace_silencers.rb → backtrace_silencers.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +20 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/{cookies_serializer.rb → cookies_serializer.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/{cors.rb → cors.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/{filter_parameter_logging.rb → filter_parameter_logging.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/{inflections.rb → inflections.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/{mime_types.rb → mime_types.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt +27 -0
- data/lib/rails/generators/rails/app/templates/config/{puma.rb → puma.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/{routes.rb → routes.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/config/{spring.rb → spring.rb.tt} +2 -2
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +35 -0
- data/lib/rails/generators/rails/app/templates/{gitignore → gitignore.tt} +9 -1
- data/lib/rails/generators/rails/app/templates/{package.json → package.json.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/ruby-version.tt +1 -0
- data/lib/rails/generators/rails/app/templates/test/{application_system_test_case.rb → application_system_test_case.rb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/test/{test_helper.rb → test_helper.rb.tt} +1 -2
- data/lib/rails/generators/rails/application_record/application_record_generator.rb +9 -0
- data/lib/rails/generators/rails/assets/assets_generator.rb +2 -0
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +1 -1
- data/lib/rails/generators/rails/controller/controller_generator.rb +11 -9
- data/lib/rails/generators/rails/controller/templates/{controller.rb → controller.rb.tt} +0 -0
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +48 -0
- data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +38 -0
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +57 -0
- data/lib/rails/generators/rails/generator/generator_generator.rb +2 -0
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
- data/lib/rails/generators/rails/helper/helper_generator.rb +2 -0
- data/lib/rails/generators/rails/helper/templates/{helper.rb → helper.rb.tt} +0 -0
- data/lib/rails/generators/rails/integration_test/integration_test_generator.rb +2 -0
- data/lib/rails/generators/rails/master_key/master_key_generator.rb +51 -0
- data/lib/rails/generators/rails/migration/migration_generator.rb +2 -0
- data/lib/rails/generators/rails/model/model_generator.rb +2 -0
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +18 -9
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +24 -0
- data/lib/rails/generators/rails/plugin/templates/{Gemfile → Gemfile.tt} +1 -0
- data/lib/rails/generators/rails/plugin/templates/{MIT-LICENSE → MIT-LICENSE.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/{README.md → README.md.tt} +1 -1
- data/lib/rails/generators/rails/plugin/templates/{Rakefile → Rakefile.tt} +6 -7
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +21 -4
- data/lib/rails/generators/rails/plugin/templates/bin/test.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/config/{routes.rb → routes.rb.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +18 -0
- data/lib/rails/generators/rails/plugin/templates/lib/{%namespaced_name%.rb → %namespaced_name%.rb.tt} +3 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/{engine.rb → engine.rb.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/railtie.rb.tt +5 -0
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/{version.rb → version.rb.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/lib/tasks/{%namespaced_name%_tasks.rake → %namespaced_name%_tasks.rake.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/rails/{application.rb → application.rb.tt} +6 -3
- data/lib/rails/generators/rails/plugin/templates/rails/{boot.rb → boot.rb.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/rails/{dummy_manifest.js → dummy_manifest.js.tt} +0 -1
- data/lib/rails/generators/rails/plugin/templates/rails/{engine_manifest.js → engine_manifest.js.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/rails/{javascripts.js → javascripts.js.tt} +3 -0
- data/lib/rails/generators/rails/plugin/templates/rails/{routes.rb → routes.rb.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/test/{%namespaced_name%_test.rb → %namespaced_name%_test.rb.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/test/{application_system_test_case.rb → application_system_test_case.rb.tt} +0 -0
- data/lib/rails/generators/rails/plugin/templates/test/integration/{navigation_test.rb → navigation_test.rb.tt} +0 -1
- data/lib/rails/generators/rails/plugin/templates/test/{test_helper.rb → test_helper.rb.tt} +7 -6
- data/lib/rails/generators/rails/resource/USAGE +1 -1
- data/lib/rails/generators/rails/resource/resource_generator.rb +2 -0
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +21 -24
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -3
- data/lib/rails/generators/rails/scaffold_controller/USAGE +1 -1
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +2 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/{api_controller.rb → api_controller.rb.tt} +0 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/{controller.rb → controller.rb.tt} +2 -2
- data/lib/rails/generators/rails/system_test/system_test_generator.rb +2 -0
- data/lib/rails/generators/rails/task/task_generator.rb +2 -0
- data/lib/rails/generators/rails/task/templates/{task.rb → task.rb.tt} +0 -0
- data/lib/rails/generators/resource_helpers.rb +2 -0
- data/lib/rails/generators/test_case.rb +4 -2
- data/lib/rails/generators/test_unit.rb +2 -0
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
- data/lib/rails/generators/test_unit/controller/templates/{functional_test.rb → functional_test.rb.tt} +0 -0
- data/lib/rails/generators/test_unit/generator/generator_generator.rb +2 -0
- data/lib/rails/generators/test_unit/generator/templates/{generator_test.rb → generator_test.rb.tt} +0 -0
- data/lib/rails/generators/test_unit/helper/helper_generator.rb +2 -0
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +2 -0
- data/lib/rails/generators/test_unit/integration/templates/{integration_test.rb → integration_test.rb.tt} +0 -0
- data/lib/rails/generators/test_unit/job/job_generator.rb +3 -1
- data/lib/rails/generators/test_unit/job/templates/{unit_test.rb.erb → unit_test.rb.tt} +0 -0
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +2 -0
- data/lib/rails/generators/test_unit/mailer/templates/{functional_test.rb → functional_test.rb.tt} +0 -0
- data/lib/rails/generators/test_unit/mailer/templates/{preview.rb → preview.rb.tt} +0 -0
- data/lib/rails/generators/test_unit/model/model_generator.rb +2 -0
- data/lib/rails/generators/test_unit/model/templates/{fixtures.yml → fixtures.yml.tt} +0 -0
- data/lib/rails/generators/test_unit/model/templates/{unit_test.rb → unit_test.rb.tt} +0 -0
- data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +2 -0
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +17 -4
- data/lib/rails/generators/test_unit/scaffold/templates/{api_functional_test.rb → api_functional_test.rb.tt} +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/{functional_test.rb → functional_test.rb.tt} +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +49 -0
- data/lib/rails/generators/test_unit/system/system_generator.rb +3 -1
- data/lib/rails/generators/test_unit/system/templates/{application_system_test_case.rb → application_system_test_case.rb.tt} +0 -0
- data/lib/rails/generators/test_unit/system/templates/{system_test.rb → system_test.rb.tt} +0 -0
- data/lib/rails/generators/testing/assertions.rb +7 -1
- data/lib/rails/generators/testing/behaviour.rb +8 -6
- data/lib/rails/generators/testing/setup_and_teardown.rb +2 -0
- data/lib/rails/info.rb +6 -3
- data/lib/rails/info_controller.rb +2 -0
- data/lib/rails/initializable.rb +2 -0
- data/lib/rails/mailers_controller.rb +9 -1
- data/lib/rails/paths.rb +2 -0
- data/lib/rails/plugin/test.rb +4 -2
- data/lib/rails/rack.rb +2 -0
- data/lib/rails/rack/logger.rb +5 -3
- data/lib/rails/railtie.rb +9 -4
- data/lib/rails/railtie/configurable.rb +2 -0
- data/lib/rails/railtie/configuration.rb +2 -0
- data/lib/rails/ruby_version_check.rb +3 -1
- data/lib/rails/secrets.rb +2 -17
- data/lib/rails/source_annotation_extractor.rb +4 -2
- data/lib/rails/tasks.rb +2 -0
- data/lib/rails/tasks/annotations.rake +2 -0
- data/lib/rails/tasks/dev.rake +2 -0
- data/lib/rails/tasks/engine.rake +7 -2
- data/lib/rails/tasks/framework.rake +9 -24
- data/lib/rails/tasks/initializers.rake +2 -0
- data/lib/rails/tasks/log.rake +2 -0
- data/lib/rails/tasks/middleware.rake +2 -0
- data/lib/rails/tasks/misc.rake +2 -0
- data/lib/rails/tasks/restart.rake +2 -1
- data/lib/rails/tasks/routes.rake +2 -0
- data/lib/rails/tasks/statistics.rake +2 -0
- data/lib/rails/tasks/tmp.rake +11 -2
- data/lib/rails/tasks/yarn.rake +3 -1
- data/lib/rails/templates/rails/mailers/email.html.erb +3 -3
- data/lib/rails/templates/rails/welcome/index.html.erb +14 -4
- data/lib/rails/test_help.rb +2 -0
- data/lib/rails/test_unit/line_filtering.rb +2 -1
- data/lib/rails/test_unit/railtie.rb +2 -0
- data/lib/rails/test_unit/reporter.rb +5 -10
- data/lib/rails/test_unit/runner.rb +3 -3
- data/lib/rails/test_unit/testing.rake +3 -1
- data/lib/rails/version.rb +2 -0
- data/lib/rails/welcome_controller.rb +2 -0
- metadata +121 -107
- data/lib/rails/generators/rails/app/templates/bin/bundle +0 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_1.rb.tt +0 -16
- data/lib/rails/generators/rails/app/templates/config/secrets.yml +0 -32
- data/lib/rails/generators/rails/encrypted_secrets/encrypted_secrets_generator.rb +0 -70
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec +0 -33
- data/lib/rails/generators/rails/plugin/templates/gitignore +0 -9
@@ -0,0 +1,35 @@
|
|
1
|
+
test:
|
2
|
+
service: Disk
|
3
|
+
root: <%%= Rails.root.join("tmp/storage") %>
|
4
|
+
|
5
|
+
local:
|
6
|
+
service: Disk
|
7
|
+
root: <%%= Rails.root.join("storage") %>
|
8
|
+
|
9
|
+
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
10
|
+
# amazon:
|
11
|
+
# service: S3
|
12
|
+
# access_key_id: <%%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
13
|
+
# secret_access_key: <%%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
14
|
+
# region: us-east-1
|
15
|
+
# bucket: your_own_bucket
|
16
|
+
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
18
|
+
# google:
|
19
|
+
# service: GCS
|
20
|
+
# project: your_project
|
21
|
+
# keyfile: <%%= Rails.root.join("path/to/gcs.keyfile") %>
|
22
|
+
# bucket: your_own_bucket
|
23
|
+
|
24
|
+
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
25
|
+
# microsoft:
|
26
|
+
# service: AzureStorage
|
27
|
+
# path: your_azure_storage_path
|
28
|
+
# storage_account_name: your_account_name
|
29
|
+
# storage_access_key: <%%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
30
|
+
# container: your_container_name
|
31
|
+
|
32
|
+
# mirror:
|
33
|
+
# service: Mirror
|
34
|
+
# primary: local
|
35
|
+
# mirrors: [ amazon, google, microsoft ]
|
@@ -21,9 +21,17 @@
|
|
21
21
|
!/tmp/.keep
|
22
22
|
<% end -%>
|
23
23
|
|
24
|
-
<% unless
|
24
|
+
<% unless skip_active_storage? -%>
|
25
|
+
# Ignore uploaded files in development
|
26
|
+
/storage/*
|
27
|
+
|
28
|
+
<% end -%>
|
29
|
+
<% unless options.skip_yarn? -%>
|
25
30
|
/node_modules
|
26
31
|
/yarn-error.log
|
27
32
|
|
33
|
+
<% end -%>
|
34
|
+
<% unless options.api? -%>
|
35
|
+
/public/assets
|
28
36
|
<% end -%>
|
29
37
|
.byebug_history
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= RUBY_VERSION -%>
|
File without changes
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Rails
|
2
4
|
module Generators
|
3
5
|
class ControllerGenerator < NamedBase # :nodoc:
|
@@ -13,12 +15,8 @@ module Rails
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def add_routes
|
16
|
-
|
17
|
-
|
18
|
-
# route prepends two spaces onto the front of the string that is passed, this corrects that.
|
19
|
-
route indent(generate_routing_code(action), 2)[2..-1]
|
20
|
-
end
|
21
|
-
end
|
18
|
+
return if options[:skip_routes]
|
19
|
+
route generate_routing_code
|
22
20
|
end
|
23
21
|
|
24
22
|
hook_for :template_engine, :test_framework, :helper, :assets
|
@@ -26,14 +24,15 @@ module Rails
|
|
26
24
|
private
|
27
25
|
|
28
26
|
# This method creates nested route entry for namespaced resources.
|
29
|
-
# For eg. rails g controller foo/bar/baz index
|
27
|
+
# For eg. rails g controller foo/bar/baz index show
|
30
28
|
# Will generate -
|
31
29
|
# namespace :foo do
|
32
30
|
# namespace :bar do
|
33
31
|
# get 'baz/index'
|
32
|
+
# get 'baz/show'
|
34
33
|
# end
|
35
34
|
# end
|
36
|
-
def generate_routing_code
|
35
|
+
def generate_routing_code
|
37
36
|
depth = 0
|
38
37
|
lines = []
|
39
38
|
|
@@ -47,7 +46,10 @@ module Rails
|
|
47
46
|
|
48
47
|
# Create route
|
49
48
|
# get 'baz/index'
|
50
|
-
|
49
|
+
# get 'baz/show'
|
50
|
+
actions.each do |action|
|
51
|
+
lines << indent(%{get '#{file_name}/#{action}'\n}, depth * 2)
|
52
|
+
end
|
51
53
|
|
52
54
|
# Create `end` ladder
|
53
55
|
# end
|
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/base"
|
4
|
+
require "rails/generators/rails/master_key/master_key_generator"
|
5
|
+
require "active_support/encrypted_configuration"
|
6
|
+
|
7
|
+
module Rails
|
8
|
+
module Generators
|
9
|
+
class CredentialsGenerator < Base
|
10
|
+
def add_credentials_file
|
11
|
+
unless credentials.exist?
|
12
|
+
template = credentials_template
|
13
|
+
|
14
|
+
say "Adding #{credentials.content_path} to store encrypted credentials."
|
15
|
+
say ""
|
16
|
+
say "The following content has been encrypted with the Rails master key:"
|
17
|
+
say ""
|
18
|
+
say template, :on_green
|
19
|
+
say ""
|
20
|
+
|
21
|
+
add_credentials_file_silently(template)
|
22
|
+
|
23
|
+
say "You can edit encrypted credentials with `bin/rails credentials:edit`."
|
24
|
+
say ""
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_credentials_file_silently(template = nil)
|
29
|
+
credentials.write(credentials_template)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def credentials
|
34
|
+
ActiveSupport::EncryptedConfiguration.new(
|
35
|
+
config_path: "config/credentials.yml.enc",
|
36
|
+
key_path: "config/master.key",
|
37
|
+
env_key: "RAILS_MASTER_KEY"
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def credentials_template
|
42
|
+
"# aws:\n# access_key_id: 123\n# secret_access_key: 345\n\n" +
|
43
|
+
"# Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.\n" +
|
44
|
+
"secret_key_base: #{SecureRandom.hex(64)}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/base"
|
4
|
+
require "active_support/encrypted_file"
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module Generators
|
8
|
+
class EncryptedFileGenerator < Base
|
9
|
+
def add_encrypted_file(file_path, key_path)
|
10
|
+
unless File.exist?(file_path)
|
11
|
+
say "Adding #{file_path} to store encrypted content."
|
12
|
+
say ""
|
13
|
+
say "The following content has been encrypted with the encryption key:"
|
14
|
+
say ""
|
15
|
+
say template, :on_green
|
16
|
+
say ""
|
17
|
+
|
18
|
+
add_encrypted_file_silently(file_path, key_path)
|
19
|
+
|
20
|
+
say "You can edit encrypted file with `bin/rails encrypted:edit #{file_path}`."
|
21
|
+
say ""
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_encrypted_file_silently(file_path, key_path, template = encrypted_file_template)
|
26
|
+
unless File.exist?(file_path)
|
27
|
+
setup = { content_path: file_path, key_path: key_path, env_key: "RAILS_MASTER_KEY" }
|
28
|
+
ActiveSupport::EncryptedFile.new(setup).write(template)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def encrypted_file_template
|
34
|
+
"# aws:\n# access_key_id: 123\n# secret_access_key: 345\n\n"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require "rails/generators/base"
|
5
|
+
require "active_support/encrypted_file"
|
6
|
+
|
7
|
+
module Rails
|
8
|
+
module Generators
|
9
|
+
class EncryptionKeyFileGenerator < Base
|
10
|
+
def add_key_file(key_path)
|
11
|
+
key_path = Pathname.new(key_path)
|
12
|
+
|
13
|
+
unless key_path.exist?
|
14
|
+
key = ActiveSupport::EncryptedFile.generate_key
|
15
|
+
|
16
|
+
log "Adding #{key_path} to store the encryption key: #{key}"
|
17
|
+
log ""
|
18
|
+
log "Save this in a password manager your team can access."
|
19
|
+
log ""
|
20
|
+
log "If you lose the key, no one, including you, can access anything encrypted with it."
|
21
|
+
|
22
|
+
log ""
|
23
|
+
add_key_file_silently(key_path, key)
|
24
|
+
log ""
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_key_file_silently(key_path, key = nil)
|
29
|
+
create_file key_path, key || ActiveSupport::EncryptedFile.generate_key
|
30
|
+
end
|
31
|
+
|
32
|
+
def ignore_key_file(key_path, ignore: key_ignore(key_path))
|
33
|
+
if File.exist?(".gitignore")
|
34
|
+
unless File.read(".gitignore").include?(ignore)
|
35
|
+
log "Ignoring #{key_path} so it won't end up in Git history:"
|
36
|
+
log ""
|
37
|
+
append_to_file ".gitignore", ignore
|
38
|
+
log ""
|
39
|
+
end
|
40
|
+
else
|
41
|
+
log "IMPORTANT: Don't commit #{key_path}. Add this to your ignore file:"
|
42
|
+
log ignore, :on_green
|
43
|
+
log ""
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def ignore_key_file_silently(key_path, ignore: key_ignore(key_path))
|
48
|
+
append_to_file ".gitignore", ignore if File.exist?(".gitignore")
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def key_ignore(key_path)
|
53
|
+
[ "", "/#{key_path}", "" ].join("\n")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
File without changes
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require "rails/generators/base"
|
5
|
+
require "rails/generators/rails/encryption_key_file/encryption_key_file_generator"
|
6
|
+
require "active_support/encrypted_file"
|
7
|
+
|
8
|
+
module Rails
|
9
|
+
module Generators
|
10
|
+
class MasterKeyGenerator < Base
|
11
|
+
MASTER_KEY_PATH = Pathname.new("config/master.key")
|
12
|
+
|
13
|
+
def add_master_key_file
|
14
|
+
unless MASTER_KEY_PATH.exist?
|
15
|
+
key = ActiveSupport::EncryptedFile.generate_key
|
16
|
+
|
17
|
+
log "Adding #{MASTER_KEY_PATH} to store the master encryption key: #{key}"
|
18
|
+
log ""
|
19
|
+
log "Save this in a password manager your team can access."
|
20
|
+
log ""
|
21
|
+
log "If you lose the key, no one, including you, can access anything encrypted with it."
|
22
|
+
|
23
|
+
log ""
|
24
|
+
add_master_key_file_silently(key)
|
25
|
+
log ""
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_master_key_file_silently(key = nil)
|
30
|
+
key_file_generator.add_key_file_silently(MASTER_KEY_PATH, key)
|
31
|
+
end
|
32
|
+
|
33
|
+
def ignore_master_key_file
|
34
|
+
key_file_generator.ignore_key_file(MASTER_KEY_PATH, ignore: key_ignore)
|
35
|
+
end
|
36
|
+
|
37
|
+
def ignore_master_key_file_silently
|
38
|
+
key_file_generator.ignore_key_file_silently(MASTER_KEY_PATH, ignore: key_ignore)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def key_file_generator
|
43
|
+
EncryptionKeyFileGenerator.new([], options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def key_ignore
|
47
|
+
[ "", "# Ignore master key for decrypting credentials and more.", "/#{MASTER_KEY_PATH}", "" ].join("\n")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "rails/generators/rails/app/app_generator"
|
3
4
|
require "date"
|
4
5
|
|
@@ -60,7 +61,12 @@ module Rails
|
|
60
61
|
template "lib/%namespaced_name%.rb"
|
61
62
|
template "lib/tasks/%namespaced_name%_tasks.rake"
|
62
63
|
template "lib/%namespaced_name%/version.rb"
|
63
|
-
|
64
|
+
|
65
|
+
if engine?
|
66
|
+
template "lib/%namespaced_name%/engine.rb"
|
67
|
+
else
|
68
|
+
template "lib/%namespaced_name%/railtie.rb"
|
69
|
+
end
|
64
70
|
end
|
65
71
|
|
66
72
|
def config
|
@@ -71,8 +77,8 @@ module Rails
|
|
71
77
|
template "test/test_helper.rb"
|
72
78
|
template "test/%namespaced_name%_test.rb"
|
73
79
|
append_file "Rakefile", <<-EOF
|
74
|
-
#{rakefile_test_tasks}
|
75
80
|
|
81
|
+
#{rakefile_test_tasks}
|
76
82
|
task default: :test
|
77
83
|
EOF
|
78
84
|
if engine?
|
@@ -81,18 +87,18 @@ task default: :test
|
|
81
87
|
end
|
82
88
|
|
83
89
|
PASSTHROUGH_OPTIONS = [
|
84
|
-
:skip_active_record, :skip_action_mailer, :skip_javascript, :skip_sprockets, :database,
|
85
|
-
:javascript, :
|
90
|
+
:skip_active_record, :skip_active_storage, :skip_action_mailer, :skip_javascript, :skip_action_cable, :skip_sprockets, :database,
|
91
|
+
:javascript, :skip_yarn, :api, :quiet, :pretend, :skip
|
86
92
|
]
|
87
93
|
|
88
94
|
def generate_test_dummy(force = false)
|
89
|
-
opts = (options || {}).
|
95
|
+
opts = (options.dup || {}).keep_if { |k, _| PASSTHROUGH_OPTIONS.map(&:to_s).include?(k) }
|
90
96
|
opts[:force] = force
|
91
97
|
opts[:skip_bundle] = true
|
92
|
-
opts[:api] = options.api?
|
93
98
|
opts[:skip_listen] = true
|
94
99
|
opts[:skip_git] = true
|
95
100
|
opts[:skip_turbolinks] = true
|
101
|
+
opts[:dummy_app] = true
|
96
102
|
|
97
103
|
invoke Rails::Generators::AppGenerator,
|
98
104
|
[ File.expand_path(dummy_path, destination_root) ], opts
|
@@ -115,7 +121,6 @@ task default: :test
|
|
115
121
|
def test_dummy_clean
|
116
122
|
inside dummy_path do
|
117
123
|
remove_file "db/seeds.rb"
|
118
|
-
remove_file "doc"
|
119
124
|
remove_file "Gemfile"
|
120
125
|
remove_file "lib/tasks"
|
121
126
|
remove_file "public/robots.txt"
|
@@ -162,7 +167,7 @@ task default: :test
|
|
162
167
|
|
163
168
|
gemfile_in_app_path = File.join(rails_app_path, "Gemfile")
|
164
169
|
if File.exist? gemfile_in_app_path
|
165
|
-
entry = "
|
170
|
+
entry = "\ngem '#{name}', path: '#{relative_path}'"
|
166
171
|
append_file gemfile_in_app_path, entry
|
167
172
|
end
|
168
173
|
end
|
@@ -258,6 +263,10 @@ task default: :test
|
|
258
263
|
public_task :apply_rails_template
|
259
264
|
|
260
265
|
def run_after_bundle_callbacks
|
266
|
+
unless @after_bundle_callbacks.empty?
|
267
|
+
ActiveSupport::Deprecation.warn("`after_bundle` is deprecated and will be removed in the next version of Rails. ")
|
268
|
+
end
|
269
|
+
|
261
270
|
@after_bundle_callbacks.each do |callback|
|
262
271
|
callback.call
|
263
272
|
end
|