From 08e50cf9859298f184d95ab0c6f442d4b928be26 Mon Sep 17 00:00:00 2001 From: "Andrew W. Lee" Date: Fri, 24 Jun 2022 06:17:27 -0700 Subject: [PATCH 01/11] Get CI to a working state (#959) * Update to rubocop 1.12.x for newer ruby support * fix: remove deprecated warnings from Bundler * fix: ruby warnings about MAGIC_COMMENTS already defined * fix: Gemfile.lock for integration tests Co-authored-by: Andy Allan Co-authored-by: Cuong Tran --- .github/workflows/ci.yml | 10 +- .github/workflows/codeql-analysis.yml | 12 +- .rubocop.yml | 5 + .rubocop_todo.yml | 422 +++++++++++++++--- .tool-versions | 2 +- .travis.yml | 38 -- Gemfile | 9 +- spec/integration/integration_helper.rb | 27 -- spec/integration/rails_5.2.4.1/.gitignore | 31 -- spec/integration/rails_5.2.4.1/Gemfile | 59 --- spec/integration/rails_5.2.4.1/Gemfile.lock | 214 --------- spec/integration/rails_5.2.4.1/README.md | 24 - spec/integration/rails_5.2.4.1/Rakefile | 6 - .../app/assets/config/manifest.js | 3 - .../rails_5.2.4.1/app/assets/images/.keep | 0 .../app/assets/javascripts/application.js | 16 - .../app/assets/javascripts/cable.js | 13 - .../app/assets/javascripts/channels/.keep | 0 .../app/assets/stylesheets/application.css | 15 - .../app/channels/application_cable/channel.rb | 4 - .../channels/application_cable/connection.rb | 4 - .../app/controllers/application_controller.rb | 2 - .../app/controllers/concerns/.keep | 0 .../app/helpers/application_helper.rb | 2 - .../rails_5.2.4.1/app/jobs/application_job.rb | 2 - .../app/mailers/application_mailer.rb | 4 - .../app/models/application_record.rb | 3 - .../rails_5.2.4.1/app/models/concerns/.keep | 0 .../rails_5.2.4.1/app/models/task.rb | 2 - .../app/views/layouts/application.html.erb | 15 - .../app/views/layouts/mailer.html.erb | 13 - .../app/views/layouts/mailer.text.erb | 1 - spec/integration/rails_5.2.4.1/bin/bundle | 3 - spec/integration/rails_5.2.4.1/bin/rails | 4 - spec/integration/rails_5.2.4.1/bin/rake | 4 - spec/integration/rails_5.2.4.1/bin/setup | 36 -- spec/integration/rails_5.2.4.1/bin/update | 31 -- spec/integration/rails_5.2.4.1/bin/yarn | 11 - spec/integration/rails_5.2.4.1/config.ru | 5 - .../rails_5.2.4.1/config/application.rb | 19 - spec/integration/rails_5.2.4.1/config/boot.rb | 4 - .../rails_5.2.4.1/config/cable.yml | 10 - .../rails_5.2.4.1/config/credentials.yml.enc | 1 - .../rails_5.2.4.1/config/database.yml | 25 -- .../rails_5.2.4.1/config/environment.rb | 5 - .../config/environments/development.rb | 61 --- .../config/environments/production.rb | 94 ---- .../rails_5.2.4.1/config/environments/test.rb | 46 -- .../application_controller_renderer.rb | 8 - .../config/initializers/assets.rb | 14 - .../initializers/backtrace_silencers.rb | 7 - .../initializers/content_security_policy.rb | 25 -- .../config/initializers/cookies_serializer.rb | 5 - .../initializers/filter_parameter_logging.rb | 4 - .../config/initializers/inflections.rb | 16 - .../config/initializers/mime_types.rb | 4 - .../config/initializers/wrap_parameters.rb | 14 - .../rails_5.2.4.1/config/locales/en.yml | 33 -- spec/integration/rails_5.2.4.1/config/puma.rb | 37 -- .../rails_5.2.4.1/config/routes.rb | 4 - .../rails_5.2.4.1/config/spring.rb | 6 - .../rails_5.2.4.1/config/storage.yml | 34 -- .../db/migrate/20200204052946_create_tasks.rb | 11 - spec/integration/rails_5.2.4.1/db/schema.rb | 23 - spec/integration/rails_5.2.4.1/db/seeds.rb | 7 - .../rails_5.2.4.1/lib/assets/.keep | 0 .../integration/rails_5.2.4.1/lib/tasks/.keep | 0 spec/integration/rails_5.2.4.1/log/.keep | 0 spec/integration/rails_5.2.4.1/package.json | 5 - .../integration/rails_5.2.4.1/public/404.html | 67 --- .../integration/rails_5.2.4.1/public/422.html | 67 --- .../integration/rails_5.2.4.1/public/500.html | 66 --- .../public/apple-touch-icon-precomposed.png | 0 .../rails_5.2.4.1/public/apple-touch-icon.png | 0 .../rails_5.2.4.1/public/favicon.ico | 0 .../rails_5.2.4.1/public/robots.txt | 1 - spec/integration/rails_5.2.4.1/storage/.keep | 0 .../test/application_system_test_case.rb | 5 - .../rails_5.2.4.1/test/controllers/.keep | 0 .../rails_5.2.4.1/test/fixtures/.keep | 0 .../rails_5.2.4.1/test/fixtures/files/.keep | 0 .../rails_5.2.4.1/test/fixtures/tasks.yml | 11 - .../rails_5.2.4.1/test/helpers/.keep | 0 .../rails_5.2.4.1/test/integration/.keep | 0 .../rails_5.2.4.1/test/mailers/.keep | 0 .../rails_5.2.4.1/test/models/.keep | 0 .../rails_5.2.4.1/test/models/task_test.rb | 7 - .../rails_5.2.4.1/test/system/.keep | 0 .../rails_5.2.4.1/test/test_helper.rb | 10 - spec/integration/rails_5.2.4.1/tmp/.keep | 0 spec/integration/rails_5.2.4.1/vendor/.keep | 0 spec/integration/rails_5.2.4.1_spec.rb | 171 ------- spec/integration/rails_6.0.2.1/.gitignore | 36 -- spec/integration/rails_6.0.2.1/.keep | 0 spec/integration/rails_6.0.2.1/.rubocop.yml | 1 - .../rails_6.0.2.1/.rubocop_todo.yml | 156 ------- spec/integration/rails_6.0.2.1/Gemfile | 45 -- spec/integration/rails_6.0.2.1/Gemfile.lock | 205 --------- spec/integration/rails_6.0.2.1/README.md | 24 - spec/integration/rails_6.0.2.1/Rakefile | 6 - .../app/assets/config/manifest.js | 2 - .../rails_6.0.2.1/app/assets/images/.keep | 0 .../app/assets/stylesheets/application.css | 15 - .../app/channels/application_cable/channel.rb | 4 - .../channels/application_cable/connection.rb | 4 - .../app/controllers/application_controller.rb | 2 - .../app/controllers/concerns/.keep | 0 .../app/helpers/application_helper.rb | 2 - .../rails_6.0.2.1/app/jobs/application_job.rb | 7 - .../app/mailers/application_mailer.rb | 4 - .../app/models/application_record.rb | 3 - .../rails_6.0.2.1/app/models/concerns/.keep | 0 .../rails_6.0.2.1/app/models/task.rb | 2 - .../app/views/layouts/application.html.erb | 14 - .../app/views/layouts/mailer.html.erb | 13 - .../app/views/layouts/mailer.text.erb | 1 - spec/integration/rails_6.0.2.1/bin/bundle | 105 ----- spec/integration/rails_6.0.2.1/bin/rails | 4 - spec/integration/rails_6.0.2.1/bin/rake | 4 - spec/integration/rails_6.0.2.1/bin/setup | 33 -- spec/integration/rails_6.0.2.1/config.ru | 5 - .../rails_6.0.2.1/config/application.rb | 33 -- spec/integration/rails_6.0.2.1/config/boot.rb | 4 - .../rails_6.0.2.1/config/cable.yml | 10 - .../rails_6.0.2.1/config/credentials.yml.enc | 1 - .../rails_6.0.2.1/config/database.yml | 25 -- .../rails_6.0.2.1/config/environment.rb | 5 - .../config/environments/development.rb | 55 --- .../config/environments/production.rb | 106 ----- .../rails_6.0.2.1/config/environments/test.rb | 48 -- .../application_controller_renderer.rb | 8 - .../initializers/backtrace_silencers.rb | 7 - .../initializers/content_security_policy.rb | 28 -- .../config/initializers/cookies_serializer.rb | 5 - .../initializers/filter_parameter_logging.rb | 4 - .../config/initializers/inflections.rb | 16 - .../config/initializers/mime_types.rb | 4 - .../config/initializers/wrap_parameters.rb | 14 - .../rails_6.0.2.1/config/locales/en.yml | 33 -- .../rails_6.0.2.1/config/multi-database.yml | 37 -- spec/integration/rails_6.0.2.1/config/puma.rb | 38 -- .../rails_6.0.2.1/config/routes.rb | 4 - .../rails_6.0.2.1/config/storage.yml | 34 -- .../db/migrate/20200201204456_create_tasks.rb | 11 - spec/integration/rails_6.0.2.1/db/schema.rb | 23 - spec/integration/rails_6.0.2.1/db/seeds.rb | 7 - .../rails_6.0.2.1/lib/assets/.keep | 0 .../integration/rails_6.0.2.1/lib/tasks/.keep | 0 spec/integration/rails_6.0.2.1/log/.keep | 0 .../integration/rails_6.0.2.1/public/404.html | 67 --- .../integration/rails_6.0.2.1/public/422.html | 67 --- .../integration/rails_6.0.2.1/public/500.html | 66 --- .../public/apple-touch-icon-precomposed.png | 0 .../rails_6.0.2.1/public/apple-touch-icon.png | 0 .../rails_6.0.2.1/public/favicon.ico | 0 .../rails_6.0.2.1/public/robots.txt | 1 - spec/integration/rails_6.0.2.1/storage/.keep | 0 .../test/application_system_test_case.rb | 5 - .../application_cable/connection_test.rb | 11 - .../rails_6.0.2.1/test/controllers/.keep | 0 .../rails_6.0.2.1/test/fixtures/.keep | 0 .../rails_6.0.2.1/test/fixtures/files/.keep | 0 .../rails_6.0.2.1/test/fixtures/tasks.yml | 11 - .../rails_6.0.2.1/test/helpers/.keep | 0 .../rails_6.0.2.1/test/integration/.keep | 0 .../rails_6.0.2.1/test/mailers/.keep | 0 .../rails_6.0.2.1/test/models/.keep | 0 .../rails_6.0.2.1/test/models/task_test.rb | 7 - .../rails_6.0.2.1/test/system/.keep | 0 .../rails_6.0.2.1/test/test_helper.rb | 13 - spec/integration/rails_6.0.2.1/tmp/.keep | 0 spec/integration/rails_6.0.2.1/vendor/.keep | 0 spec/integration/rails_6.0.2.1_spec.rb | 200 --------- spec/lib/annotate/annotate_models_spec.rb | 2 +- spec/lib/annotate/annotate_routes_spec.rb | 2 +- 175 files changed, 375 insertions(+), 3313 deletions(-) delete mode 100644 .travis.yml delete mode 100644 spec/integration/integration_helper.rb delete mode 100644 spec/integration/rails_5.2.4.1/.gitignore delete mode 100644 spec/integration/rails_5.2.4.1/Gemfile delete mode 100644 spec/integration/rails_5.2.4.1/Gemfile.lock delete mode 100644 spec/integration/rails_5.2.4.1/README.md delete mode 100644 spec/integration/rails_5.2.4.1/Rakefile delete mode 100644 spec/integration/rails_5.2.4.1/app/assets/config/manifest.js delete mode 100644 spec/integration/rails_5.2.4.1/app/assets/images/.keep delete mode 100644 spec/integration/rails_5.2.4.1/app/assets/javascripts/application.js delete mode 100644 spec/integration/rails_5.2.4.1/app/assets/javascripts/cable.js delete mode 100644 spec/integration/rails_5.2.4.1/app/assets/javascripts/channels/.keep delete mode 100644 spec/integration/rails_5.2.4.1/app/assets/stylesheets/application.css delete mode 100644 spec/integration/rails_5.2.4.1/app/channels/application_cable/channel.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/channels/application_cable/connection.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/controllers/application_controller.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/controllers/concerns/.keep delete mode 100644 spec/integration/rails_5.2.4.1/app/helpers/application_helper.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/jobs/application_job.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/mailers/application_mailer.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/models/application_record.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/models/concerns/.keep delete mode 100644 spec/integration/rails_5.2.4.1/app/models/task.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/views/layouts/application.html.erb delete mode 100644 spec/integration/rails_5.2.4.1/app/views/layouts/mailer.html.erb delete mode 100644 spec/integration/rails_5.2.4.1/app/views/layouts/mailer.text.erb delete mode 100755 spec/integration/rails_5.2.4.1/bin/bundle delete mode 100755 spec/integration/rails_5.2.4.1/bin/rails delete mode 100755 spec/integration/rails_5.2.4.1/bin/rake delete mode 100755 spec/integration/rails_5.2.4.1/bin/setup delete mode 100755 spec/integration/rails_5.2.4.1/bin/update delete mode 100755 spec/integration/rails_5.2.4.1/bin/yarn delete mode 100644 spec/integration/rails_5.2.4.1/config.ru delete mode 100644 spec/integration/rails_5.2.4.1/config/application.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/boot.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/cable.yml delete mode 100644 spec/integration/rails_5.2.4.1/config/credentials.yml.enc delete mode 100644 spec/integration/rails_5.2.4.1/config/database.yml delete mode 100644 spec/integration/rails_5.2.4.1/config/environment.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/environments/development.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/environments/production.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/environments/test.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/application_controller_renderer.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/assets.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/backtrace_silencers.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/content_security_policy.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/cookies_serializer.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/filter_parameter_logging.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/inflections.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/mime_types.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/initializers/wrap_parameters.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/locales/en.yml delete mode 100644 spec/integration/rails_5.2.4.1/config/puma.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/routes.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/spring.rb delete mode 100644 spec/integration/rails_5.2.4.1/config/storage.yml delete mode 100644 spec/integration/rails_5.2.4.1/db/migrate/20200204052946_create_tasks.rb delete mode 100644 spec/integration/rails_5.2.4.1/db/schema.rb delete mode 100644 spec/integration/rails_5.2.4.1/db/seeds.rb delete mode 100644 spec/integration/rails_5.2.4.1/lib/assets/.keep delete mode 100644 spec/integration/rails_5.2.4.1/lib/tasks/.keep delete mode 100644 spec/integration/rails_5.2.4.1/log/.keep delete mode 100644 spec/integration/rails_5.2.4.1/package.json delete mode 100644 spec/integration/rails_5.2.4.1/public/404.html delete mode 100644 spec/integration/rails_5.2.4.1/public/422.html delete mode 100644 spec/integration/rails_5.2.4.1/public/500.html delete mode 100644 spec/integration/rails_5.2.4.1/public/apple-touch-icon-precomposed.png delete mode 100644 spec/integration/rails_5.2.4.1/public/apple-touch-icon.png delete mode 100644 spec/integration/rails_5.2.4.1/public/favicon.ico delete mode 100644 spec/integration/rails_5.2.4.1/public/robots.txt delete mode 100644 spec/integration/rails_5.2.4.1/storage/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/application_system_test_case.rb delete mode 100644 spec/integration/rails_5.2.4.1/test/controllers/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/fixtures/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/fixtures/files/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/fixtures/tasks.yml delete mode 100644 spec/integration/rails_5.2.4.1/test/helpers/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/integration/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/mailers/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/models/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/models/task_test.rb delete mode 100644 spec/integration/rails_5.2.4.1/test/system/.keep delete mode 100644 spec/integration/rails_5.2.4.1/test/test_helper.rb delete mode 100644 spec/integration/rails_5.2.4.1/tmp/.keep delete mode 100644 spec/integration/rails_5.2.4.1/vendor/.keep delete mode 100644 spec/integration/rails_5.2.4.1_spec.rb delete mode 100644 spec/integration/rails_6.0.2.1/.gitignore delete mode 100644 spec/integration/rails_6.0.2.1/.keep delete mode 100644 spec/integration/rails_6.0.2.1/.rubocop.yml delete mode 100644 spec/integration/rails_6.0.2.1/.rubocop_todo.yml delete mode 100644 spec/integration/rails_6.0.2.1/Gemfile delete mode 100644 spec/integration/rails_6.0.2.1/Gemfile.lock delete mode 100644 spec/integration/rails_6.0.2.1/README.md delete mode 100644 spec/integration/rails_6.0.2.1/Rakefile delete mode 100644 spec/integration/rails_6.0.2.1/app/assets/config/manifest.js delete mode 100644 spec/integration/rails_6.0.2.1/app/assets/images/.keep delete mode 100644 spec/integration/rails_6.0.2.1/app/assets/stylesheets/application.css delete mode 100644 spec/integration/rails_6.0.2.1/app/channels/application_cable/channel.rb delete mode 100644 spec/integration/rails_6.0.2.1/app/channels/application_cable/connection.rb delete mode 100644 spec/integration/rails_6.0.2.1/app/controllers/application_controller.rb delete mode 100644 spec/integration/rails_6.0.2.1/app/controllers/concerns/.keep delete mode 100644 spec/integration/rails_6.0.2.1/app/helpers/application_helper.rb delete mode 100644 spec/integration/rails_6.0.2.1/app/jobs/application_job.rb delete mode 100644 spec/integration/rails_6.0.2.1/app/mailers/application_mailer.rb delete mode 100644 spec/integration/rails_6.0.2.1/app/models/application_record.rb delete mode 100644 spec/integration/rails_6.0.2.1/app/models/concerns/.keep delete mode 100644 spec/integration/rails_6.0.2.1/app/models/task.rb delete mode 100644 spec/integration/rails_6.0.2.1/app/views/layouts/application.html.erb delete mode 100644 spec/integration/rails_6.0.2.1/app/views/layouts/mailer.html.erb delete mode 100644 spec/integration/rails_6.0.2.1/app/views/layouts/mailer.text.erb delete mode 100755 spec/integration/rails_6.0.2.1/bin/bundle delete mode 100755 spec/integration/rails_6.0.2.1/bin/rails delete mode 100755 spec/integration/rails_6.0.2.1/bin/rake delete mode 100755 spec/integration/rails_6.0.2.1/bin/setup delete mode 100644 spec/integration/rails_6.0.2.1/config.ru delete mode 100644 spec/integration/rails_6.0.2.1/config/application.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/boot.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/cable.yml delete mode 100644 spec/integration/rails_6.0.2.1/config/credentials.yml.enc delete mode 100644 spec/integration/rails_6.0.2.1/config/database.yml delete mode 100644 spec/integration/rails_6.0.2.1/config/environment.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/environments/development.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/environments/production.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/environments/test.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/initializers/application_controller_renderer.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/initializers/backtrace_silencers.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/initializers/content_security_policy.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/initializers/cookies_serializer.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/initializers/filter_parameter_logging.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/initializers/inflections.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/initializers/mime_types.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/initializers/wrap_parameters.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/locales/en.yml delete mode 100644 spec/integration/rails_6.0.2.1/config/multi-database.yml delete mode 100644 spec/integration/rails_6.0.2.1/config/puma.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/routes.rb delete mode 100644 spec/integration/rails_6.0.2.1/config/storage.yml delete mode 100644 spec/integration/rails_6.0.2.1/db/migrate/20200201204456_create_tasks.rb delete mode 100644 spec/integration/rails_6.0.2.1/db/schema.rb delete mode 100644 spec/integration/rails_6.0.2.1/db/seeds.rb delete mode 100644 spec/integration/rails_6.0.2.1/lib/assets/.keep delete mode 100644 spec/integration/rails_6.0.2.1/lib/tasks/.keep delete mode 100644 spec/integration/rails_6.0.2.1/log/.keep delete mode 100644 spec/integration/rails_6.0.2.1/public/404.html delete mode 100644 spec/integration/rails_6.0.2.1/public/422.html delete mode 100644 spec/integration/rails_6.0.2.1/public/500.html delete mode 100644 spec/integration/rails_6.0.2.1/public/apple-touch-icon-precomposed.png delete mode 100644 spec/integration/rails_6.0.2.1/public/apple-touch-icon.png delete mode 100644 spec/integration/rails_6.0.2.1/public/favicon.ico delete mode 100644 spec/integration/rails_6.0.2.1/public/robots.txt delete mode 100644 spec/integration/rails_6.0.2.1/storage/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/application_system_test_case.rb delete mode 100644 spec/integration/rails_6.0.2.1/test/channels/application_cable/connection_test.rb delete mode 100644 spec/integration/rails_6.0.2.1/test/controllers/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/fixtures/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/fixtures/files/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/fixtures/tasks.yml delete mode 100644 spec/integration/rails_6.0.2.1/test/helpers/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/integration/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/mailers/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/models/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/models/task_test.rb delete mode 100644 spec/integration/rails_6.0.2.1/test/system/.keep delete mode 100644 spec/integration/rails_6.0.2.1/test/test_helper.rb delete mode 100644 spec/integration/rails_6.0.2.1/tmp/.keep delete mode 100644 spec/integration/rails_6.0.2.1/vendor/.keep delete mode 100644 spec/integration/rails_6.0.2.1_spec.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 953cc7013..7f907097a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,11 +14,11 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.4', '2.5', '2.6'] + ruby: ['2.7'] steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Setup Ruby uses: ruby/setup-ruby@v1 @@ -26,12 +26,8 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Install sqlite - run: | - sudo apt-get install libsqlite3-dev - - name: Run Tests - run: INTEGRATION_TESTS=1 bundle exec rspec + run: bundle exec rspec - name: Rubocop run: bundle exec rubocop diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5ce6ec569..4764a47c4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -7,7 +7,7 @@ on: - scratch/* pull_request: schedule: - - cron: '0 20 * * 7' + - cron: '0 9 * * MON' jobs: CodeQL-Build: @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. @@ -29,15 +29,15 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 # Override language selection by uncommenting this and choosing your languages # with: - # languages: go, javascript, csharp, python, cpp, java + languages: ruby # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -51,4 +51,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.rubocop.yml b/.rubocop.yml index 0ee94770e..4d06aa989 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,17 @@ inherit_from: - .rubocop_todo.yml +require: + - rubocop-rake + - rubocop-rspec + AllCops: Exclude: - 'vendor/**/*' - 'spec/fixtures/**/*' - 'tmp/**/*' - 'spec/integration/**/*' + NewCops: enable Metrics/BlockLength: Exclude: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 246a23ea6..8d3c7701d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-04-06 10:26:11 +0900 using RuboCop version 0.68.1. +# on 2022-06-14 03:17:11 UTC using RuboCop version 1.12.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -8,7 +8,7 @@ # Offense count: 1 # Cop supports --auto-correct. -# Configuration parameters: TreatCommentsAsGroupSeparators, Include. +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. # Include: **/*.gemspec Gemspec/OrderedDependencies: Exclude: @@ -21,17 +21,6 @@ Gemspec/RequiredRubyVersion: Exclude: - 'annotate.gemspec' -# Offense count: 65 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. -# SupportedHashRocketStyles: key, separator, table -# SupportedColonStyles: key, separator, table -# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit -Layout/AlignHash: - Exclude: - - 'lib/generators/annotate/templates/auto_annotate_models.rake' - - 'spec/lib/annotate/annotate_models_spec.rb' - # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyleAlignWith. @@ -64,13 +53,24 @@ Layout/ExtraSpacing: - 'lib/annotate/annotate_models.rb' - 'lib/tasks/annotate_routes.rake' -# Offense count: 16 +# Offense count: 14 # Cop supports --auto-correct. # Configuration parameters: IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_brackets -Layout/IndentFirstArrayElement: +Layout/FirstArrayElementIndentation: EnforcedStyle: consistent +# Offense count: 65 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/HashAlignment: + Exclude: + - 'lib/generators/annotate/templates/auto_annotate_models.rake' + - 'spec/lib/annotate/annotate_models_spec.rb' + # Offense count: 5 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. @@ -89,7 +89,8 @@ Layout/SpaceAroundEqualsInParameterDefault: # Offense count: 4 # Cop supports --auto-correct. -# Configuration parameters: AllowForAlignment. +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# SupportedStylesForExponentOperator: space, no_space Layout/SpaceAroundOperators: Exclude: - 'lib/annotate/annotate_models.rb' @@ -136,7 +137,7 @@ Layout/SpaceInsideParens: Exclude: - 'lib/annotate/annotate_models.rb' -# Offense count: 2 +# Offense count: 4 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: space, no_space @@ -157,10 +158,13 @@ Lint/AssignmentInCondition: Exclude: - 'lib/annotate/annotate_models.rb' -# Offense count: 1 -Lint/HandleExceptions: +# Offense count: 7 +# Configuration parameters: AllowedMethods. +# AllowedMethods: enums +Lint/ConstantDefinitionInBlock: Exclude: - - 'bin/annotate' + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' # Offense count: 1 # Cop supports --auto-correct. @@ -186,13 +190,29 @@ Lint/ShadowingOuterLocalVariable: Exclude: - 'Rakefile' -# Offense count: 22 +# Offense count: 1 +# Configuration parameters: AllowComments, AllowNil. +Lint/SuppressedException: + Exclude: + - 'bin/annotate' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: strict, consistent +Lint/SymbolConversion: + Exclude: + - 'lib/annotate/annotate_models.rb' + - 'spec/lib/annotate/annotate_models_spec.rb' + +# Offense count: 20 +# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: - Max: 103 + Max: 155 # Offense count: 7 -# Configuration parameters: CountComments, ExcludedMethods. -# ExcludedMethods: refine +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# IgnoredMethods: refine Metrics/BlockLength: Max: 53 @@ -201,27 +221,29 @@ Metrics/BlockLength: Metrics/BlockNesting: Max: 4 -# Offense count: 12 +# Offense count: 16 +# Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: - Max: 25 + Max: 30 -# Offense count: 30 -# Configuration parameters: CountComments, ExcludedMethods. +# Offense count: 31 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 40 -# Offense count: 9 +# Offense count: 15 +# Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: - Max: 28 + Max: 33 # Offense count: 1 Naming/AccessorMethodName: Exclude: - 'lib/annotate.rb' -# Offense count: 103 -# Configuration parameters: Blacklist. -# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) +# Offense count: 105 +# Configuration parameters: ForbiddenDelimiters. +# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) Naming/HeredocDelimiterNaming: Exclude: - 'spec/lib/annotate/annotate_models_spec.rb' @@ -236,37 +258,253 @@ Naming/MemoizedInstanceVariableName: # Offense count: 1 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: io, id, to, by, on, in, at, ip, db -Naming/UncommunicativeMethodParamName: +# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: Exclude: - 'Rakefile' +# Offense count: 13 +# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers. +# SupportedStyles: snake_case, normalcase, non_integer +# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339 +Naming/VariableNumber: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/helpers_spec.rb' + +# Offense count: 1 +RSpec/BeforeAfterAll: + Exclude: + - 'spec/spec_helper.rb' + - 'spec/rails_helper.rb' + - 'spec/support/**/*.rb' + - 'spec/lib/annotate/annotate_models_spec.rb' + +# Offense count: 46 +# Configuration parameters: Prefixes. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + - 'spec/lib/annotate/parser_spec.rb' + +# Offense count: 1 +# Configuration parameters: IgnoredMetadata. +RSpec/DescribeClass: + Exclude: + - 'spec/lib/tasks/annotate_models_migrate_spec.rb' + +# Offense count: 149 +# Cop supports --auto-correct. +# Configuration parameters: SkipBlocks, EnforcedStyle. +# SupportedStyles: described_class, explicit +RSpec/DescribedClass: + Exclude: + - 'spec/lib/annotate/annotate_models/file_patterns_spec.rb' + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + - 'spec/lib/annotate/parser_spec.rb' + - 'spec/lib/annotate_spec.rb' + +# Offense count: 32 +# Cop supports --auto-correct. +RSpec/EmptyLineAfterFinalLet: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/helpers_spec.rb' + - 'spec/lib/annotate/parser_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +RSpec/EmptyLineAfterSubject: + Exclude: + - 'spec/lib/annotate/helpers_spec.rb' + +# Offense count: 14 +# Configuration parameters: Max. +RSpec/ExampleLength: + Exclude: + - 'spec/lib/annotate/annotate_models/file_patterns_spec.rb' + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/parser_spec.rb' + - 'spec/lib/tasks/annotate_models_migrate_spec.rb' + +# Offense count: 22 +# Cop supports --auto-correct. +# Configuration parameters: CustomTransform, IgnoredWords. +RSpec/ExampleWording: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + - 'spec/lib/tasks/annotate_models_migrate_spec.rb' + +# Offense count: 9 +RSpec/ExpectInHook: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, each, example +RSpec/HookArgument: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + - 'spec/lib/annotate/parser_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +RSpec/HooksBeforeExamples: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + +# Offense count: 78 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_line_only, single_statement_only, disallow +RSpec/ImplicitSubject: + Exclude: + - 'spec/lib/annotate/annotate_models/file_patterns_spec.rb' + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/helpers_spec.rb' + +# Offense count: 51 +# Configuration parameters: AssignmentOnly. +RSpec/InstanceVariable: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +RSpec/LeadingSubject: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + +# Offense count: 9 +RSpec/LeakyConstantDeclaration: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + +# Offense count: 108 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: have_received, receive +RSpec/MessageSpies: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + - 'spec/lib/annotate/helpers_spec.rb' + - 'spec/lib/annotate/parser_spec.rb' + - 'spec/lib/tasks/annotate_models_migrate_spec.rb' + +# Offense count: 36 +RSpec/MultipleExpectations: + Max: 4 + +# Offense count: 66 +# Configuration parameters: AllowSubject. +RSpec/MultipleMemoizedHelpers: + Max: 9 + +# Offense count: 6 +# Configuration parameters: IgnoreSharedExamples. +RSpec/NamedSubject: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/helpers_spec.rb' + - 'spec/lib/tasks/annotate_models_migrate_spec.rb' + +# Offense count: 140 +RSpec/NestedGroups: + Max: 9 + # Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: not_to, to_not +RSpec/NotToNot: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/helpers_spec.rb' + +# Offense count: 5 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/lib/tasks/annotate_models_migrate_spec.rb' + +# Offense count: 2 +RSpec/RepeatedExampleGroupDescription: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: and_return, block +RSpec/ReturnFromStub: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + +# Offense count: 7 +# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. +RSpec/VerifiedDoubles: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + +# Offense count: 16 +# Cop supports --auto-correct. +Rake/Desc: + Exclude: + - 'Rakefile' + - 'lib/generators/annotate/templates/auto_annotate_models.rake' + - 'lib/tasks/annotate_models.rake' + - 'lib/tasks/annotate_routes.rake' + +# Offense count: 6 +Rake/DuplicateTask: + Exclude: + - 'Rakefile' + - 'lib/tasks/annotate_models.rake' + - 'lib/tasks/annotate_routes.rake' + +# Offense count: 3 +# Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. -# SupportedStyles: inline, group -Style/AccessModifierDeclarations: +# SupportedStyles: separated, grouped +Style/AccessorGrouping: Exclude: - 'lib/annotate/annotate_models.rb' - - 'lib/annotate/annotate_routes/header_generator.rb' # Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowOnConstant. Style/CaseEquality: Exclude: - 'lib/annotate/annotate_models.rb' # Offense count: 1 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle. -# SupportedStyles: nested, compact -Style/ClassAndModuleChildren: +Style/CaseLikeIf: Exclude: - - 'lib/annotate/active_record_patch.rb' + - 'lib/annotate/annotate_routes.rb' # Offense count: 2 Style/ClassVars: Exclude: - 'lib/tasks/annotate_models_migrate.rake' +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: Keywords. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE +Style/CommentAnnotation: + Exclude: + - 'lib/annotate/annotate_models.rb' + # Offense count: 1 # Cop supports --auto-correct. Style/Dir: @@ -274,6 +512,7 @@ Style/Dir: - 'bin/annotate' # Offense count: 10 +# Configuration parameters: AllowedConstants. Style/Documentation: Exclude: - 'spec/**/*' @@ -309,17 +548,16 @@ Style/FormatString: Exclude: - 'lib/annotate/annotate_models.rb' -# Offense count: 23 -# Configuration parameters: EnforcedStyle. +# Offense count: 12 +# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods. # SupportedStyles: annotated, template, unannotated Style/FormatStringToken: - Exclude: - - 'lib/annotate/annotate_models.rb' + EnforcedStyle: unannotated # Offense count: 30 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. -# SupportedStyles: when_needed, always, never +# SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: Enabled: false @@ -329,6 +567,13 @@ Style/GuardClause: Exclude: - 'lib/tasks/annotate_models_migrate.rake' +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowSplatArgument. +Style/HashConversion: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + # Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. @@ -353,11 +598,6 @@ Style/InverseMethods: Exclude: - 'Rakefile' -# Offense count: 1 -Style/MethodMissingSuper: - Exclude: - - 'lib/annotate/active_record_patch.rb' - # Offense count: 1 Style/MissingRespondToMissing: Exclude: @@ -374,17 +614,30 @@ Style/MultilineBlockChain: - 'Rakefile' - 'lib/annotate/annotate_models.rb' +# Offense count: 2 +# Cop supports --auto-correct. +Style/MultilineIfModifier: + Exclude: + - 'spec/lib/annotate/annotate_models_spec.rb' + - 'spec/lib/annotate/annotate_routes_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/NegatedIfElseCondition: + Exclude: + - 'lib/annotate.rb' + # Offense count: 1 # Cop supports --auto-correct. -# Configuration parameters: Whitelist. -# Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with +# Configuration parameters: AllowedMethods. +# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with Style/NestedParenthesizedCalls: Exclude: - 'bin/annotate' # Offense count: 3 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# Configuration parameters: EnforcedStyle, IgnoredMethods. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: @@ -392,7 +645,7 @@ Style/NumericPredicate: - 'lib/annotate.rb' - 'lib/annotate/annotate_models.rb' -# Offense count: 12 +# Offense count: 13 # Cop supports --auto-correct. # Configuration parameters: PreferredDelimiters. Style/PercentLiteralDelimiters: @@ -406,12 +659,19 @@ Style/PercentLiteralDelimiters: # Offense count: 1 # Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. +# Configuration parameters: EnforcedStyle, AllowedCompactTypes. # SupportedStyles: compact, exploded Style/RaiseArgs: Exclude: - 'lib/annotate/annotate_models.rb' +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: Methods. +Style/RedundantArgument: + Exclude: + - 'lib/annotate/annotate_routes/header_generator.rb' + # Offense count: 3 # Cop supports --auto-correct. Style/RedundantBegin: @@ -425,6 +685,25 @@ Style/RedundantParentheses: Exclude: - 'lib/annotate/annotate_models.rb' +# Offense count: 2 +# Cop supports --auto-correct. +Style/RedundantPercentQ: + Exclude: + - 'annotate.gemspec' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/RedundantRegexpCharacterClass: + Exclude: + - 'lib/annotate/annotate_models.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/RedundantRegexpEscape: + Exclude: + - 'lib/annotate/annotate_models.rb' + - 'lib/annotate/annotate_routes/header_generator.rb' + # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: AllowMultipleReturnValues. @@ -463,12 +742,19 @@ Style/RescueStandardError: # Offense count: 2 # Cop supports --auto-correct. -# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist. -# Whitelist: present?, blank?, presence, try, try! +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods. +# AllowedMethods: present?, blank?, presence, try, try! Style/SafeNavigation: Exclude: - 'lib/annotate/annotate_models.rb' +# Offense count: 3 +# Cop supports --auto-correct. +Style/SlicingWithRange: + Exclude: + - 'lib/annotate/annotate_models.rb' + - 'lib/annotate/annotate_routes/header_generator.rb' + # Offense count: 15 # Cop supports --auto-correct. Style/StderrPuts: @@ -477,7 +763,13 @@ Style/StderrPuts: - 'lib/annotate.rb' - 'lib/annotate/annotate_models.rb' -# Offense count: 55 +# Offense count: 13 +# Cop supports --auto-correct. +Style/StringConcatenation: + Exclude: + - 'lib/annotate/annotate_models.rb' + +# Offense count: 57 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # SupportedStyles: single_quotes, double_quotes @@ -520,15 +812,9 @@ Style/TrailingCommaInArrayLiteral: Exclude: - 'spec/lib/annotate/annotate_models_spec.rb' -# Offense count: 2 -# Cop supports --auto-correct. -Style/UnneededPercentQ: - Exclude: - - 'annotate.gemspec' - -# Offense count: 381 +# Offense count: 52 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https -Metrics/LineLength: +Layout/LineLength: Max: 264 diff --git a/.tool-versions b/.tool-versions index 9b6768d19..9e83a384b 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 2.6.7 +ruby 2.7.3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 05d05d26d..000000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: ruby -rvm: - - 2.4.9 - - 2.5.7 - - 2.6.5 - -env: - - RAILS_ENV=development RACK_ENV=development INTEGRATION_TESTS=1 - -cache: bundler - -addons: - apt_packages: - - libsqlite3-dev - -before_install: - - gem update --system --no-document --quiet - -install: - - bundle install --jobs=3 --retry=3 - -script: - - bundle exec rspec - - bundle exec rubocop - -jobs: - include: - - stage: gem release - if: tag =~ ^v - rvm: 2.6.5 - script: echo "Deploying to rubygems.org ..." - deploy: - provider: rubygems - api_key: $RUBYGEMS_API_KEY - gem: annotate - on: - tags: true - repo: ctran/annotate_models diff --git a/Gemfile b/Gemfile index 4acd9cb84..0998ee0d0 100644 --- a/Gemfile +++ b/Gemfile @@ -19,11 +19,10 @@ group :development, :test do gem 'guard-rspec', require: false gem 'rspec', require: false - gem 'rubocop', '~> 0.68.1', require: false unless RUBY_VERSION =~ /^1.8/ - # gem 'rubocop', '~> 1.12', require: false - # gem 'rubocop-rake', require: false - # gem 'rubocop-rspec', require: false - # gem 'simplecov', require: false + gem 'rubocop', '~> 1.12.0', require: false + gem 'rubocop-rake', require: false + gem 'rubocop-rspec', '~> 2.2.0', require: false + gem 'simplecov', require: false gem 'terminal-notifier-guard', require: false gem 'codeclimate-test-reporter' diff --git a/spec/integration/integration_helper.rb b/spec/integration/integration_helper.rb deleted file mode 100644 index 79ce49a50..000000000 --- a/spec/integration/integration_helper.rb +++ /dev/null @@ -1,27 +0,0 @@ -class IntegrationHelper - MIN_RUBY_VERSIONS = { - 'rails_5.2.4.1' => '>= 2.2.2', - 'rails_6.0.2.1' => '>= 2.5.0' - }.freeze - - def self.able_to_run?(file_path, ruby_version) - return false unless ENV['INTEGRATION_TESTS'] - - file_name = File.basename(file_path) - rails_app = File.basename(file_name, '_spec.rb') - ruby_dependency = MIN_RUBY_VERSIONS[rails_app] - - required_version = Gem::Dependency.new('', ruby_dependency) - able_to_run = required_version.match?('', ruby_version) - - unless able_to_run - output = "\n" \ - "Skipping running the integration test for #{file_name}.\n" \ - "The current version of Ruby is #{ruby_version}, " \ - "but the integration test requires Ruby #{ruby_dependency}." - puts output - end - - able_to_run - end -end diff --git a/spec/integration/rails_5.2.4.1/.gitignore b/spec/integration/rails_5.2.4.1/.gitignore deleted file mode 100644 index 81452db92..000000000 --- a/spec/integration/rails_5.2.4.1/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -# See https://help.github.com/articles/ignoring-files for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' - -# Ignore bundler config. -/.bundle - -# Ignore the default SQLite database. -/db/*.sqlite3 -/db/*.sqlite3-journal - -# Ignore all logfiles and tempfiles. -/log/* -/tmp/* -!/log/.keep -!/tmp/.keep - -# Ignore uploaded files in development -/storage/* -!/storage/.keep - -/node_modules -/yarn-error.log - -/public/assets -.byebug_history - -# Ignore master key for decrypting credentials and more. -/config/master.key diff --git a/spec/integration/rails_5.2.4.1/Gemfile b/spec/integration/rails_5.2.4.1/Gemfile deleted file mode 100644 index db73e4e13..000000000 --- a/spec/integration/rails_5.2.4.1/Gemfile +++ /dev/null @@ -1,59 +0,0 @@ -source 'https://rubygems.org' -git_source(:github) { |repo| "https://github.com/#{repo}.git" } - -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.2.4', '>= 5.2.4.1' -# Use sqlite3 as the database for Active Record -gem 'sqlite3' -# Use Puma as the app server -gem 'puma', '~> 5.6' -# Use SCSS for stylesheets -gem 'sass-rails', '~> 5.0' -# Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' -# See https://github.com/rails/execjs#readme for more supported runtimes -# gem 'mini_racer', platforms: :ruby - -# Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.2' -# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks -gem 'turbolinks', '~> 5' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.5' -# Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 4.0' -# Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use ActiveStorage variant -# gem 'mini_magick', '~> 4.8' - -# Use Capistrano for deployment -# gem 'capistrano-rails', group: :development - -# Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.1.0', require: false - -group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] -end - -group :development do - gem 'annotate', path: '../../..' - - # Access an interactive console on exception pages or by calling 'console' anywhere in the code. - gem 'web-console', '>= 3.3.0' - gem 'listen', '>= 3.0.5', '< 3.2' -end - -group :test do - # Adds support for Capybara system testing and selenium driver - gem 'capybara', '>= 2.15' - gem 'selenium-webdriver' - # Easy installation and use of chromedriver to run system tests with Chrome - gem 'chromedriver-helper' -end - -# Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/spec/integration/rails_5.2.4.1/Gemfile.lock b/spec/integration/rails_5.2.4.1/Gemfile.lock deleted file mode 100644 index d8f28a0fa..000000000 --- a/spec/integration/rails_5.2.4.1/Gemfile.lock +++ /dev/null @@ -1,214 +0,0 @@ -PATH - remote: ../../.. - specs: - annotate (3.1.1) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) - -GEM - remote: https://rubygems.org/ - specs: - actioncable (5.2.5) - actionpack (= 5.2.5) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailer (5.2.5) - actionpack (= 5.2.5) - actionview (= 5.2.5) - activejob (= 5.2.5) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (5.2.5) - actionview (= 5.2.5) - activesupport (= 5.2.5) - rack (~> 2.0, >= 2.0.8) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.5) - activesupport (= 5.2.5) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.5) - activesupport (= 5.2.5) - globalid (>= 0.3.6) - activemodel (5.2.5) - activesupport (= 5.2.5) - activerecord (5.2.5) - activemodel (= 5.2.5) - activesupport (= 5.2.5) - arel (>= 9.0) - activestorage (5.2.5) - actionpack (= 5.2.5) - activerecord (= 5.2.5) - marcel (~> 1.0.0) - activesupport (5.2.5) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - archive-zip (0.12.0) - io-like (~> 0.3.0) - arel (9.0.0) - bindex (0.8.1) - bootsnap (1.7.3) - msgpack (~> 1.0) - builder (3.2.4) - byebug (11.1.3) - capybara (3.32.2) - addressable - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (~> 1.5) - xpath (~> 3.2) - childprocess (3.0.0) - chromedriver-helper (2.1.1) - archive-zip (~> 0.10) - nokogiri (~> 1.8) - coffee-rails (4.2.2) - coffee-script (>= 2.2.0) - railties (>= 4.0.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - concurrent-ruby (1.1.8) - crass (1.0.6) - erubi (1.10.0) - execjs (2.7.0) - ffi (1.15.0) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (1.8.10) - concurrent-ruby (~> 1.0) - io-like (0.3.1) - jbuilder (2.11.2) - activesupport (>= 5.0.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.9.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.1) - method_source (1.0.0) - mini_mime (1.0.3) - mini_portile2 (2.4.0) - minitest (5.14.4) - msgpack (1.4.2) - nio4r (2.5.8) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) - public_suffix (4.0.6) - puma (5.6.1) - nio4r (~> 2.0) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (5.2.5) - actioncable (= 5.2.5) - actionmailer (= 5.2.5) - actionpack (= 5.2.5) - actionview (= 5.2.5) - activejob (= 5.2.5) - activemodel (= 5.2.5) - activerecord (= 5.2.5) - activestorage (= 5.2.5) - activesupport (= 5.2.5) - bundler (>= 1.3.0) - railties (= 5.2.5) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (5.2.5) - actionpack (= 5.2.5) - activesupport (= 5.2.5) - method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) - rake (13.0.3) - rb-fsevent (0.10.4) - rb-inotify (0.10.1) - ffi (~> 1.0) - regexp_parser (1.8.2) - ruby_dep (1.5.0) - rubyzip (2.3.0) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.1.0) - railties (>= 5.2.0) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) - sprockets (3.7.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.4.2) - thor (1.1.0) - thread_safe (0.3.6) - tilt (2.0.10) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) - tzinfo (1.2.9) - thread_safe (~> 0.1) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) - web-console (3.7.0) - actionview (>= 5.0) - activemodel (>= 5.0) - bindex (>= 0.4.0) - railties (>= 5.0) - websocket-driver (0.7.3) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - xpath (3.2.0) - nokogiri (~> 1.8) - -PLATFORMS - ruby - -DEPENDENCIES - annotate! - bootsnap (>= 1.1.0) - byebug - capybara (>= 2.15) - chromedriver-helper - coffee-rails (~> 4.2) - jbuilder (~> 2.5) - listen (>= 3.0.5, < 3.2) - puma (~> 5.6) - rails (~> 5.2.4, >= 5.2.4.1) - sass-rails (~> 5.0) - selenium-webdriver - sqlite3 - turbolinks (~> 5) - tzinfo-data - uglifier (>= 1.3.0) - web-console (>= 3.3.0) - -BUNDLED WITH - 2.2.15 diff --git a/spec/integration/rails_5.2.4.1/README.md b/spec/integration/rails_5.2.4.1/README.md deleted file mode 100644 index 7db80e4ca..000000000 --- a/spec/integration/rails_5.2.4.1/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# README - -This README would normally document whatever steps are necessary to get the -application up and running. - -Things you may want to cover: - -* Ruby version - -* System dependencies - -* Configuration - -* Database creation - -* Database initialization - -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ... diff --git a/spec/integration/rails_5.2.4.1/Rakefile b/spec/integration/rails_5.2.4.1/Rakefile deleted file mode 100644 index e85f91391..000000000 --- a/spec/integration/rails_5.2.4.1/Rakefile +++ /dev/null @@ -1,6 +0,0 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require_relative 'config/application' - -Rails.application.load_tasks diff --git a/spec/integration/rails_5.2.4.1/app/assets/config/manifest.js b/spec/integration/rails_5.2.4.1/app/assets/config/manifest.js deleted file mode 100644 index b16e53d6d..000000000 --- a/spec/integration/rails_5.2.4.1/app/assets/config/manifest.js +++ /dev/null @@ -1,3 +0,0 @@ -//= link_tree ../images -//= link_directory ../javascripts .js -//= link_directory ../stylesheets .css diff --git a/spec/integration/rails_5.2.4.1/app/assets/images/.keep b/spec/integration/rails_5.2.4.1/app/assets/images/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/app/assets/javascripts/application.js b/spec/integration/rails_5.2.4.1/app/assets/javascripts/application.js deleted file mode 100644 index 82e6f0f6c..000000000 --- a/spec/integration/rails_5.2.4.1/app/assets/javascripts/application.js +++ /dev/null @@ -1,16 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's -// vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. JavaScript code in this file should be added after the last require_* statement. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// -//= require rails-ujs -//= require activestorage -//= require turbolinks -//= require_tree . diff --git a/spec/integration/rails_5.2.4.1/app/assets/javascripts/cable.js b/spec/integration/rails_5.2.4.1/app/assets/javascripts/cable.js deleted file mode 100644 index 739aa5f02..000000000 --- a/spec/integration/rails_5.2.4.1/app/assets/javascripts/cable.js +++ /dev/null @@ -1,13 +0,0 @@ -// 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. -// -//= require action_cable -//= require_self -//= require_tree ./channels - -(function() { - this.App || (this.App = {}); - - App.cable = ActionCable.createConsumer(); - -}).call(this); diff --git a/spec/integration/rails_5.2.4.1/app/assets/javascripts/channels/.keep b/spec/integration/rails_5.2.4.1/app/assets/javascripts/channels/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/app/assets/stylesheets/application.css b/spec/integration/rails_5.2.4.1/app/assets/stylesheets/application.css deleted file mode 100644 index d05ea0f51..000000000 --- a/spec/integration/rails_5.2.4.1/app/assets/stylesheets/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's - * vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS - * files in this directory. Styles in this file should be added after the last require_* statement. - * It is generally better to create a new file per style scope. - * - *= require_tree . - *= require_self - */ diff --git a/spec/integration/rails_5.2.4.1/app/channels/application_cable/channel.rb b/spec/integration/rails_5.2.4.1/app/channels/application_cable/channel.rb deleted file mode 100644 index d67269728..000000000 --- a/spec/integration/rails_5.2.4.1/app/channels/application_cable/channel.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Channel < ActionCable::Channel::Base - end -end diff --git a/spec/integration/rails_5.2.4.1/app/channels/application_cable/connection.rb b/spec/integration/rails_5.2.4.1/app/channels/application_cable/connection.rb deleted file mode 100644 index 0ff5442f4..000000000 --- a/spec/integration/rails_5.2.4.1/app/channels/application_cable/connection.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Connection < ActionCable::Connection::Base - end -end diff --git a/spec/integration/rails_5.2.4.1/app/controllers/application_controller.rb b/spec/integration/rails_5.2.4.1/app/controllers/application_controller.rb deleted file mode 100644 index 09705d12a..000000000 --- a/spec/integration/rails_5.2.4.1/app/controllers/application_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ApplicationController < ActionController::Base -end diff --git a/spec/integration/rails_5.2.4.1/app/controllers/concerns/.keep b/spec/integration/rails_5.2.4.1/app/controllers/concerns/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/app/helpers/application_helper.rb b/spec/integration/rails_5.2.4.1/app/helpers/application_helper.rb deleted file mode 100644 index de6be7945..000000000 --- a/spec/integration/rails_5.2.4.1/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/spec/integration/rails_5.2.4.1/app/jobs/application_job.rb b/spec/integration/rails_5.2.4.1/app/jobs/application_job.rb deleted file mode 100644 index a009ace51..000000000 --- a/spec/integration/rails_5.2.4.1/app/jobs/application_job.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ApplicationJob < ActiveJob::Base -end diff --git a/spec/integration/rails_5.2.4.1/app/mailers/application_mailer.rb b/spec/integration/rails_5.2.4.1/app/mailers/application_mailer.rb deleted file mode 100644 index 286b2239d..000000000 --- a/spec/integration/rails_5.2.4.1/app/mailers/application_mailer.rb +++ /dev/null @@ -1,4 +0,0 @@ -class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' - layout 'mailer' -end diff --git a/spec/integration/rails_5.2.4.1/app/models/application_record.rb b/spec/integration/rails_5.2.4.1/app/models/application_record.rb deleted file mode 100644 index 10a4cba84..000000000 --- a/spec/integration/rails_5.2.4.1/app/models/application_record.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationRecord < ActiveRecord::Base - self.abstract_class = true -end diff --git a/spec/integration/rails_5.2.4.1/app/models/concerns/.keep b/spec/integration/rails_5.2.4.1/app/models/concerns/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/app/models/task.rb b/spec/integration/rails_5.2.4.1/app/models/task.rb deleted file mode 100644 index 3c2342421..000000000 --- a/spec/integration/rails_5.2.4.1/app/models/task.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Task < ApplicationRecord -end diff --git a/spec/integration/rails_5.2.4.1/app/views/layouts/application.html.erb b/spec/integration/rails_5.2.4.1/app/views/layouts/application.html.erb deleted file mode 100644 index 8255d055e..000000000 --- a/spec/integration/rails_5.2.4.1/app/views/layouts/application.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - - - - Rails5241 - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> - - - - <%= yield %> - - diff --git a/spec/integration/rails_5.2.4.1/app/views/layouts/mailer.html.erb b/spec/integration/rails_5.2.4.1/app/views/layouts/mailer.html.erb deleted file mode 100644 index cbd34d2e9..000000000 --- a/spec/integration/rails_5.2.4.1/app/views/layouts/mailer.html.erb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - <%= yield %> - - diff --git a/spec/integration/rails_5.2.4.1/app/views/layouts/mailer.text.erb b/spec/integration/rails_5.2.4.1/app/views/layouts/mailer.text.erb deleted file mode 100644 index 37f0bddbd..000000000 --- a/spec/integration/rails_5.2.4.1/app/views/layouts/mailer.text.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yield %> diff --git a/spec/integration/rails_5.2.4.1/bin/bundle b/spec/integration/rails_5.2.4.1/bin/bundle deleted file mode 100755 index f19acf5b5..000000000 --- a/spec/integration/rails_5.2.4.1/bin/bundle +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -load Gem.bin_path('bundler', 'bundle') diff --git a/spec/integration/rails_5.2.4.1/bin/rails b/spec/integration/rails_5.2.4.1/bin/rails deleted file mode 100755 index 073966023..000000000 --- a/spec/integration/rails_5.2.4.1/bin/rails +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' diff --git a/spec/integration/rails_5.2.4.1/bin/rake b/spec/integration/rails_5.2.4.1/bin/rake deleted file mode 100755 index 17240489f..000000000 --- a/spec/integration/rails_5.2.4.1/bin/rake +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' -Rake.application.run diff --git a/spec/integration/rails_5.2.4.1/bin/setup b/spec/integration/rails_5.2.4.1/bin/setup deleted file mode 100755 index 94fd4d797..000000000 --- a/spec/integration/rails_5.2.4.1/bin/setup +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env ruby -require 'fileutils' -include FileUtils - -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) - -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") -end - -chdir APP_ROOT do - # This script is a starting point to setup your application. - # Add necessary setup steps to this file. - - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') - - # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' - # end - - puts "\n== Preparing database ==" - system! 'bin/rails db:setup' - - puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' - - puts "\n== Restarting application server ==" - system! 'bin/rails restart' -end diff --git a/spec/integration/rails_5.2.4.1/bin/update b/spec/integration/rails_5.2.4.1/bin/update deleted file mode 100755 index 58bfaed51..000000000 --- a/spec/integration/rails_5.2.4.1/bin/update +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env ruby -require 'fileutils' -include FileUtils - -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) - -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") -end - -chdir APP_ROOT do - # This script is a way to update your development environment automatically. - # Add necessary update steps to this file. - - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') - - puts "\n== Updating database ==" - system! 'bin/rails db:migrate' - - puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' - - puts "\n== Restarting application server ==" - system! 'bin/rails restart' -end diff --git a/spec/integration/rails_5.2.4.1/bin/yarn b/spec/integration/rails_5.2.4.1/bin/yarn deleted file mode 100755 index 460dd565b..000000000 --- a/spec/integration/rails_5.2.4.1/bin/yarn +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env ruby -APP_ROOT = File.expand_path('..', __dir__) -Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT - $stderr.puts "Yarn executable was not detected in the system." - $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" - exit 1 - end -end diff --git a/spec/integration/rails_5.2.4.1/config.ru b/spec/integration/rails_5.2.4.1/config.ru deleted file mode 100644 index f7ba0b527..000000000 --- a/spec/integration/rails_5.2.4.1/config.ru +++ /dev/null @@ -1,5 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require_relative 'config/environment' - -run Rails.application diff --git a/spec/integration/rails_5.2.4.1/config/application.rb b/spec/integration/rails_5.2.4.1/config/application.rb deleted file mode 100644 index a497104ac..000000000 --- a/spec/integration/rails_5.2.4.1/config/application.rb +++ /dev/null @@ -1,19 +0,0 @@ -require_relative 'boot' - -require 'rails/all' - -# Require the gems listed in Gemfile, including any gems -# you've limited to :test, :development, or :production. -Bundler.require(*Rails.groups) - -module Rails5241 - class Application < Rails::Application - # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.2 - - # Settings in config/environments/* take precedence over those specified here. - # Application configuration can go into files in config/initializers - # -- all .rb files in that directory are automatically loaded after loading - # the framework and any gems in your application. - end -end diff --git a/spec/integration/rails_5.2.4.1/config/boot.rb b/spec/integration/rails_5.2.4.1/config/boot.rb deleted file mode 100644 index b9e460cef..000000000 --- a/spec/integration/rails_5.2.4.1/config/boot.rb +++ /dev/null @@ -1,4 +0,0 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) - -require 'bundler/setup' # Set up gems listed in the Gemfile. -require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/spec/integration/rails_5.2.4.1/config/cable.yml b/spec/integration/rails_5.2.4.1/config/cable.yml deleted file mode 100644 index bbe9fb1e2..000000000 --- a/spec/integration/rails_5.2.4.1/config/cable.yml +++ /dev/null @@ -1,10 +0,0 @@ -development: - adapter: async - -test: - adapter: async - -production: - adapter: redis - url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: rails_5_2_4_1_production diff --git a/spec/integration/rails_5.2.4.1/config/credentials.yml.enc b/spec/integration/rails_5.2.4.1/config/credentials.yml.enc deleted file mode 100644 index 2ef7ab8c7..000000000 --- a/spec/integration/rails_5.2.4.1/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -kaq24JvP21fLJw+1dPA4vJwDDrmXYkK9Z0eGm427byJIzbzyz4/iZOeOaMbmgPus3C1brzeGXrXvH/XObBtrktOftldHzYN9EjYIvip+Z38ep7kv5FhkL2OMlOAJCOkIv0xxyZld6pn6VR6QyJ8GmO/vJh1/k0AMpioQA4QPVi4AZyRxNNlO8UkQ4nidlYBjueoZDTbrKwDUNGwnCfSihDYzWsyNqQfEuvZDjd8UdpPUFDRVkG7TI4EVGfJD2TSmnbm2XCxrfRvSkWL5M7qJavBSJTJ2pUc4sZhmSlVjCBV1nuW+gvl5UC5yABmc2MwnftfwEplXObKdEHIR7y1EQ92KGqsgmoOZTnqEbEbN4jWDI14SS3DDoosu2mROI88R7rWCMjMDmjOlaVELYvzoXYW4hfNBvXvqbb2O--vdG9CDzyXc67QVYu--pSJBykeDMvvx3dUeH5L3ng== \ No newline at end of file diff --git a/spec/integration/rails_5.2.4.1/config/database.yml b/spec/integration/rails_5.2.4.1/config/database.yml deleted file mode 100644 index 0d02f2498..000000000 --- a/spec/integration/rails_5.2.4.1/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# -default: &default - adapter: sqlite3 - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - timeout: 5000 - -development: - <<: *default - database: db/development.sqlite3 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - <<: *default - database: db/test.sqlite3 - -production: - <<: *default - database: db/production.sqlite3 diff --git a/spec/integration/rails_5.2.4.1/config/environment.rb b/spec/integration/rails_5.2.4.1/config/environment.rb deleted file mode 100644 index 426333bb4..000000000 --- a/spec/integration/rails_5.2.4.1/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the Rails application. -require_relative 'application' - -# Initialize the Rails application. -Rails.application.initialize! diff --git a/spec/integration/rails_5.2.4.1/config/environments/development.rb b/spec/integration/rails_5.2.4.1/config/environments/development.rb deleted file mode 100644 index 1311e3e4e..000000000 --- a/spec/integration/rails_5.2.4.1/config/environments/development.rb +++ /dev/null @@ -1,61 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Do not eager load code on boot. - config.eager_load = false - - # Show full error reports. - config.consider_all_requests_local = true - - # Enable/disable caching. By default caching is disabled. - # Run rails dev:cache to toggle caching. - if Rails.root.join('tmp', 'caching-dev.txt').exist? - config.action_controller.perform_caching = true - - config.cache_store = :memory_store - config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.to_i}" - } - else - config.action_controller.perform_caching = false - - config.cache_store = :null_store - end - - # Store uploaded files on the local file system (see config/storage.yml for options) - config.active_storage.service = :local - - # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false - - config.action_mailer.perform_caching = false - - # Print deprecation notices to the Rails logger. - config.active_support.deprecation = :log - - # Raise an error on page load if there are pending migrations. - config.active_record.migration_error = :page_load - - # Highlight code that triggered database queries in logs. - config.active_record.verbose_query_logs = true - - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true - - # Suppress logger output for asset requests. - config.assets.quiet = true - - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true - - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. - config.file_watcher = ActiveSupport::EventedFileUpdateChecker -end diff --git a/spec/integration/rails_5.2.4.1/config/environments/production.rb b/spec/integration/rails_5.2.4.1/config/environments/production.rb deleted file mode 100644 index 431c8ee69..000000000 --- a/spec/integration/rails_5.2.4.1/config/environments/production.rb +++ /dev/null @@ -1,94 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # Code is not reloaded between requests. - config.cache_classes = true - - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. - config.eager_load = true - - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] - # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). - # config.require_master_key = true - - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? - - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier - # config.assets.css_compressor = :sass - - # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false - - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' - - # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - - # Store uploaded files on the local file system (see config/storage.yml for options) - config.active_storage.service = :local - - # Mount Action Cable outside main process or domain - # config.action_cable.mount_path = nil - # config.action_cable.url = 'wss://example.com/cable' - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. - config.log_level = :debug - - # Prepend all log lines with the following tags. - config.log_tags = [ :request_id ] - - # Use a different cache store in production. - # config.cache_store = :mem_cache_store - - # Use a real queuing backend for Active Job (and separate queues per environment) - # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "rails_5_2_4_1_#{Rails.env}" - - config.action_mailer.perform_caching = false - - # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to raise delivery errors. - # config.action_mailer.raise_delivery_errors = false - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Use a different logger for distributed setups. - # require 'syslog/logger' - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') - - if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end - - # Do not dump schema after migrations. - config.active_record.dump_schema_after_migration = false -end diff --git a/spec/integration/rails_5.2.4.1/config/environments/test.rb b/spec/integration/rails_5.2.4.1/config/environments/test.rb deleted file mode 100644 index 0a38fd3ce..000000000 --- a/spec/integration/rails_5.2.4.1/config/environments/test.rb +++ /dev/null @@ -1,46 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false - - # Configure public file server for tests with Cache-Control for performance. - config.public_file_server.enabled = true - config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{1.hour.to_i}" - } - - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment. - config.action_controller.allow_forgery_protection = false - - # Store uploaded files on the local file system in a temporary directory - config.active_storage.service = :test - - config.action_mailer.perform_caching = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Print deprecation notices to the stderr. - config.active_support.deprecation = :stderr - - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true -end diff --git a/spec/integration/rails_5.2.4.1/config/initializers/application_controller_renderer.rb b/spec/integration/rails_5.2.4.1/config/initializers/application_controller_renderer.rb deleted file mode 100644 index 89d2efab2..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/application_controller_renderer.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# ActiveSupport::Reloader.to_prepare do -# ApplicationController.renderer.defaults.merge!( -# http_host: 'example.org', -# https: false -# ) -# end diff --git a/spec/integration/rails_5.2.4.1/config/initializers/assets.rb b/spec/integration/rails_5.2.4.1/config/initializers/assets.rb deleted file mode 100644 index 4b828e80c..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/assets.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' - -# Add additional assets to the asset load path. -# Rails.application.config.assets.paths << Emoji.images_path -# Add Yarn node_modules folder to the asset load path. -Rails.application.config.assets.paths << Rails.root.join('node_modules') - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in the app/assets -# folder are already added. -# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/spec/integration/rails_5.2.4.1/config/initializers/backtrace_silencers.rb b/spec/integration/rails_5.2.4.1/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cdf3..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/integration/rails_5.2.4.1/config/initializers/content_security_policy.rb b/spec/integration/rails_5.2.4.1/config/initializers/content_security_policy.rb deleted file mode 100644 index d3bcaa5ec..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/content_security_policy.rb +++ /dev/null @@ -1,25 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy - -# Rails.application.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" -# end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/spec/integration/rails_5.2.4.1/config/initializers/cookies_serializer.rb b/spec/integration/rails_5.2.4.1/config/initializers/cookies_serializer.rb deleted file mode 100644 index 5a6a32d37..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Specify a serializer for the signed and encrypted cookie jars. -# Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/spec/integration/rails_5.2.4.1/config/initializers/filter_parameter_logging.rb b/spec/integration/rails_5.2.4.1/config/initializers/filter_parameter_logging.rb deleted file mode 100644 index 4a994e1e7..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/filter_parameter_logging.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] diff --git a/spec/integration/rails_5.2.4.1/config/initializers/inflections.rb b/spec/integration/rails_5.2.4.1/config/initializers/inflections.rb deleted file mode 100644 index ac033bf9d..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/inflections.rb +++ /dev/null @@ -1,16 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format. Inflections -# are locale specific, and you may define rules for as many different -# locales as you wish. All of these examples are active by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end - -# These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' -# end diff --git a/spec/integration/rails_5.2.4.1/config/initializers/mime_types.rb b/spec/integration/rails_5.2.4.1/config/initializers/mime_types.rb deleted file mode 100644 index dc1899682..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/mime_types.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf diff --git a/spec/integration/rails_5.2.4.1/config/initializers/wrap_parameters.rb b/spec/integration/rails_5.2.4.1/config/initializers/wrap_parameters.rb deleted file mode 100644 index bbfc3961b..000000000 --- a/spec/integration/rails_5.2.4.1/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/spec/integration/rails_5.2.4.1/config/locales/en.yml b/spec/integration/rails_5.2.4.1/config/locales/en.yml deleted file mode 100644 index decc5a857..000000000 --- a/spec/integration/rails_5.2.4.1/config/locales/en.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. -# -# To use the locales, use `I18n.t`: -# -# I18n.t 'hello' -# -# In views, this is aliased to just `t`: -# -# <%= t('hello') %> -# -# To use a different locale, set it with `I18n.locale`: -# -# I18n.locale = :es -# -# This would use the information in config/locales/es.yml. -# -# The following keys must be escaped otherwise they will not be retrieved by -# the default I18n backend: -# -# true, false, on, off, yes, no -# -# Instead, surround them with single quotes. -# -# en: -# 'true': 'foo' -# -# To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. - -en: - hello: "Hello world" diff --git a/spec/integration/rails_5.2.4.1/config/puma.rb b/spec/integration/rails_5.2.4.1/config/puma.rb deleted file mode 100644 index b2102072b..000000000 --- a/spec/integration/rails_5.2.4.1/config/puma.rb +++ /dev/null @@ -1,37 +0,0 @@ -# Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers: a minimum and maximum. -# Any libraries that use thread pools should be configured to match -# the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum; this matches the default thread size of Active Record. -# -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -threads threads_count, threads_count - -# Specifies the `port` that Puma will listen on to receive requests; default is 3000. -# -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. -# -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the `pidfile` that Puma will use. -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } - -# Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver processes. If using threads and workers together -# the concurrency of the application would be max `threads` * `workers`. -# Workers do not work on JRuby or Windows (both of which do not support -# processes). -# -# workers ENV.fetch("WEB_CONCURRENCY") { 2 } - -# Use the `preload_app!` method when specifying a `workers` number. -# This directive tells Puma to first boot the application and load code -# before forking the application. This takes advantage of Copy On Write -# process behavior so workers use less memory. -# -# preload_app! - -# Allow puma to be restarted by `rails restart` command. -plugin :tmp_restart diff --git a/spec/integration/rails_5.2.4.1/config/routes.rb b/spec/integration/rails_5.2.4.1/config/routes.rb deleted file mode 100644 index 2a9234a0a..000000000 --- a/spec/integration/rails_5.2.4.1/config/routes.rb +++ /dev/null @@ -1,4 +0,0 @@ -Rails.application.routes.draw do - # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html - resources :tasks -end diff --git a/spec/integration/rails_5.2.4.1/config/spring.rb b/spec/integration/rails_5.2.4.1/config/spring.rb deleted file mode 100644 index 9fa7863f9..000000000 --- a/spec/integration/rails_5.2.4.1/config/spring.rb +++ /dev/null @@ -1,6 +0,0 @@ -%w[ - .ruby-version - .rbenv-vars - tmp/restart.txt - tmp/caching-dev.txt -].each { |path| Spring.watch(path) } diff --git a/spec/integration/rails_5.2.4.1/config/storage.yml b/spec/integration/rails_5.2.4.1/config/storage.yml deleted file mode 100644 index d32f76e8f..000000000 --- a/spec/integration/rails_5.2.4.1/config/storage.yml +++ /dev/null @@ -1,34 +0,0 @@ -test: - service: Disk - root: <%= Rails.root.join("tmp/storage") %> - -local: - service: Disk - root: <%= Rails.root.join("storage") %> - -# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) -# amazon: -# service: S3 -# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> -# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> -# region: us-east-1 -# bucket: your_own_bucket - -# Remember not to checkin your GCS keyfile to a repository -# google: -# service: GCS -# project: your_project -# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> -# bucket: your_own_bucket - -# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) -# microsoft: -# service: AzureStorage -# storage_account_name: your_account_name -# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> -# container: your_container_name - -# mirror: -# service: Mirror -# primary: local -# mirrors: [ amazon, google, microsoft ] diff --git a/spec/integration/rails_5.2.4.1/db/migrate/20200204052946_create_tasks.rb b/spec/integration/rails_5.2.4.1/db/migrate/20200204052946_create_tasks.rb deleted file mode 100644 index f4b276aa8..000000000 --- a/spec/integration/rails_5.2.4.1/db/migrate/20200204052946_create_tasks.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateTasks < ActiveRecord::Migration[5.2] - def change - create_table :tasks do |t| - t.string :content - t.integer :count, default: 0 - t.boolean :status, default: false - - t.timestamps - end - end -end diff --git a/spec/integration/rails_5.2.4.1/db/schema.rb b/spec/integration/rails_5.2.4.1/db/schema.rb deleted file mode 100644 index 4d585f43c..000000000 --- a/spec/integration/rails_5.2.4.1/db/schema.rb +++ /dev/null @@ -1,23 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema.define(version: 2020_02_04_052946) do - - create_table "tasks", force: :cascade do |t| - t.string "content" - t.integer "count", default: 0 - t.boolean "status", default: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - -end diff --git a/spec/integration/rails_5.2.4.1/db/seeds.rb b/spec/integration/rails_5.2.4.1/db/seeds.rb deleted file mode 100644 index 1beea2acc..000000000 --- a/spec/integration/rails_5.2.4.1/db/seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). -# -# Examples: -# -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) diff --git a/spec/integration/rails_5.2.4.1/lib/assets/.keep b/spec/integration/rails_5.2.4.1/lib/assets/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/lib/tasks/.keep b/spec/integration/rails_5.2.4.1/lib/tasks/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/log/.keep b/spec/integration/rails_5.2.4.1/log/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/package.json b/spec/integration/rails_5.2.4.1/package.json deleted file mode 100644 index e064671a6..000000000 --- a/spec/integration/rails_5.2.4.1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "rails_5_2_4_1", - "private": true, - "dependencies": {} -} diff --git a/spec/integration/rails_5.2.4.1/public/404.html b/spec/integration/rails_5.2.4.1/public/404.html deleted file mode 100644 index 2be3af26f..000000000 --- a/spec/integration/rails_5.2.4.1/public/404.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - - -
-
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/integration/rails_5.2.4.1/public/422.html b/spec/integration/rails_5.2.4.1/public/422.html deleted file mode 100644 index c08eac0d1..000000000 --- a/spec/integration/rails_5.2.4.1/public/422.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - - -
-
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/integration/rails_5.2.4.1/public/500.html b/spec/integration/rails_5.2.4.1/public/500.html deleted file mode 100644 index 78a030af2..000000000 --- a/spec/integration/rails_5.2.4.1/public/500.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - - -
-
-

We're sorry, but something went wrong.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/integration/rails_5.2.4.1/public/apple-touch-icon-precomposed.png b/spec/integration/rails_5.2.4.1/public/apple-touch-icon-precomposed.png deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/public/apple-touch-icon.png b/spec/integration/rails_5.2.4.1/public/apple-touch-icon.png deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/public/favicon.ico b/spec/integration/rails_5.2.4.1/public/favicon.ico deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/public/robots.txt b/spec/integration/rails_5.2.4.1/public/robots.txt deleted file mode 100644 index 37b576a4a..000000000 --- a/spec/integration/rails_5.2.4.1/public/robots.txt +++ /dev/null @@ -1 +0,0 @@ -# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/spec/integration/rails_5.2.4.1/storage/.keep b/spec/integration/rails_5.2.4.1/storage/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/application_system_test_case.rb b/spec/integration/rails_5.2.4.1/test/application_system_test_case.rb deleted file mode 100644 index d19212abd..000000000 --- a/spec/integration/rails_5.2.4.1/test/application_system_test_case.rb +++ /dev/null @@ -1,5 +0,0 @@ -require "test_helper" - -class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, using: :chrome, screen_size: [1400, 1400] -end diff --git a/spec/integration/rails_5.2.4.1/test/controllers/.keep b/spec/integration/rails_5.2.4.1/test/controllers/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/fixtures/.keep b/spec/integration/rails_5.2.4.1/test/fixtures/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/fixtures/files/.keep b/spec/integration/rails_5.2.4.1/test/fixtures/files/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/fixtures/tasks.yml b/spec/integration/rails_5.2.4.1/test/fixtures/tasks.yml deleted file mode 100644 index 552ecdf1e..000000000 --- a/spec/integration/rails_5.2.4.1/test/fixtures/tasks.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - content: MyString - count: 1 - status: false - -two: - content: MyString - count: 1 - status: false diff --git a/spec/integration/rails_5.2.4.1/test/helpers/.keep b/spec/integration/rails_5.2.4.1/test/helpers/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/integration/.keep b/spec/integration/rails_5.2.4.1/test/integration/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/mailers/.keep b/spec/integration/rails_5.2.4.1/test/mailers/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/models/.keep b/spec/integration/rails_5.2.4.1/test/models/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/models/task_test.rb b/spec/integration/rails_5.2.4.1/test/models/task_test.rb deleted file mode 100644 index 3ca215970..000000000 --- a/spec/integration/rails_5.2.4.1/test/models/task_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class TaskTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/spec/integration/rails_5.2.4.1/test/system/.keep b/spec/integration/rails_5.2.4.1/test/system/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/test/test_helper.rb b/spec/integration/rails_5.2.4.1/test/test_helper.rb deleted file mode 100644 index 3ab84e3d1..000000000 --- a/spec/integration/rails_5.2.4.1/test/test_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -ENV['RAILS_ENV'] ||= 'test' -require_relative '../config/environment' -require 'rails/test_help' - -class ActiveSupport::TestCase - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - fixtures :all - - # Add more helper methods to be used by all tests here... -end diff --git a/spec/integration/rails_5.2.4.1/tmp/.keep b/spec/integration/rails_5.2.4.1/tmp/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1/vendor/.keep b/spec/integration/rails_5.2.4.1/vendor/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_5.2.4.1_spec.rb b/spec/integration/rails_5.2.4.1_spec.rb deleted file mode 100644 index 06a62cea7..000000000 --- a/spec/integration/rails_5.2.4.1_spec.rb +++ /dev/null @@ -1,171 +0,0 @@ -require 'bundler' -require 'rspec' -require 'git' -require_relative 'integration_helper' - -describe 'Integration testing on Rails 5.2.4.1', if: IntegrationHelper.able_to_run?(__FILE__, RUBY_VERSION) do - ::RAILS_5_2_APP_NAME = 'rails_5.2.4.1'.freeze - ::RAILS_5_2_PROJECT_PATH = File.expand_path('../..', __dir__).freeze - ::RAILS_5_2_APP_PATH = File.expand_path(RAILS_5_2_APP_NAME, __dir__).freeze - - let!(:git) { Git.open(RAILS_5_2_PROJECT_PATH) } - - before(:all) do - Bundler.with_clean_env do - Dir.chdir RAILS_5_2_APP_PATH do - puts `bundle install` - puts `bin/rails db:migrate` - end - end - end - - after(:each) do - git.reset_hard - end - - describe 'annotate --models' do - let(:command) { 'bundle exec annotate --models' } - - let(:task_model) do - patch = <<~PATCH - +# == Schema Information - +# - +# Table name: tasks - +# - +# id :integer not null, primary key - +# content :string - +# count :integer default(0) - +# status :boolean default(FALSE) - +# created_at :datetime not null - +# updated_at :datetime not null - +# - PATCH - - path = 'app/models/task.rb' - { - path: include(path), - patch: include(patch) - } - end - let(:task_test) do - patch = <<~PATCH - +# == Schema Information - +# - +# Table name: tasks - +# - +# id :integer not null, primary key - +# content :string - +# count :integer default(0) - +# status :boolean default(FALSE) - +# created_at :datetime not null - +# updated_at :datetime not null - +# - PATCH - - path = 'test/models/task_test.rb' - { - path: include(path), - patch: include(patch) - } - end - let(:task_fixture) do - patch = <<~PATCH - +# == Schema Information - +# - +# Table name: tasks - +# - +# id :integer not null, primary key - +# content :string - +# count :integer default(0) - +# status :boolean default(FALSE) - +# created_at :datetime not null - +# updated_at :datetime not null - +# - PATCH - - path = 'test/fixtures/tasks.yml' - { - path: include(path), - patch: include(patch) - } - end - - it 'annotate models' do - Bundler.with_clean_env do - Dir.chdir RAILS_5_2_APP_PATH do - expect(git.diff.any?).to be_falsy - - puts `#{command}` - - expect(git.diff.entries).to contain_exactly( - an_object_having_attributes(task_model), - an_object_having_attributes(task_test), - an_object_having_attributes(task_fixture) - ) - end - end - end - end - - describe 'annotate --routes' do - let(:command) { 'bundle exec annotate --routes' } - - let(:task_routes) do - task_routes_diff = <<-DIFF -+# == Route Map -+# -+# Prefix Verb URI Pattern Controller#Action -+# tasks GET /tasks(.:format) tasks#index -+# POST /tasks(.:format) tasks#create -+# new_task GET /tasks/new(.:format) tasks#new -+# edit_task GET /tasks/:id/edit(.:format) tasks#edit -+# task GET /tasks/:id(.:format) tasks#show -+# PATCH /tasks/:id(.:format) tasks#update -+# PUT /tasks/:id(.:format) tasks#update -+# DELETE /tasks/:id(.:format) tasks#destroy - DIFF - - default_routes_diff = <<-DIFF -+# rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show -+# rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show -+# rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show -+# update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update -+# rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create - DIFF - - path = 'config/routes.rb' - { - path: include(path), - patch: include(task_routes_diff, default_routes_diff) - } - end - - it 'annotate routes.rb' do - Bundler.with_clean_env do - Dir.chdir RAILS_5_2_APP_PATH do - expect(git.diff.any?).to be_falsy - - puts `#{command}` - - expect(git.diff.entries).to contain_exactly(an_object_having_attributes(task_routes)) - end - end - end - end - - describe 'rails g annotate:install' do - let(:command) { 'bin/rails g annotate:install' } - let(:rake_file_path) { 'lib/tasks/auto_annotate_models.rake' } - - it 'generates the rake file' do - Bundler.with_clean_env do - Dir.chdir RAILS_5_2_APP_PATH do - full_path = File.expand_path(rake_file_path) - expect { `#{command}` }.to change { File.exist?(rake_file_path) }.from(false).to(true) - - File.delete(full_path) - end - end - end - end -end diff --git a/spec/integration/rails_6.0.2.1/.gitignore b/spec/integration/rails_6.0.2.1/.gitignore deleted file mode 100644 index 376e85884..000000000 --- a/spec/integration/rails_6.0.2.1/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# See https://help.github.com/articles/ignoring-files for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' - -# Ignore bundler config. -/.bundle - -# Ignore the default SQLite database. -/db/*.sqlite3 -/db/*.sqlite3-journal -/db/*.sqlite3-* - -# Ignore all logfiles and tempfiles. -/log/* -/tmp/* -!/log/.keep -!/tmp/.keep - -# Ignore uploaded files in development. -/storage/* -!/storage/.keep - -/public/assets -.byebug_history - -# Ignore master key for decrypting credentials and more. -/config/master.key - -/public/packs -/public/packs-test -/node_modules -/yarn-error.log -yarn-debug.log* -.yarn-integrity \ No newline at end of file diff --git a/spec/integration/rails_6.0.2.1/.keep b/spec/integration/rails_6.0.2.1/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/.rubocop.yml b/spec/integration/rails_6.0.2.1/.rubocop.yml deleted file mode 100644 index cc32da4b9..000000000 --- a/spec/integration/rails_6.0.2.1/.rubocop.yml +++ /dev/null @@ -1 +0,0 @@ -inherit_from: .rubocop_todo.yml diff --git a/spec/integration/rails_6.0.2.1/.rubocop_todo.yml b/spec/integration/rails_6.0.2.1/.rubocop_todo.yml deleted file mode 100644 index b7b989b77..000000000 --- a/spec/integration/rails_6.0.2.1/.rubocop_todo.yml +++ /dev/null @@ -1,156 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# on 2020-02-01 10:51:52 -1000 using RuboCop version 0.68.1. -# The point is for the user to remove these configuration records -# one by one as the offenses are removed from the code base. -# Note that changes in the inspected code, or installation of new -# versions of RuboCop, may require this file to be generated again. - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: TreatCommentsAsGroupSeparators, Include. -# Include: **/*.gemfile, **/Gemfile, **/gems.rb -Bundler/OrderedGems: - Exclude: - - 'Gemfile' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: outdent, indent -Layout/AccessModifierIndentation: - Exclude: - - 'bin/bundle' - -# Offense count: 6 -# Cop supports --auto-correct. -Layout/EmptyLineAfterGuardClause: - Exclude: - - 'bin/bundle' - -# Offense count: 1 -# Cop supports --auto-correct. -Layout/EmptyLines: - Exclude: - - 'config/environments/development.rb' - -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: empty_lines, no_empty_lines -Layout/EmptyLinesAroundBlockBody: - Exclude: - - 'db/schema.rb' - -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. -# SupportedStyles: space, no_space, compact -# SupportedStylesForEmptyBrackets: space, no_space -Layout/SpaceInsideArrayLiteralBrackets: - Exclude: - - 'config/environments/production.rb' - -# Offense count: 1 -Metrics/AbcSize: - Max: 18 - -# Offense count: 1 -Metrics/CyclomaticComplexity: - Max: 9 - -# Offense count: 2 -# Configuration parameters: CountComments, ExcludedMethods. -Metrics/MethodLength: - Max: 13 - -# Offense count: 1 -Metrics/PerceivedComplexity: - Max: 9 - -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle. -# SupportedStyles: nested, compact -Style/ClassAndModuleChildren: - Exclude: - - 'test/channels/application_cable/connection_test.rb' - - 'test/test_helper.rb' - -# Offense count: 5 -Style/Documentation: - Exclude: - - 'spec/**/*' - - 'test/**/*' - - 'app/helpers/application_helper.rb' - - 'app/mailers/application_mailer.rb' - - 'app/models/application_record.rb' - - 'config/application.rb' - - 'db/migrate/20200201204456_create_tasks.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Style/ExpandPathArguments: - Exclude: - - 'bin/bundle' - -# Offense count: 37 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: when_needed, always, never -Style/FrozenStringLiteralComment: - Enabled: false - -# Offense count: 3 -# Cop supports --auto-correct. -Style/IfUnlessModifier: - Exclude: - - 'bin/bundle' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: MinDigits, Strict. -Style/NumericLiterals: - Exclude: - - 'db/schema.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Style/PerlBackrefs: - Exclude: - - 'bin/bundle' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: . -# SupportedStyles: use_perl_names, use_english_names -Style/SpecialGlobalVars: - EnforcedStyle: use_perl_names - -# Offense count: 43 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. -# SupportedStyles: single_quotes, double_quotes -Style/StringLiterals: - Exclude: - - 'bin/bundle' - - 'config/application.rb' - - 'config/environments/production.rb' - - 'config/puma.rb' - - 'db/schema.rb' - - 'test/application_system_test_case.rb' - - 'test/channels/application_cable/connection_test.rb' - -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: MinSize. -# SupportedStyles: percent, brackets -Style/SymbolArray: - EnforcedStyle: brackets - -# Offense count: 40 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 190 diff --git a/spec/integration/rails_6.0.2.1/Gemfile b/spec/integration/rails_6.0.2.1/Gemfile deleted file mode 100644 index 4d2b38e57..000000000 --- a/spec/integration/rails_6.0.2.1/Gemfile +++ /dev/null @@ -1,45 +0,0 @@ -source 'https://rubygems.org' -git_source(:github) { |repo| "https://github.com/#{repo}.git" } - -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 6.0.2', '>= 6.0.2.1' -# Use sqlite3 as the database for Active Record -gem 'sqlite3', '~> 1.4' -# Use Puma as the app server -gem 'puma', '~> 5.6.1' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.7' -# Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 4.0' -# Use Active Model has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use Active Storage variant -# gem 'image_processing', '~> 1.2' - -# Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.4.2', require: false - -group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] -end - -group :development do - gem 'annotate', path: '../../..' - - # Access an interactive console on exception pages or by calling 'console' anywhere in the code. - gem 'web-console', '>= 3.3.0' - gem 'listen', '>= 3.0.5', '< 3.2' -end - -group :test do - # Adds support for Capybara system testing and selenium driver - gem 'capybara', '>= 2.15' - gem 'selenium-webdriver' - # Easy installation and use of web drivers to run system tests with browsers - gem 'webdrivers' -end - -# Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/spec/integration/rails_6.0.2.1/Gemfile.lock b/spec/integration/rails_6.0.2.1/Gemfile.lock deleted file mode 100644 index da8b82f98..000000000 --- a/spec/integration/rails_6.0.2.1/Gemfile.lock +++ /dev/null @@ -1,205 +0,0 @@ -PATH - remote: ../../.. - specs: - annotate (3.1.1) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) - -GEM - remote: https://rubygems.org/ - specs: - actioncable (6.0.2.1) - actionpack (= 6.0.2.1) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.0.2.1) - actionpack (= 6.0.2.1) - activejob (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) - mail (>= 2.7.1) - actionmailer (6.0.2.1) - actionpack (= 6.0.2.1) - actionview (= 6.0.2.1) - activejob (= 6.0.2.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.0.2.1) - actionview (= 6.0.2.1) - activesupport (= 6.0.2.1) - rack (~> 2.0, >= 2.0.8) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.2.1) - actionpack (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) - nokogiri (>= 1.8.5) - actionview (6.0.2.1) - activesupport (= 6.0.2.1) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.2.1) - activesupport (= 6.0.2.1) - globalid (>= 0.3.6) - activemodel (6.0.2.1) - activesupport (= 6.0.2.1) - activerecord (6.0.2.1) - activemodel (= 6.0.2.1) - activesupport (= 6.0.2.1) - activestorage (6.0.2.1) - actionpack (= 6.0.2.1) - activejob (= 6.0.2.1) - activerecord (= 6.0.2.1) - marcel (~> 0.3.1) - activesupport (6.0.2.1) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) - bindex (0.8.1) - bootsnap (1.4.5) - msgpack (~> 1.0) - builder (3.2.4) - byebug (11.1.1) - capybara (3.31.0) - addressable - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (~> 1.5) - xpath (~> 3.2) - childprocess (3.0.0) - concurrent-ruby (1.1.8) - crass (1.0.6) - erubi (1.10.0) - ffi (1.15.5) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (1.8.10) - concurrent-ruby (~> 1.0) - jbuilder (2.9.1) - activesupport (>= 4.2.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.9.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) - method_source (0.9.2) - mimemagic (0.3.10) - nokogiri (~> 1) - rake - mini_mime (1.0.2) - mini_portile2 (2.5.3) - minitest (5.14.4) - msgpack (1.3.1) - nio4r (2.5.2) - nokogiri (1.11.7) - mini_portile2 (~> 2.5.0) - racc (~> 1.4) - public_suffix (4.0.6) - puma (5.6.1) - nio4r (~> 2.0) - racc (1.5.2) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.0.2.1) - actioncable (= 6.0.2.1) - actionmailbox (= 6.0.2.1) - actionmailer (= 6.0.2.1) - actionpack (= 6.0.2.1) - actiontext (= 6.0.2.1) - actionview (= 6.0.2.1) - activejob (= 6.0.2.1) - activemodel (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) - bundler (>= 1.3.0) - railties (= 6.0.2.1) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.0.2.1) - actionpack (= 6.0.2.1) - activesupport (= 6.0.2.1) - method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) - rake (13.0.3) - rb-fsevent (0.11.0) - rb-inotify (0.10.1) - ffi (~> 1.0) - regexp_parser (1.6.0) - ruby_dep (1.5.0) - rubyzip (2.2.0) - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) - sprockets (4.0.0) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.1) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.4.2) - thor (1.0.1) - thread_safe (0.3.6) - tzinfo (1.2.9) - thread_safe (~> 0.1) - web-console (4.0.1) - actionview (>= 6.0.0) - activemodel (>= 6.0.0) - bindex (>= 0.4.0) - railties (>= 6.0.0) - webdrivers (4.2.0) - nokogiri (~> 1.6) - rubyzip (>= 1.3.0) - selenium-webdriver (>= 3.0, < 4.0) - websocket-driver (0.7.1) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - xpath (3.2.0) - nokogiri (~> 1.8) - zeitwerk (2.4.2) - -PLATFORMS - ruby - -DEPENDENCIES - annotate! - bootsnap (>= 1.4.2) - byebug - capybara (>= 2.15) - jbuilder (~> 2.7) - listen (>= 3.0.5, < 3.2) - puma (~> 5.6.1) - rails (~> 6.0.2, >= 6.0.2.1) - selenium-webdriver - sqlite3 (~> 1.4) - tzinfo-data - web-console (>= 3.3.0) - webdrivers - -BUNDLED WITH - 2.2.15 diff --git a/spec/integration/rails_6.0.2.1/README.md b/spec/integration/rails_6.0.2.1/README.md deleted file mode 100644 index 7db80e4ca..000000000 --- a/spec/integration/rails_6.0.2.1/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# README - -This README would normally document whatever steps are necessary to get the -application up and running. - -Things you may want to cover: - -* Ruby version - -* System dependencies - -* Configuration - -* Database creation - -* Database initialization - -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ... diff --git a/spec/integration/rails_6.0.2.1/Rakefile b/spec/integration/rails_6.0.2.1/Rakefile deleted file mode 100644 index e85f91391..000000000 --- a/spec/integration/rails_6.0.2.1/Rakefile +++ /dev/null @@ -1,6 +0,0 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require_relative 'config/application' - -Rails.application.load_tasks diff --git a/spec/integration/rails_6.0.2.1/app/assets/config/manifest.js b/spec/integration/rails_6.0.2.1/app/assets/config/manifest.js deleted file mode 100644 index 591819335..000000000 --- a/spec/integration/rails_6.0.2.1/app/assets/config/manifest.js +++ /dev/null @@ -1,2 +0,0 @@ -//= link_tree ../images -//= link_directory ../stylesheets .css diff --git a/spec/integration/rails_6.0.2.1/app/assets/images/.keep b/spec/integration/rails_6.0.2.1/app/assets/images/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/app/assets/stylesheets/application.css b/spec/integration/rails_6.0.2.1/app/assets/stylesheets/application.css deleted file mode 100644 index d05ea0f51..000000000 --- a/spec/integration/rails_6.0.2.1/app/assets/stylesheets/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's - * vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS - * files in this directory. Styles in this file should be added after the last require_* statement. - * It is generally better to create a new file per style scope. - * - *= require_tree . - *= require_self - */ diff --git a/spec/integration/rails_6.0.2.1/app/channels/application_cable/channel.rb b/spec/integration/rails_6.0.2.1/app/channels/application_cable/channel.rb deleted file mode 100644 index d67269728..000000000 --- a/spec/integration/rails_6.0.2.1/app/channels/application_cable/channel.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Channel < ActionCable::Channel::Base - end -end diff --git a/spec/integration/rails_6.0.2.1/app/channels/application_cable/connection.rb b/spec/integration/rails_6.0.2.1/app/channels/application_cable/connection.rb deleted file mode 100644 index 0ff5442f4..000000000 --- a/spec/integration/rails_6.0.2.1/app/channels/application_cable/connection.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Connection < ActionCable::Connection::Base - end -end diff --git a/spec/integration/rails_6.0.2.1/app/controllers/application_controller.rb b/spec/integration/rails_6.0.2.1/app/controllers/application_controller.rb deleted file mode 100644 index 09705d12a..000000000 --- a/spec/integration/rails_6.0.2.1/app/controllers/application_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ApplicationController < ActionController::Base -end diff --git a/spec/integration/rails_6.0.2.1/app/controllers/concerns/.keep b/spec/integration/rails_6.0.2.1/app/controllers/concerns/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/app/helpers/application_helper.rb b/spec/integration/rails_6.0.2.1/app/helpers/application_helper.rb deleted file mode 100644 index de6be7945..000000000 --- a/spec/integration/rails_6.0.2.1/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/spec/integration/rails_6.0.2.1/app/jobs/application_job.rb b/spec/integration/rails_6.0.2.1/app/jobs/application_job.rb deleted file mode 100644 index d394c3d10..000000000 --- a/spec/integration/rails_6.0.2.1/app/jobs/application_job.rb +++ /dev/null @@ -1,7 +0,0 @@ -class ApplicationJob < ActiveJob::Base - # Automatically retry jobs that encountered a deadlock - # retry_on ActiveRecord::Deadlocked - - # Most jobs are safe to ignore if the underlying records are no longer available - # discard_on ActiveJob::DeserializationError -end diff --git a/spec/integration/rails_6.0.2.1/app/mailers/application_mailer.rb b/spec/integration/rails_6.0.2.1/app/mailers/application_mailer.rb deleted file mode 100644 index 286b2239d..000000000 --- a/spec/integration/rails_6.0.2.1/app/mailers/application_mailer.rb +++ /dev/null @@ -1,4 +0,0 @@ -class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' - layout 'mailer' -end diff --git a/spec/integration/rails_6.0.2.1/app/models/application_record.rb b/spec/integration/rails_6.0.2.1/app/models/application_record.rb deleted file mode 100644 index 10a4cba84..000000000 --- a/spec/integration/rails_6.0.2.1/app/models/application_record.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationRecord < ActiveRecord::Base - self.abstract_class = true -end diff --git a/spec/integration/rails_6.0.2.1/app/models/concerns/.keep b/spec/integration/rails_6.0.2.1/app/models/concerns/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/app/models/task.rb b/spec/integration/rails_6.0.2.1/app/models/task.rb deleted file mode 100644 index 3c2342421..000000000 --- a/spec/integration/rails_6.0.2.1/app/models/task.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Task < ApplicationRecord -end diff --git a/spec/integration/rails_6.0.2.1/app/views/layouts/application.html.erb b/spec/integration/rails_6.0.2.1/app/views/layouts/application.html.erb deleted file mode 100644 index ba0f86cb7..000000000 --- a/spec/integration/rails_6.0.2.1/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Rails6021 - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - <%= stylesheet_link_tag 'application', media: 'all' %> - - - - <%= yield %> - - diff --git a/spec/integration/rails_6.0.2.1/app/views/layouts/mailer.html.erb b/spec/integration/rails_6.0.2.1/app/views/layouts/mailer.html.erb deleted file mode 100644 index cbd34d2e9..000000000 --- a/spec/integration/rails_6.0.2.1/app/views/layouts/mailer.html.erb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - <%= yield %> - - diff --git a/spec/integration/rails_6.0.2.1/app/views/layouts/mailer.text.erb b/spec/integration/rails_6.0.2.1/app/views/layouts/mailer.text.erb deleted file mode 100644 index 37f0bddbd..000000000 --- a/spec/integration/rails_6.0.2.1/app/views/layouts/mailer.text.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yield %> diff --git a/spec/integration/rails_6.0.2.1/bin/bundle b/spec/integration/rails_6.0.2.1/bin/bundle deleted file mode 100755 index 524dfd3f2..000000000 --- a/spec/integration/rails_6.0.2.1/bin/bundle +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'bundle' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "rubygems" - -m = Module.new do - module_function - - def invoked_as_script? - File.expand_path($0) == File.expand_path(__FILE__) - end - - def env_var_version - ENV["BUNDLER_VERSION"] - end - - def cli_arg_version - return unless invoked_as_script? # don't want to hijack other binstubs - return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` - bundler_version = nil - update_index = nil - ARGV.each_with_index do |a, i| - if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN - bundler_version = a - end - next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ - bundler_version = $1 || ">= 0.a" - update_index = i - end - bundler_version - end - - def gemfile - gemfile = ENV["BUNDLE_GEMFILE"] - return gemfile if gemfile && !gemfile.empty? - - File.expand_path("../../Gemfile", __FILE__) - end - - def lockfile - lockfile = - case File.basename(gemfile) - when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) - else "#{gemfile}.lock" - end - File.expand_path(lockfile) - end - - def lockfile_version - return unless File.file?(lockfile) - lockfile_contents = File.read(lockfile) - return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ - Regexp.last_match(1) - end - - def bundler_version - @bundler_version ||= begin - env_var_version || cli_arg_version || - lockfile_version || "#{Gem::Requirement.default}.a" - end - end - - def load_bundler! - ENV["BUNDLE_GEMFILE"] ||= gemfile - - # must dup string for RG < 1.8 compatibility - activate_bundler(bundler_version.dup) - end - - def activate_bundler(bundler_version) - if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0") - bundler_version = "< 2" - end - gem_error = activation_error_handling do - gem "bundler", bundler_version - end - return if gem_error.nil? - require_error = activation_error_handling do - require "bundler/version" - end - return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION)) - warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`" - exit 42 - end - - def activation_error_handling - yield - nil - rescue StandardError, LoadError => e - e - end -end - -m.load_bundler! - -if m.invoked_as_script? - load Gem.bin_path("bundler", "bundle") -end diff --git a/spec/integration/rails_6.0.2.1/bin/rails b/spec/integration/rails_6.0.2.1/bin/rails deleted file mode 100755 index 073966023..000000000 --- a/spec/integration/rails_6.0.2.1/bin/rails +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' diff --git a/spec/integration/rails_6.0.2.1/bin/rake b/spec/integration/rails_6.0.2.1/bin/rake deleted file mode 100755 index 17240489f..000000000 --- a/spec/integration/rails_6.0.2.1/bin/rake +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' -Rake.application.run diff --git a/spec/integration/rails_6.0.2.1/bin/setup b/spec/integration/rails_6.0.2.1/bin/setup deleted file mode 100755 index 0e39e8cb1..000000000 --- a/spec/integration/rails_6.0.2.1/bin/setup +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env ruby -require 'fileutils' - -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) - -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") -end - -FileUtils.chdir APP_ROOT do - # This script is a way to setup or update your development environment automatically. - # This script is idempotent, so that you can run it at anytime and get an expectable outcome. - # Add necessary setup steps to this file. - - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - - # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' - # end - - puts "\n== Preparing database ==" - system! 'bin/rails db:prepare' - - puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' - - puts "\n== Restarting application server ==" - system! 'bin/rails restart' -end diff --git a/spec/integration/rails_6.0.2.1/config.ru b/spec/integration/rails_6.0.2.1/config.ru deleted file mode 100644 index f7ba0b527..000000000 --- a/spec/integration/rails_6.0.2.1/config.ru +++ /dev/null @@ -1,5 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require_relative 'config/environment' - -run Rails.application diff --git a/spec/integration/rails_6.0.2.1/config/application.rb b/spec/integration/rails_6.0.2.1/config/application.rb deleted file mode 100644 index fd711df93..000000000 --- a/spec/integration/rails_6.0.2.1/config/application.rb +++ /dev/null @@ -1,33 +0,0 @@ -require_relative 'boot' - -require "rails" -# Pick the frameworks you want: -require "active_model/railtie" -require "active_job/railtie" -require "active_record/railtie" -require "active_storage/engine" -require "action_controller/railtie" -require "action_mailer/railtie" -require "action_mailbox/engine" -require "action_text/engine" -require "action_view/railtie" -require "action_cable/engine" -# require "sprockets/railtie" -require "rails/test_unit/railtie" - -# Require the gems listed in Gemfile, including any gems -# you've limited to :test, :development, or :production. -Bundler.require(*Rails.groups) - -module Rails6021 - class Application < Rails::Application - # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.0 - - # Settings in config/environments/* take precedence over those specified here. - # Application configuration can go into files in config/initializers - # -- all .rb files in that directory are automatically loaded after loading - # the framework and any gems in your application. - self.paths['config/database'] = 'config/multi-database.yml' if ENV['MULTI_DB'] - end -end diff --git a/spec/integration/rails_6.0.2.1/config/boot.rb b/spec/integration/rails_6.0.2.1/config/boot.rb deleted file mode 100644 index b9e460cef..000000000 --- a/spec/integration/rails_6.0.2.1/config/boot.rb +++ /dev/null @@ -1,4 +0,0 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) - -require 'bundler/setup' # Set up gems listed in the Gemfile. -require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/spec/integration/rails_6.0.2.1/config/cable.yml b/spec/integration/rails_6.0.2.1/config/cable.yml deleted file mode 100644 index 3b0858c95..000000000 --- a/spec/integration/rails_6.0.2.1/config/cable.yml +++ /dev/null @@ -1,10 +0,0 @@ -development: - adapter: async - -test: - adapter: test - -production: - adapter: redis - url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: rails_6_0_2_1_production diff --git a/spec/integration/rails_6.0.2.1/config/credentials.yml.enc b/spec/integration/rails_6.0.2.1/config/credentials.yml.enc deleted file mode 100644 index 51e9ebc8c..000000000 --- a/spec/integration/rails_6.0.2.1/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -p9Ehs8NhqPrCcIMQWQwVqNKvXN0NnrY9Yn6zbHOJXv80LRwTVw+xrcK2pSr0Df3P42D9SQCzCkooDopjCRd3Rd2AGAj5oYybs8//J+YdDKxsEjdB8R2KG7A+fbLlztq2bHoPNvO9wU22fobO8ANxEV5JuqeLyBukcuzztNm5ZHuufp0J2ltSXJuX7rEToELKTob+g+PnecvmwGzTTQzBiZ2jMmaGqWXESXc4Y6VsnBjj1H6Xs/T4OXiq2rLBulV3NR5/orof2GJKV5ohX1U3z0jZzLPUflgDtPvJN4UieTiqpKa9Umibtdd3TOR/aj7uoXj0Tq9FYG3dIMqsWpUb1133zcYzWsyxbC2dXVvpga4/LsQE2/74I+n1WXC5zH30STOYWJpdhEn0S9I4kq+xwzMAJKALI9BzvgZL--9deAjVLbz0BaSSau--9gVti9PVO/wgBKe5nsl8Ow== \ No newline at end of file diff --git a/spec/integration/rails_6.0.2.1/config/database.yml b/spec/integration/rails_6.0.2.1/config/database.yml deleted file mode 100644 index 4a8a1b26f..000000000 --- a/spec/integration/rails_6.0.2.1/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite. Versions 3.8.0 and up are supported. -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# -default: &default - adapter: sqlite3 - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - timeout: 5000 - -development: - <<: *default - database: db/development.sqlite3 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - <<: *default - database: db/test.sqlite3 - -production: - <<: *default - database: db/production.sqlite3 diff --git a/spec/integration/rails_6.0.2.1/config/environment.rb b/spec/integration/rails_6.0.2.1/config/environment.rb deleted file mode 100644 index 426333bb4..000000000 --- a/spec/integration/rails_6.0.2.1/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the Rails application. -require_relative 'application' - -# Initialize the Rails application. -Rails.application.initialize! diff --git a/spec/integration/rails_6.0.2.1/config/environments/development.rb b/spec/integration/rails_6.0.2.1/config/environments/development.rb deleted file mode 100644 index 298f8d4b3..000000000 --- a/spec/integration/rails_6.0.2.1/config/environments/development.rb +++ /dev/null @@ -1,55 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Do not eager load code on boot. - config.eager_load = false - - # Show full error reports. - config.consider_all_requests_local = true - - # Enable/disable caching. By default caching is disabled. - # Run rails dev:cache to toggle caching. - if Rails.root.join('tmp', 'caching-dev.txt').exist? - config.action_controller.perform_caching = true - config.action_controller.enable_fragment_cache_logging = true - - config.cache_store = :memory_store - config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.to_i}" - } - else - config.action_controller.perform_caching = false - - config.cache_store = :null_store - end - - # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local - - # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false - - config.action_mailer.perform_caching = false - - # Print deprecation notices to the Rails logger. - config.active_support.deprecation = :log - - # Raise an error on page load if there are pending migrations. - config.active_record.migration_error = :page_load - - # Highlight code that triggered database queries in logs. - config.active_record.verbose_query_logs = true - - - # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true - - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. - config.file_watcher = ActiveSupport::EventedFileUpdateChecker -end diff --git a/spec/integration/rails_6.0.2.1/config/environments/production.rb b/spec/integration/rails_6.0.2.1/config/environments/production.rb deleted file mode 100644 index 5ce0e884d..000000000 --- a/spec/integration/rails_6.0.2.1/config/environments/production.rb +++ /dev/null @@ -1,106 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # Code is not reloaded between requests. - config.cache_classes = true - - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. - config.eager_load = true - - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] - # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). - # config.require_master_key = true - - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? - - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' - - # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - - # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local - - # Mount Action Cable outside main process or domain. - # config.action_cable.mount_path = nil - # config.action_cable.url = 'wss://example.com/cable' - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. - config.log_level = :debug - - # Prepend all log lines with the following tags. - config.log_tags = [ :request_id ] - - # Use a different cache store in production. - # config.cache_store = :mem_cache_store - - # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "rails_6_0_2_1_production" - - config.action_mailer.perform_caching = false - - # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to raise delivery errors. - # config.action_mailer.raise_delivery_errors = false - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Use a different logger for distributed setups. - # require 'syslog/logger' - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') - - if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end - - # Do not dump schema after migrations. - config.active_record.dump_schema_after_migration = false - - # Inserts middleware to perform automatic connection switching. - # The `database_selector` hash is used to pass options to the DatabaseSelector - # middleware. The `delay` is used to determine how long to wait after a write - # to send a subsequent read to the primary. - # - # The `database_resolver` class is used by the middleware to determine which - # database is appropriate to use based on the time delay. - # - # The `database_resolver_context` class is used by the middleware to set - # timestamps for the last write to the primary. The resolver uses the context - # class timestamps to determine how long to wait before reading from the - # replica. - # - # By default Rails will store a last write timestamp in the session. The - # DatabaseSelector middleware is designed as such you can define your own - # strategy for connection switching and pass that into the middleware through - # these configuration options. - # config.active_record.database_selector = { delay: 2.seconds } - # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver - # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session -end diff --git a/spec/integration/rails_6.0.2.1/config/environments/test.rb b/spec/integration/rails_6.0.2.1/config/environments/test.rb deleted file mode 100644 index 470dee4be..000000000 --- a/spec/integration/rails_6.0.2.1/config/environments/test.rb +++ /dev/null @@ -1,48 +0,0 @@ -# The test environment is used exclusively to run your application's -# test suite. You never need to work with it otherwise. Remember that -# your test database is "scratch space" for the test suite and is wiped -# and recreated between test runs. Don't rely on the data there! - -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - config.cache_classes = true - - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false - - # Configure public file server for tests with Cache-Control for performance. - config.public_file_server.enabled = true - config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{1.hour.to_i}" - } - - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - config.cache_store = :null_store - - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment. - config.action_controller.allow_forgery_protection = false - - # Store uploaded files on the local file system in a temporary directory. - config.active_storage.service = :test - - config.action_mailer.perform_caching = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Print deprecation notices to the stderr. - config.active_support.deprecation = :stderr - - # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true -end diff --git a/spec/integration/rails_6.0.2.1/config/initializers/application_controller_renderer.rb b/spec/integration/rails_6.0.2.1/config/initializers/application_controller_renderer.rb deleted file mode 100644 index 89d2efab2..000000000 --- a/spec/integration/rails_6.0.2.1/config/initializers/application_controller_renderer.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# ActiveSupport::Reloader.to_prepare do -# ApplicationController.renderer.defaults.merge!( -# http_host: 'example.org', -# https: false -# ) -# end diff --git a/spec/integration/rails_6.0.2.1/config/initializers/backtrace_silencers.rb b/spec/integration/rails_6.0.2.1/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cdf3..000000000 --- a/spec/integration/rails_6.0.2.1/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/integration/rails_6.0.2.1/config/initializers/content_security_policy.rb b/spec/integration/rails_6.0.2.1/config/initializers/content_security_policy.rb deleted file mode 100644 index 41c43016f..000000000 --- a/spec/integration/rails_6.0.2.1/config/initializers/content_security_policy.rb +++ /dev/null @@ -1,28 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy - -# Rails.application.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" -# end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/spec/integration/rails_6.0.2.1/config/initializers/cookies_serializer.rb b/spec/integration/rails_6.0.2.1/config/initializers/cookies_serializer.rb deleted file mode 100644 index 5a6a32d37..000000000 --- a/spec/integration/rails_6.0.2.1/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Specify a serializer for the signed and encrypted cookie jars. -# Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/spec/integration/rails_6.0.2.1/config/initializers/filter_parameter_logging.rb b/spec/integration/rails_6.0.2.1/config/initializers/filter_parameter_logging.rb deleted file mode 100644 index 4a994e1e7..000000000 --- a/spec/integration/rails_6.0.2.1/config/initializers/filter_parameter_logging.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] diff --git a/spec/integration/rails_6.0.2.1/config/initializers/inflections.rb b/spec/integration/rails_6.0.2.1/config/initializers/inflections.rb deleted file mode 100644 index ac033bf9d..000000000 --- a/spec/integration/rails_6.0.2.1/config/initializers/inflections.rb +++ /dev/null @@ -1,16 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format. Inflections -# are locale specific, and you may define rules for as many different -# locales as you wish. All of these examples are active by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end - -# These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' -# end diff --git a/spec/integration/rails_6.0.2.1/config/initializers/mime_types.rb b/spec/integration/rails_6.0.2.1/config/initializers/mime_types.rb deleted file mode 100644 index dc1899682..000000000 --- a/spec/integration/rails_6.0.2.1/config/initializers/mime_types.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf diff --git a/spec/integration/rails_6.0.2.1/config/initializers/wrap_parameters.rb b/spec/integration/rails_6.0.2.1/config/initializers/wrap_parameters.rb deleted file mode 100644 index bbfc3961b..000000000 --- a/spec/integration/rails_6.0.2.1/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/spec/integration/rails_6.0.2.1/config/locales/en.yml b/spec/integration/rails_6.0.2.1/config/locales/en.yml deleted file mode 100644 index cf9b342d0..000000000 --- a/spec/integration/rails_6.0.2.1/config/locales/en.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. -# -# To use the locales, use `I18n.t`: -# -# I18n.t 'hello' -# -# In views, this is aliased to just `t`: -# -# <%= t('hello') %> -# -# To use a different locale, set it with `I18n.locale`: -# -# I18n.locale = :es -# -# This would use the information in config/locales/es.yml. -# -# The following keys must be escaped otherwise they will not be retrieved by -# the default I18n backend: -# -# true, false, on, off, yes, no -# -# Instead, surround them with single quotes. -# -# en: -# 'true': 'foo' -# -# To learn more, please read the Rails Internationalization guide -# available at https://guides.rubyonrails.org/i18n.html. - -en: - hello: "Hello world" diff --git a/spec/integration/rails_6.0.2.1/config/multi-database.yml b/spec/integration/rails_6.0.2.1/config/multi-database.yml deleted file mode 100644 index 1dbe6d6a9..000000000 --- a/spec/integration/rails_6.0.2.1/config/multi-database.yml +++ /dev/null @@ -1,37 +0,0 @@ -# SQLite. Versions 3.8.0 and up are supported. -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# -default: &default - adapter: sqlite3 - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - timeout: 5000 - -development: - primary: - <<: *default - database: db/development.sqlite3 - secondary: - <<: *default - database: db/development-secondary.sqlite3 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - primary: - <<: *default - database: db/test.sqlite3 - secondary: - <<: *default - database: db/test-secondary.sqlite3 - -production: - primary: - <<: *default - database: db/production.sqlite3 - secondary: - <<: *default - database: db/production-secondary.sqlite3 diff --git a/spec/integration/rails_6.0.2.1/config/puma.rb b/spec/integration/rails_6.0.2.1/config/puma.rb deleted file mode 100644 index 5ed443774..000000000 --- a/spec/integration/rails_6.0.2.1/config/puma.rb +++ /dev/null @@ -1,38 +0,0 @@ -# Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers: a minimum and maximum. -# Any libraries that use thread pools should be configured to match -# the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum; this matches the default thread size of Active Record. -# -max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } -threads min_threads_count, max_threads_count - -# Specifies the `port` that Puma will listen on to receive requests; default is 3000. -# -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. -# -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the `pidfile` that Puma will use. -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } - -# Specifies the number of `workers` to boot in clustered mode. -# Workers are forked web server processes. If using threads and workers together -# the concurrency of the application would be max `threads` * `workers`. -# Workers do not work on JRuby or Windows (both of which do not support -# processes). -# -# workers ENV.fetch("WEB_CONCURRENCY") { 2 } - -# Use the `preload_app!` method when specifying a `workers` number. -# This directive tells Puma to first boot the application and load code -# before forking the application. This takes advantage of Copy On Write -# process behavior so workers use less memory. -# -# preload_app! - -# Allow puma to be restarted by `rails restart` command. -plugin :tmp_restart diff --git a/spec/integration/rails_6.0.2.1/config/routes.rb b/spec/integration/rails_6.0.2.1/config/routes.rb deleted file mode 100644 index b735f52f4..000000000 --- a/spec/integration/rails_6.0.2.1/config/routes.rb +++ /dev/null @@ -1,4 +0,0 @@ -Rails.application.routes.draw do - # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html - resources :tasks -end diff --git a/spec/integration/rails_6.0.2.1/config/storage.yml b/spec/integration/rails_6.0.2.1/config/storage.yml deleted file mode 100644 index d32f76e8f..000000000 --- a/spec/integration/rails_6.0.2.1/config/storage.yml +++ /dev/null @@ -1,34 +0,0 @@ -test: - service: Disk - root: <%= Rails.root.join("tmp/storage") %> - -local: - service: Disk - root: <%= Rails.root.join("storage") %> - -# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) -# amazon: -# service: S3 -# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> -# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> -# region: us-east-1 -# bucket: your_own_bucket - -# Remember not to checkin your GCS keyfile to a repository -# google: -# service: GCS -# project: your_project -# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> -# bucket: your_own_bucket - -# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) -# microsoft: -# service: AzureStorage -# storage_account_name: your_account_name -# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> -# container: your_container_name - -# mirror: -# service: Mirror -# primary: local -# mirrors: [ amazon, google, microsoft ] diff --git a/spec/integration/rails_6.0.2.1/db/migrate/20200201204456_create_tasks.rb b/spec/integration/rails_6.0.2.1/db/migrate/20200201204456_create_tasks.rb deleted file mode 100644 index 42e0141d1..000000000 --- a/spec/integration/rails_6.0.2.1/db/migrate/20200201204456_create_tasks.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateTasks < ActiveRecord::Migration[6.0] - def change - create_table :tasks do |t| - t.string :content - t.integer :count, default: 0 - t.boolean :status, default: false - - t.timestamps - end - end -end diff --git a/spec/integration/rails_6.0.2.1/db/schema.rb b/spec/integration/rails_6.0.2.1/db/schema.rb deleted file mode 100644 index 69b014dfd..000000000 --- a/spec/integration/rails_6.0.2.1/db/schema.rb +++ /dev/null @@ -1,23 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# This file is the source Rails uses to define your schema when running `rails -# db:schema:load`. When creating a new database, `rails db:schema:load` tends to -# be faster and is potentially less error prone than running all of your -# migrations from scratch. Old migrations may fail to apply correctly if those -# migrations use external dependencies or application code. -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema.define(version: 2020_02_01_204456) do - - create_table "tasks", force: :cascade do |t| - t.string "content" - t.integer "count", default: 0 - t.boolean "status", default: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - end - -end diff --git a/spec/integration/rails_6.0.2.1/db/seeds.rb b/spec/integration/rails_6.0.2.1/db/seeds.rb deleted file mode 100644 index 1beea2acc..000000000 --- a/spec/integration/rails_6.0.2.1/db/seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). -# -# Examples: -# -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) diff --git a/spec/integration/rails_6.0.2.1/lib/assets/.keep b/spec/integration/rails_6.0.2.1/lib/assets/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/lib/tasks/.keep b/spec/integration/rails_6.0.2.1/lib/tasks/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/log/.keep b/spec/integration/rails_6.0.2.1/log/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/public/404.html b/spec/integration/rails_6.0.2.1/public/404.html deleted file mode 100644 index 2be3af26f..000000000 --- a/spec/integration/rails_6.0.2.1/public/404.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - - -
-
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/integration/rails_6.0.2.1/public/422.html b/spec/integration/rails_6.0.2.1/public/422.html deleted file mode 100644 index c08eac0d1..000000000 --- a/spec/integration/rails_6.0.2.1/public/422.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - - -
-
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/integration/rails_6.0.2.1/public/500.html b/spec/integration/rails_6.0.2.1/public/500.html deleted file mode 100644 index 78a030af2..000000000 --- a/spec/integration/rails_6.0.2.1/public/500.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - - -
-
-

We're sorry, but something went wrong.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/integration/rails_6.0.2.1/public/apple-touch-icon-precomposed.png b/spec/integration/rails_6.0.2.1/public/apple-touch-icon-precomposed.png deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/public/apple-touch-icon.png b/spec/integration/rails_6.0.2.1/public/apple-touch-icon.png deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/public/favicon.ico b/spec/integration/rails_6.0.2.1/public/favicon.ico deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/public/robots.txt b/spec/integration/rails_6.0.2.1/public/robots.txt deleted file mode 100644 index c19f78ab6..000000000 --- a/spec/integration/rails_6.0.2.1/public/robots.txt +++ /dev/null @@ -1 +0,0 @@ -# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/spec/integration/rails_6.0.2.1/storage/.keep b/spec/integration/rails_6.0.2.1/storage/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/application_system_test_case.rb b/spec/integration/rails_6.0.2.1/test/application_system_test_case.rb deleted file mode 100644 index d19212abd..000000000 --- a/spec/integration/rails_6.0.2.1/test/application_system_test_case.rb +++ /dev/null @@ -1,5 +0,0 @@ -require "test_helper" - -class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, using: :chrome, screen_size: [1400, 1400] -end diff --git a/spec/integration/rails_6.0.2.1/test/channels/application_cable/connection_test.rb b/spec/integration/rails_6.0.2.1/test/channels/application_cable/connection_test.rb deleted file mode 100644 index 800405f15..000000000 --- a/spec/integration/rails_6.0.2.1/test/channels/application_cable/connection_test.rb +++ /dev/null @@ -1,11 +0,0 @@ -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 diff --git a/spec/integration/rails_6.0.2.1/test/controllers/.keep b/spec/integration/rails_6.0.2.1/test/controllers/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/fixtures/.keep b/spec/integration/rails_6.0.2.1/test/fixtures/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/fixtures/files/.keep b/spec/integration/rails_6.0.2.1/test/fixtures/files/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/fixtures/tasks.yml b/spec/integration/rails_6.0.2.1/test/fixtures/tasks.yml deleted file mode 100644 index c9b9807d6..000000000 --- a/spec/integration/rails_6.0.2.1/test/fixtures/tasks.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - content: MyString - count: 1 - status: false - -two: - content: MyString - count: 1 - status: false diff --git a/spec/integration/rails_6.0.2.1/test/helpers/.keep b/spec/integration/rails_6.0.2.1/test/helpers/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/integration/.keep b/spec/integration/rails_6.0.2.1/test/integration/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/mailers/.keep b/spec/integration/rails_6.0.2.1/test/mailers/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/models/.keep b/spec/integration/rails_6.0.2.1/test/models/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/models/task_test.rb b/spec/integration/rails_6.0.2.1/test/models/task_test.rb deleted file mode 100644 index 3ca215970..000000000 --- a/spec/integration/rails_6.0.2.1/test/models/task_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class TaskTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/spec/integration/rails_6.0.2.1/test/system/.keep b/spec/integration/rails_6.0.2.1/test/system/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/test/test_helper.rb b/spec/integration/rails_6.0.2.1/test/test_helper.rb deleted file mode 100644 index d5300f88c..000000000 --- a/spec/integration/rails_6.0.2.1/test/test_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -ENV['RAILS_ENV'] ||= 'test' -require_relative '../config/environment' -require 'rails/test_help' - -class ActiveSupport::TestCase - # Run tests in parallel with specified workers - parallelize(workers: :number_of_processors) - - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - fixtures :all - - # Add more helper methods to be used by all tests here... -end diff --git a/spec/integration/rails_6.0.2.1/tmp/.keep b/spec/integration/rails_6.0.2.1/tmp/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1/vendor/.keep b/spec/integration/rails_6.0.2.1/vendor/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/integration/rails_6.0.2.1_spec.rb b/spec/integration/rails_6.0.2.1_spec.rb deleted file mode 100644 index 413ebddae..000000000 --- a/spec/integration/rails_6.0.2.1_spec.rb +++ /dev/null @@ -1,200 +0,0 @@ -require 'bundler' -require 'rspec' -require 'git' -require_relative 'integration_helper' - -describe 'Integration testing on Rails 6.0.2.1', if: IntegrationHelper.able_to_run?(__FILE__, RUBY_VERSION) do - ::RAILS_6_0_APP_NAME = 'rails_6.0.2.1'.freeze - ::RAILS_6_0_PROJECT_PATH = File.expand_path('../..', __dir__).freeze - ::RAILS_6_0_APP_PATH = File.expand_path(RAILS_6_0_APP_NAME, __dir__).freeze - - let!(:git) { Git.open(RAILS_6_0_PROJECT_PATH) } - let(:task_model) do - patch = <<~PATCH - +# == Schema Information - +# - +# Table name: tasks - +# - +# id :integer not null, primary key - +# content :string - +# count :integer default(0) - +# status :boolean default(FALSE) - +# created_at :datetime not null - +# updated_at :datetime not null - +# - PATCH - - path = 'app/models/task.rb' - { - path: include(path), - patch: include(patch) - } - end - let(:task_test) do - patch = <<~PATCH - +# == Schema Information - +# - +# Table name: tasks - +# - +# id :integer not null, primary key - +# content :string - +# count :integer default(0) - +# status :boolean default(FALSE) - +# created_at :datetime not null - +# updated_at :datetime not null - +# - PATCH - - path = 'test/models/task_test.rb' - { - path: include(path), - patch: include(patch) - } - end - let(:task_fixture) do - patch = <<~PATCH - +# == Schema Information - +# - +# Table name: tasks - +# - +# id :integer not null, primary key - +# content :string - +# count :integer default(0) - +# status :boolean default(FALSE) - +# created_at :datetime not null - +# updated_at :datetime not null - +# - PATCH - - path = 'test/fixtures/tasks.yml' - { - path: include(path), - patch: include(patch) - } - end - - before(:all) do - Bundler.with_clean_env do - Dir.chdir RAILS_6_0_APP_PATH do - puts `bundle install` - puts `bin/rails db:migrate` - end - end - end - - around(:each) do |example| - Bundler.with_clean_env do - Dir.chdir RAILS_6_0_APP_PATH do - example.run - end - end - end - - after(:each) do - git.reset_hard - end - - describe 'annotate --models' do - let(:command) { 'bundle exec annotate --models' } - - it 'annotate models' do - expect(git.diff.any?).to be_falsy - - puts `#{command}` - - expect(git.diff.entries).to contain_exactly( - an_object_having_attributes(task_model), - an_object_having_attributes(task_test), - an_object_having_attributes(task_fixture) - ) - end - end - - describe 'annotate --routes' do - let(:command) { 'bundle exec annotate --routes' } - - let(:task_routes) do - task_routes_diff = <<-DIFF -+# == Route Map -+# -+# Prefix Verb URI Pattern Controller#Action -+# tasks GET /tasks(.:format) tasks#index -+# POST /tasks(.:format) tasks#create -+# new_task GET /tasks/new(.:format) tasks#new -+# edit_task GET /tasks/:id/edit(.:format) tasks#edit -+# task GET /tasks/:id(.:format) tasks#show -+# PATCH /tasks/:id(.:format) tasks#update -+# PUT /tasks/:id(.:format) tasks#update -+# DELETE /tasks/:id(.:format) tasks#destroy - DIFF - - default_routes_diff = <<-DIFF -+# rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create -+# rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create -+# rails_relay_inbound_emails POST /rails/action_mailbox/relay/inbound_emails(.:format) action_mailbox/ingresses/relay/inbound_emails#create -+# rails_sendgrid_inbound_emails POST /rails/action_mailbox/sendgrid/inbound_emails(.:format) action_mailbox/ingresses/sendgrid/inbound_emails#create -+# rails_mailgun_inbound_emails POST /rails/action_mailbox/mailgun/inbound_emails/mime(.:format) action_mailbox/ingresses/mailgun/inbound_emails#create -+# rails_conductor_inbound_emails GET /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#index -+# POST /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#create -+# new_rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/new(.:format) rails/conductor/action_mailbox/inbound_emails#new -+# edit_rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id/edit(.:format) rails/conductor/action_mailbox/inbound_emails#edit -+# rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#show -+# PATCH /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#update -+# PUT /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#update -+# DELETE /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#destroy -+# rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create -+# rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show -+# rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show -+# rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show -+# update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update -+# rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create - DIFF - - - path = 'config/routes.rb' - { - path: include(path), - patch: include(task_routes_diff, default_routes_diff) - } - end - - it 'annotate routes.rb' do - expect(git.diff.any?).to be_falsy - - puts `#{command}` - - expect(git.diff.entries).to contain_exactly(an_object_having_attributes(task_routes)) - end - end - - describe 'rails g annotate:install' do - let(:command) { 'bin/rails g annotate:install' } - let(:rake_file_path) { 'lib/tasks/auto_annotate_models.rake' } - let(:full_path) { File.expand_path(rake_file_path) } - - after(:each) do - File.delete(full_path) - end - - it 'generates the rake file' do - expect { `#{command}` }.to change { File.exist?(rake_file_path) }.from(false).to(true) - end - - context 'with multi-db environment' do - let(:migrate_command) { 'bin/rails db:migrate:primary' } - - it 'hooks database-specific commands and annotates models' do - expect(git.diff.any?).to be_falsy - - system({ 'MULTI_DB' => 'true' }, command) - system({ 'MULTI_DB' => 'true' }, migrate_command) - - expect(git.diff.entries).to contain_exactly( - an_object_having_attributes(task_model), - an_object_having_attributes(task_test), - an_object_having_attributes(task_fixture) - ) - end - end - end -end diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index c813139a2..f712b1ad9 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -19,7 +19,7 @@ '# frozen_string_literal: true', '#frozen_string_literal: false', '# -*- frozen_string_literal : true -*-' - ].freeze + ].freeze unless const_defined?(:MAGIC_COMMENTS) def mock_index(name, params = {}) double('IndexKeyDefinition', diff --git a/spec/lib/annotate/annotate_routes_spec.rb b/spec/lib/annotate/annotate_routes_spec.rb index a0ed118cc..805aec66c 100644 --- a/spec/lib/annotate/annotate_routes_spec.rb +++ b/spec/lib/annotate/annotate_routes_spec.rb @@ -21,7 +21,7 @@ '# frozen_string_literal: true', '#frozen_string_literal: false', '# -*- frozen_string_literal : true -*-' - ].freeze + ].freeze unless const_defined?(:MAGIC_COMMENTS) let :stubs do {} From ae0b79c0f816b2433a3f00b9a73b3aea1bd3e84b Mon Sep 17 00:00:00 2001 From: "Andrew W. Lee" Date: Fri, 24 Jun 2022 06:51:33 -0700 Subject: [PATCH 02/11] Make specs run in random order (#787) --- spec/spec_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5b68b3636..91df96e3b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,3 +33,7 @@ require 'annotate/helpers' require 'annotate/constants' require 'byebug' + +RSpec.configure do |config| + config.order = 'random' +end From 76a18043ea7509348abc12798c603d93a4254092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lovro=20Biki=C4=87?= Date: Wed, 29 Mar 2023 10:18:24 +0200 Subject: [PATCH 03/11] Fix flaky specs (#980) Signed-off-by: Lovro Bikic --- spec/lib/annotate/annotate_models_spec.rb | 54 ++++++++++++++++------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index f712b1ad9..b5f167d67 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -153,7 +153,11 @@ def mock_column(name, type, options = {}) end before :each do - AnnotateModels.send(:parse_options, options) + AnnotateModels.parse_options(options) + end + + after :each do + AnnotateModels.parse_options({ skip_subdirectory_model_load: false }) end describe '@root_dir' do @@ -1647,6 +1651,10 @@ def mock_column(name, type, options = {}) Annotate::Helpers.true?(ENV['show_complete_foreign_keys']) end + after :each do + ENV.delete('show_complete_foreign_keys') + end + context 'when default value of "show_complete_foreign_keys" is not set' do it 'returns false' do is_expected.to be(false) @@ -1658,14 +1666,14 @@ def mock_column(name, type, options = {}) Annotate.set_defaults('show_complete_foreign_keys' => 'true') end + after do + Annotate.instance_variable_set('@has_set_defaults', false) + end + it 'returns true' do is_expected.to be(true) end end - - after :each do - ENV.delete('show_complete_foreign_keys') - end end describe '.get_patterns' do @@ -1815,8 +1823,14 @@ def mock_column(name, type, options = {}) end describe '.get_model_class' do - before :all do - AnnotateModels.model_dir = Dir.mktmpdir('annotate_models') + before :each do + @model_dir = Dir.mktmpdir('annotate_models') + AnnotateModels.model_dir = @model_dir + create(filename, file_content) + end + + after :each do + FileUtils.remove_dir(@model_dir, true) end # TODO: use 'files' gem instead @@ -1829,10 +1843,6 @@ def create(filename, file_content) end end - before :each do - create(filename, file_content) - end - let :klass do AnnotateModels.get_model_class(File.join(AnnotateModels.model_dir[0], filename)) end @@ -2113,7 +2123,9 @@ class Foo < ActiveRecord::Base let :file_content_2 do <<-EOS - class Bar::Foo < ActiveRecord::Base + module Bar + class Foo < ActiveRecord::Base + end end EOS end @@ -2146,7 +2158,9 @@ class Foo < ActiveRecord::Base let :file_content_2 do <<-EOS - class Bar::Foo < ActiveRecord::Base + module Bar + class Foo < ActiveRecord::Base + end end EOS end @@ -2163,6 +2177,7 @@ class Bar::Foo < ActiveRecord::Base it 'attempts to load the model path without expanding if skip_subdirectory_model_load is false' do allow(AnnotateModels).to receive(:skip_subdirectory_model_load).and_return(false) full_path = File.join(AnnotateModels.model_dir[0], filename_2) + Kernel.load(full_path) expect(File).to_not receive(:expand_path).with(full_path) AnnotateModels.get_model_class(full_path) end @@ -2171,6 +2186,7 @@ class Bar::Foo < ActiveRecord::Base $LOAD_PATH.unshift(AnnotateModels.model_dir[0]) allow(AnnotateModels).to receive(:skip_subdirectory_model_load).and_return(true) full_path = File.join(AnnotateModels.model_dir[0], filename_2) + Kernel.load(full_path) expect(File).to receive(:expand_path).with(full_path).and_call_original AnnotateModels.get_model_class(full_path) end @@ -2218,6 +2234,10 @@ class Foo < ActiveRecord::Base AnnotateModels.remove_annotation_of_file(path) end + after :each do + FileUtils.remove_dir(tmpdir, true) + end + let :tmpdir do Dir.mktmpdir('annotate_models') end @@ -2502,7 +2522,7 @@ class Foo < ActiveRecord::Base end describe 'annotating a file' do - before do + before :each do @model_dir = Dir.mktmpdir('annotate_models') (@model_file_name, @file_content) = write_model 'user.rb', <<~EOS class User < ActiveRecord::Base @@ -2519,6 +2539,10 @@ class User < ActiveRecord::Base Annotate::Helpers.reset_options(Annotate::Constants::ALL_ANNOTATE_OPTIONS) end + after :each do + FileUtils.remove_dir(@model_dir, true) + end + def write_model(file_name, file_content) fname = File.join(@model_dir, file_name) FileUtils.mkdir_p(File.dirname(fname)) @@ -2531,7 +2555,7 @@ def annotate_one_file(options = {}) Annotate.set_defaults(options) options = Annotate.setup_options(options) AnnotateModels.annotate_one_file(@model_file_name, @schema_info, :position_in_class, options) - + ensure # Wipe settings so the next call will pick up new values... Annotate.instance_variable_set('@has_set_defaults', false) Annotate::Constants::POSITION_OPTIONS.each { |key| ENV[key.to_s] = '' } From ea4cd00cf0c98183aa9f18ec21e2fcdec169cfe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lovro=20Biki=C4=87?= Date: Wed, 29 Mar 2023 10:31:01 +0200 Subject: [PATCH 04/11] Add support for annotating check constraints (#868) This adds annotation of check constraints with an option to disable/enable annotation. Most of the work done in this PR is based off of existing implementation for annotating indexes and foreign keys. Signed-off-by: Lovro Bikic --- README.md | 1 + lib/annotate/annotate_models.rb | 35 +++- lib/annotate/constants.rb | 3 +- lib/annotate/parser.rb | 8 +- .../templates/auto_annotate_models.rake | 1 + lib/tasks/annotate_models.rake | 1 + spec/lib/annotate/annotate_models_spec.rb | 149 +++++++++++++++++- spec/lib/annotate/parser_spec.rb | 11 ++ 8 files changed, 200 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ea489f587..b5c7ff790 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,7 @@ you can do so with a simple environment variable, instead of editing the -a, --active-admin Annotate active_admin models -v, --version Show the current version of this gem -m, --show-migration Include the migration version number in the annotation + -c, --show-check-constraints List the table's check constraints in the annotation -k, --show-foreign-keys List the table's foreign key constraints in the annotation --ck, --complete-foreign-keys Complete foreign key names in the annotation diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index fc503839b..be2a30cb4 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -131,7 +131,7 @@ def retrieve_indexes_from_table(klass) # to create a comment block containing a line for # each column. The line contains the column name, # the type (and length), and any optional attributes - def get_schema_info(klass, header, options = {}) + def get_schema_info(klass, header, options = {}) # rubocop:disable Metrics/MethodLength info = "# #{header}\n" info << get_schema_header_text(klass, options) @@ -178,6 +178,10 @@ def get_schema_info(klass, header, options = {}) info << get_foreign_key_info(klass, options) end + if options[:show_check_constraints] && klass.table_exists? + info << get_check_constraint_info(klass, options) + end + info << get_schema_footer_text(klass, options) end @@ -352,6 +356,35 @@ def get_foreign_key_info(klass, options = {}) fk_info end + def get_check_constraint_info(klass, options = {}) + cc_info = if options[:format_markdown] + "#\n# ### Check Constraints\n#\n" + else + "#\n# Check Constraints\n#\n" + end + + return '' unless klass.connection.respond_to?(:supports_check_constraints?) && + klass.connection.supports_check_constraints? && klass.connection.respond_to?(:check_constraints) + + check_constraints = klass.connection.check_constraints(klass.table_name) + return '' if check_constraints.empty? + + max_size = check_constraints.map { |check_constraint| check_constraint.name.size }.max + 1 + check_constraints.sort_by(&:name).each do |check_constraint| + expression = check_constraint.expression ? "(#{check_constraint.expression.squish})" : nil + + cc_info << if options[:format_markdown] + cc_info_markdown = sprintf("# * `%s`", check_constraint.name) + cc_info_markdown << sprintf(": `%s`", expression) if expression + cc_info_markdown << "\n" + else + sprintf("# %-#{max_size}.#{max_size}s %s", check_constraint.name, expression).rstrip + "\n" + end + end + + cc_info + end + # Add a schema block to a file. If the file already contains # a schema info block (a comment starting with "== Schema Information"), # check if it matches the block that is already there. If so, leave it be. diff --git a/lib/annotate/constants.rb b/lib/annotate/constants.rb index cd2148f39..57a26151f 100644 --- a/lib/annotate/constants.rb +++ b/lib/annotate/constants.rb @@ -18,7 +18,8 @@ module Constants :trace, :timestamp, :exclude_serializers, :classified_sort, :show_foreign_keys, :show_complete_foreign_keys, :exclude_scaffolds, :exclude_controllers, :exclude_helpers, - :exclude_sti_subclasses, :ignore_unknown_models, :with_comment + :exclude_sti_subclasses, :ignore_unknown_models, :with_comment, + :show_check_constraints ].freeze OTHER_OPTIONS = [ diff --git a/lib/annotate/parser.rb b/lib/annotate/parser.rb index cb27b8b5d..3f5ebdb00 100644 --- a/lib/annotate/parser.rb +++ b/lib/annotate/parser.rb @@ -48,7 +48,7 @@ def commit end end - def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength + def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize has_set_position = {} option_parser.banner = 'Usage: annotate [options] [model_file]*' @@ -173,6 +173,12 @@ def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength env['include_version'] = 'yes' end + option_parser.on('-c', + '--show-check-constraints', + "List the table's check constraints in the annotation") do + env['show_check_constraints'] = 'yes' + end + option_parser.on('-k', '--show-foreign-keys', "List the table's foreign key constraints in the annotation") do diff --git a/lib/generators/annotate/templates/auto_annotate_models.rake b/lib/generators/annotate/templates/auto_annotate_models.rake index 1f355249b..78b75eb51 100644 --- a/lib/generators/annotate/templates/auto_annotate_models.rake +++ b/lib/generators/annotate/templates/auto_annotate_models.rake @@ -17,6 +17,7 @@ if Rails.env.development? 'position_in_fixture' => 'before', 'position_in_factory' => 'before', 'position_in_serializer' => 'before', + 'show_check_constraints' => 'false', 'show_foreign_keys' => 'true', 'show_complete_foreign_keys' => 'false', 'show_indexes' => 'true', diff --git a/lib/tasks/annotate_models.rake b/lib/tasks/annotate_models.rake index 76d8cfe63..448fa80b5 100644 --- a/lib/tasks/annotate_models.rake +++ b/lib/tasks/annotate_models.rake @@ -18,6 +18,7 @@ task annotate_models: :environment do options[:position_in_factory] = Annotate::Helpers.fallback(ENV['position_in_factory'], ENV['position']) options[:position_in_test] = Annotate::Helpers.fallback(ENV['position_in_test'], ENV['position']) options[:position_in_serializer] = Annotate::Helpers.fallback(ENV['position_in_serializer'], ENV['position']) + options[:show_check_constraints] = Annotate::Helpers.true?(ENV['show_check_constraints']) options[:show_foreign_keys] = Annotate::Helpers.true?(ENV['show_foreign_keys']) options[:show_complete_foreign_keys] = Annotate::Helpers.true?(ENV['show_complete_foreign_keys']) options[:show_indexes] = Annotate::Helpers.true?(ENV['show_indexes']) diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index b5f167d67..59cd8eb1c 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -41,16 +41,25 @@ def mock_foreign_key(name, from_column, to_table, to_column = 'id', constraints on_update: constraints[:on_update]) end - def mock_connection(indexes = [], foreign_keys = []) + def mock_check_constraint(name, expression) + double('CheckConstraintDefinition', + name: name, + expression: expression) + end + + def mock_connection(indexes = [], foreign_keys = [], check_constraints = []) double('Conn', indexes: indexes, foreign_keys: foreign_keys, - supports_foreign_keys?: true) + check_constraints: check_constraints, + supports_foreign_keys?: true, + supports_check_constraints?: true) end - def mock_class(table_name, primary_key, columns, indexes = [], foreign_keys = []) + # rubocop:disable Metrics/ParameterLists + def mock_class(table_name, primary_key, columns, indexes = [], foreign_keys = [], check_constraints = []) options = { - connection: mock_connection(indexes, foreign_keys), + connection: mock_connection(indexes, foreign_keys, check_constraints), table_exists?: true, table_name: table_name, primary_key: primary_key, @@ -62,6 +71,7 @@ def mock_class(table_name, primary_key, columns, indexes = [], foreign_keys = [] double('An ActiveRecord class', options) end + # rubocop:enable Metrics/ParameterLists def mock_column(name, type, options = {}) default_options = { @@ -221,7 +231,7 @@ def mock_column(name, type, options = {}) end let :klass do - mock_class(:users, primary_key, columns, indexes, foreign_keys) + mock_class(:users, primary_key, columns, indexes, foreign_keys, check_constraints) end let :indexes do @@ -232,6 +242,10 @@ def mock_column(name, type, options = {}) [] end + let :check_constraints do + [] + end + context 'when option is not present' do let :options do {} @@ -391,7 +405,7 @@ def mock_column(name, type, options = {}) end end - context 'with Globalize gem' do + context 'with Globalize gem' do # rubocop:disable RSpec/MultipleMemoizedHelpers let :translation_klass do double('Folder::Post::Translation', to_s: 'Folder::Post::Translation', @@ -756,6 +770,82 @@ def mock_column(name, type, options = {}) end end + context 'when check constraints exist' do + let :columns do + [ + mock_column(:id, :integer), + mock_column(:age, :integer) + ] + end + + context 'when option "show_check_constraints" is true' do + let :options do + { show_check_constraints: true } + end + + context 'when check constraints are defined' do + let :check_constraints do + [ + mock_check_constraint('alive', 'age < 150'), + mock_check_constraint('must_be_adult', 'age >= 18'), + mock_check_constraint('missing_expression', nil), + mock_check_constraint('multiline_test', <<~SQL) + CASE + WHEN (age >= 18) THEN (age <= 21) + ELSE true + END + SQL + ] + end + + let :expected_result do + <<~EOS + # Schema Info + # + # Table name: users + # + # id :integer not null, primary key + # age :integer not null + # + # Check Constraints + # + # alive (age < 150) + # missing_expression + # multiline_test (CASE WHEN (age >= 18) THEN (age <= 21) ELSE true END) + # must_be_adult (age >= 18) + # + EOS + end + + it 'returns schema info with check constraint information' do + is_expected.to eq expected_result + end + end + + context 'when check constraint is not defined' do + let :check_constraints do + [] + end + + let :expected_result do + <<~EOS + # Schema Info + # + # Table name: users + # + # id :integer not null, primary key + # age :integer not null + # + EOS + end + + it 'returns schema info without check constraint information' do + is_expected.to eq expected_result + end + end + end + end + context 'when foreign keys exist' do let :columns do [ @@ -1492,6 +1582,53 @@ def mock_column(name, type, options = {}) end end + context 'when option "show_check_constraints" is true' do + let :options do + { format_markdown: true, show_check_constraints: true } + end + + context 'when check constraints are defined' do + let :check_constraints do + [ + mock_check_constraint('min_name_length', 'LENGTH(name) > 2'), + mock_check_constraint('missing_expression', nil), + mock_check_constraint('multiline_test', <<~SQL) + CASE + WHEN (age >= 18) THEN (age <= 21) + ELSE true + END + SQL + ] + end + + let :expected_result do + <<~EOS + # == Schema Information + # + # Table name: `users` + # + # ### Columns + # + # Name | Type | Attributes + # ----------- | ------------------ | --------------------------- + # **`id`** | `integer` | `not null, primary key` + # **`name`** | `string(50)` | `not null` + # + # ### Check Constraints + # + # * `min_name_length`: `(LENGTH(name) > 2)` + # * `missing_expression` + # * `multiline_test`: `(CASE WHEN (age >= 18) THEN (age <= 21) ELSE true END)` + # + EOS + end + + it 'returns schema info with check constraint information in Markdown format' do + is_expected.to eq expected_result + end + end + end + context 'when option "show_foreign_keys" is true' do let :options do { format_markdown: true, show_foreign_keys: true } diff --git a/spec/lib/annotate/parser_spec.rb b/spec/lib/annotate/parser_spec.rb index 176e453e3..16a18e25f 100644 --- a/spec/lib/annotate/parser_spec.rb +++ b/spec/lib/annotate/parser_spec.rb @@ -260,6 +260,17 @@ module Annotate # rubocop:disable Metrics/ModuleLength end end + %w[-c --show-check-constraints].each do |option| + describe option do + let(:env_key) { 'show_check_constraints' } + let(:set_value) { 'yes' } + it 'sets the ENV variable' do + expect(ENV).to receive(:[]=).with(env_key, set_value) + Parser.parse([option]) + end + end + end + %w[-k --show-foreign-keys].each do |option| describe option do let(:env_key) { 'show_foreign_keys' } From 13b532d92bd76ab5c3292a27f366ec9cb7f490e6 Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Wed, 29 Mar 2023 01:51:15 -0700 Subject: [PATCH 05/11] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 63 +++++++++++++++------------ 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4764a47c4..633796457 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,54 +1,61 @@ -name: "Code scanning - action" +name: "CodeQL" on: push: - branches-ignore: - - pr/* - - scratch/* + branches: [ "develop" ] pull_request: + # The branches below must be a subset of the branches above + branches: [ "develop" ] schedule: - - cron: '0 9 * * MON' + - cron: '26 5 * * 4' jobs: - CodeQL-Build: - + analyze: + name: Analyze runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'ruby' ] steps: - name: Checkout repository uses: actions/checkout@v3 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 - # Override language selection by uncommenting this and choosing your languages - # with: - languages: ruby + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild uses: github/codeql-action/autobuild@v2 # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - #- run: | - # make bootstrap - # make release + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" From a28fef34d99395cac44ec11cd7922e018d9a28f9 Mon Sep 17 00:00:00 2001 From: Jim Jowdy Date: Wed, 29 Mar 2023 15:09:11 -0700 Subject: [PATCH 06/11] Fix retrieve_indexes_from_table when indexes is empty and base table does not exist. (#849) Some tables may have a table_name_prefix but no indexes. Previous versions of the code would strip the prefix and look for indexes on the resulting table which likely would not exist. This causes DB errors, at least in MySQL. So now check if the new table exists first before trying to show its indexes. --- lib/annotate/annotate_models.rb | 6 +++++- spec/lib/annotate/annotate_models_spec.rb | 23 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index be2a30cb4..488102999 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -124,7 +124,11 @@ def retrieve_indexes_from_table(klass) # Try to search the table without prefix table_name_without_prefix = table_name.to_s.sub(klass.table_name_prefix, '') - klass.connection.indexes(table_name_without_prefix) + if klass.connection.table_exists?(table_name_without_prefix) + klass.connection.indexes(table_name_without_prefix) + else + [] + end end # Use the column information in an ActiveRecord class diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index 59cd8eb1c..33b220173 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -53,7 +53,8 @@ def mock_connection(indexes = [], foreign_keys = [], check_constraints = []) foreign_keys: foreign_keys, check_constraints: check_constraints, supports_foreign_keys?: true, - supports_check_constraints?: true) + supports_check_constraints?: true, + table_exists?: true) end # rubocop:disable Metrics/ParameterLists @@ -538,7 +539,7 @@ def mock_column(name, type, options = {}) end end - context 'when one of indexes includes orderd index key' do + context 'when one of indexes includes ordered index key' do let :columns do [ mock_column("id", :integer), @@ -694,6 +695,24 @@ def mock_column(name, type, options = {}) it 'returns schema info without index information' do is_expected.to eq expected_result end + + # rubocop:disable RSpec/NestedGroups + context 'when the unprefixed table name does not exist' do + let :klass do + mock_class(:users, primary_key, columns, indexes, foreign_keys).tap do |mock_klass| + allow(mock_klass).to receive(:table_name_prefix).and_return('my_prefix_') + allow(mock_klass.connection).to receive(:table_exists?).with('users').and_return(false) + allow(mock_klass.connection).to receive(:indexes).with('users').and_raise('error fetching indexes on nonexistent table') + end + end + + it 'returns schema info without index information' do + is_expected.to eq expected_result + expect(klass).to have_received(:table_name_prefix).at_least(:once) + expect(klass.connection).to have_received(:table_exists?).with('users') + end + end + # rubocop:enable RSpec/NestedGroups end end From 10a7a76c87297f61fc1b36125efcdaed074744bc Mon Sep 17 00:00:00 2001 From: Takumi KAGIYAMA <694547+kg8m@users.noreply.github.com> Date: Fri, 31 Mar 2023 07:15:07 +0900 Subject: [PATCH 07/11] Support `--frozen` option for routing annotations (#979) The `--frozen` option previously deal only model annotations. This change will support route annotations as well. --------- Signed-off-by: kg8m Co-authored-by: Cuong Tran --- lib/annotate/annotate_routes.rb | 19 +++---- lib/tasks/annotate_routes.rake | 1 + spec/lib/annotate/annotate_routes_spec.rb | 65 +++++++++++++++++++++++ 3 files changed, 76 insertions(+), 9 deletions(-) diff --git a/lib/annotate/annotate_routes.rb b/lib/annotate/annotate_routes.rb index 75cc421ed..c9a2218ac 100644 --- a/lib/annotate/annotate_routes.rb +++ b/lib/annotate/annotate_routes.rb @@ -29,8 +29,7 @@ def do_annotations(options = {}) content, header_position = Helpers.strip_annotations(existing_text) new_content = annotate_routes(HeaderGenerator.generate(options), content, header_position, options) new_text = new_content.join("\n") - - if rewrite_contents(existing_text, new_text) + if rewrite_contents(existing_text, new_text, options[:frozen]) puts "#{routes_file} was annotated." else puts "#{routes_file} was not changed." @@ -40,13 +39,13 @@ def do_annotations(options = {}) end end - def remove_annotations(_options={}) + def remove_annotations(options={}) if routes_file_exist? existing_text = File.read(routes_file) content, header_position = Helpers.strip_annotations(existing_text) new_content = strip_on_removal(content, header_position) new_text = new_content.join("\n") - if rewrite_contents(existing_text, new_text) + if rewrite_contents(existing_text, new_text, options[:frozen]) puts "Annotations were removed from #{routes_file}." else puts "#{routes_file} was not changed (Annotation did not exist)." @@ -82,13 +81,15 @@ def strip_on_removal(content, header_position) content end - def rewrite_contents(existing_text, new_text) - if existing_text == new_text - false - else + def rewrite_contents(existing_text, new_text, frozen) + content_changed = (existing_text != new_text) + + if content_changed + abort "annotate error. #{routes_file} needs to be updated, but annotate was run with `--frozen`." if frozen File.open(routes_file, 'wb') { |f| f.puts(new_text) } - true end + + content_changed end def annotate_routes(header, content, header_position, options = {}) diff --git a/lib/tasks/annotate_routes.rake b/lib/tasks/annotate_routes.rake index ae6829337..b2832d443 100644 --- a/lib/tasks/annotate_routes.rake +++ b/lib/tasks/annotate_routes.rake @@ -14,6 +14,7 @@ task :annotate_routes => :environment do options[:position_in_routes] = Annotate::Helpers.fallback(ENV['position_in_routes'], ENV['position']) options[:ignore_routes] = Annotate::Helpers.fallback(ENV['ignore_routes'], nil) options[:require] = ENV['require'] ? ENV['require'].split(',') : [] + options[:frozen] = Annotate::Helpers.true?(ENV['frozen']) options[:wrapper_open] = Annotate::Helpers.fallback(ENV['wrapper_open'], ENV['wrapper']) options[:wrapper_close] = Annotate::Helpers.fallback(ENV['wrapper_close'], ENV['wrapper']) AnnotateRoutes.do_annotations(options) diff --git a/spec/lib/annotate/annotate_routes_spec.rb b/spec/lib/annotate/annotate_routes_spec.rb index 805aec66c..2d27b7458 100644 --- a/spec/lib/annotate/annotate_routes_spec.rb +++ b/spec/lib/annotate/annotate_routes_spec.rb @@ -556,6 +556,71 @@ end end end + + describe 'frozen option' do + let :aborted_message do + "annotate error. #{ROUTE_FILE} needs to be updated, but annotate was run with `--frozen`." + end + + let :rake_routes_result do + <<-EOS + Prefix Verb URI Pattern Controller#Action + myaction1 GET /url1(.:format) mycontroller1#action + myaction2 POST /url2(.:format) mycontroller2#action + myaction3 DELETE|GET /url3(.:format) mycontroller3#action + EOS + end + + before :each do + expect(File).to receive(:exist?).with(ROUTE_FILE).and_return(true).once + expect(File).to receive(:read).with(ROUTE_FILE).and_return(route_file_content).once + + expect(AnnotateRoutes::HeaderGenerator).to receive(:`).with('rake routes').and_return(rake_routes_result).once + end + + context 'when annotation does not exists' do + let :route_file_content do + '' + end + + it 'aborts' do + expect { AnnotateRoutes.do_annotations(frozen: true) }.to raise_error SystemExit, aborted_message + end + end + + context 'when annotation exists but is not updated' do + let :route_file_content do + <<~EOS + # == Route Map + # + # Prefix Verb URI Pattern Controller#Action + # myaction2 POST /url2(.:format) mycontroller2#action + # myaction3 DELETE|GET /url3(.:format) mycontroller3#action + EOS + end + + it 'aborts' do + expect { AnnotateRoutes.do_annotations(frozen: true) }.to raise_error SystemExit, aborted_message + end + end + + context 'when annotation exists and is already updated' do + let :route_file_content do + <<~EOS + # == Route Map + # + # Prefix Verb URI Pattern Controller#Action + # myaction1 GET /url1(.:format) mycontroller1#action + # myaction2 POST /url2(.:format) mycontroller2#action + # myaction3 DELETE|GET /url3(.:format) mycontroller3#action + EOS + end + + it 'does NOT abort' do + expect { AnnotateRoutes.do_annotations(frozen: true) }.not_to raise_error + end + end + end end describe '.remove_annotations' do From 22ab67688c9da76cd633a3cd304e2d976e312257 Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Thu, 30 Mar 2023 15:17:37 -0700 Subject: [PATCH 08/11] chore: remove broken badges from README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index b5c7ff790..abf325ffa 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,9 @@ [![Gem Version](https://badge.fury.io/rb/annotate.svg)](http://badge.fury.io/rb/annotate) [![Downloads count](https://img.shields.io/gem/dt/annotate.svg?style=flat)](https://rubygems.org/gems/annotate) -[![Build status](https://travis-ci.org/ctran/annotate_models.svg?branch=develop)](https://travis-ci.org/ctran/annotate_models) [![CI Status](https://github.com/ctran/annotate_models/workflows/CI/badge.svg)](https://github.com/ctran/annotate_models/actions?workflow=CI) [![Coveralls](https://coveralls.io/repos/ctran/annotate_models/badge.svg?branch=develop)](https://coveralls.io/r/ctran/annotate_models?branch=develop) [![Maintenability](https://codeclimate.com/github/ctran/annotate_models/badges/gpa.svg)](https://codeclimate.com/github/ctran/annotate_models) -[![Inline docs](http://inch-ci.org/github/ctran/annotate_models.svg?branch=develop)](http://inch-ci.org/github/ctran/annotate_models) Add a comment summarizing the current schema to the top or bottom of each of your... From 3a78787acfef39b05c1784a3f5e7f919f48bd8be Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 23 Apr 2023 07:01:47 +0200 Subject: [PATCH 09/11] fix: can't modify frozen String: "decimal" (#895) Resolves: #834 --- lib/annotate/annotate_models.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 488102999..ff01a3d90 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -239,7 +239,7 @@ def get_col_type(col) 'bigint' else (col.type || col.sql_type).to_s - end + end.dup end def index_columns_info(index) From e60a66644e8a8ea5dccd6a398d31f22878233998 Mon Sep 17 00:00:00 2001 From: "Adeynack (David)" Date: Sat, 24 Jun 2023 07:11:25 +0200 Subject: [PATCH 10/11] Place column comments at the end of the line (#988) --- README.md | 1 + lib/annotate/annotate_models.rb | 46 ++++++- lib/annotate/constants.rb | 2 +- lib/annotate/parser.rb | 5 + spec/lib/annotate/annotate_models_spec.rb | 140 ++++++++++++++++++++++ spec/lib/annotate/parser_spec.rb | 10 ++ spec/spec_helper.rb | 1 + 7 files changed, 198 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index abf325ffa..bac488d5d 100644 --- a/README.md +++ b/README.md @@ -250,6 +250,7 @@ you can do so with a simple environment variable, instead of editing the don't show default for given column types, separated by commas (e.g. `json,jsonb,hstore`) --ignore-unknown-models don't display warnings for bad model files --with-comment include database comments in model annotations + --with-comment-column include database comments in model annotations, as its own column, after all others ### Option: `additional_file_patterns` diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index ff01a3d90..dc2901a32 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -146,18 +146,37 @@ def get_schema_info(klass, header, options = {}) # rubocop:disable Metrics/Metho if options[:format_markdown] info << sprintf( "# %-#{max_size + md_names_overhead}.#{max_size + md_names_overhead}s | %-#{md_type_allowance}.#{md_type_allowance}s | %s\n", 'Name', 'Type', 'Attributes' ) + info << "# #{ '-' * ( max_size + md_names_overhead ) } | #{'-' * md_type_allowance} | #{ '-' * 27 }\n" end cols = columns(klass, options) - cols.each do |col| + with_comments = with_comments?(klass, options) + with_comments_column = with_comments_column?(klass, options) + + # Precalculate Values + cols_meta = cols.map do |col| + col_comment = with_comments || with_comments_column ? col.comment&.gsub(/\n/, "\\n") : nil col_type = get_col_type(col) attrs = get_attributes(col, col_type, klass, options) - col_name = if with_comments?(klass, options) && col.comment - "#{col.name}(#{col.comment.gsub(/\n/, "\\n")})" + col_name = if with_comments && col_comment + "#{col.name}(#{col_comment})" else col.name end + simple_formatted_attrs = attrs.join(", ") + [col.name, { col_type: col_type, attrs: attrs, col_name: col_name, simple_formatted_attrs: simple_formatted_attrs, col_comment: col_comment }] + end.to_h + + # Output annotation + bare_max_attrs_length = cols_meta.map { |_, m| m[:simple_formatted_attrs].length }.max + + cols.each do |col| + col_type = cols_meta[col.name][:col_type] + attrs = cols_meta[col.name][:attrs] + col_name = cols_meta[col.name][:col_name] + simple_formatted_attrs = cols_meta[col.name][:simple_formatted_attrs] + col_comment = cols_meta[col.name][:col_comment] if options[:format_rdoc] info << sprintf("# %-#{max_size}.#{max_size}s%s", "*#{col_name}*::", attrs.unshift(col_type).join(", ")).rstrip + "\n" @@ -169,8 +188,10 @@ def get_schema_info(klass, header, options = {}) # rubocop:disable Metrics/Metho name_remainder = max_size - col_name.length - non_ascii_length(col_name) type_remainder = (md_type_allowance - 2) - col_type.length info << (sprintf("# **`%s`**%#{name_remainder}s | `%s`%#{type_remainder}s | `%s`", col_name, " ", col_type, " ", attrs.join(", ").rstrip)).gsub('``', ' ').rstrip + "\n" + elsif with_comments_column + info << format_default(col_name, max_size, col_type, bare_type_allowance, simple_formatted_attrs, bare_max_attrs_length, col_comment) else - info << format_default(col_name, max_size, col_type, bare_type_allowance, attrs) + info << format_default(col_name, max_size, col_type, bare_type_allowance, simple_formatted_attrs) end end @@ -798,6 +819,12 @@ def with_comments?(klass, options) klass.columns.any? { |col| !col.comment.nil? } end + def with_comments_column?(klass, options) + options[:with_comment_column] && + klass.columns.first.respond_to?(:comment) && + klass.columns.any? { |col| !col.comment.nil? } + end + def max_schema_info_width(klass, options) cols = columns(klass, options) @@ -814,8 +841,15 @@ def max_schema_info_width(klass, options) max_size end - def format_default(col_name, max_size, col_type, bare_type_allowance, attrs) - sprintf("# %s:%s %s", mb_chars_ljust(col_name, max_size), mb_chars_ljust(col_type, bare_type_allowance), attrs.join(", ")).rstrip + "\n" + # rubocop:disable Metrics/ParameterLists + def format_default(col_name, max_size, col_type, bare_type_allowance, simple_formatted_attrs, bare_max_attrs_length = 0, col_comment = nil) + sprintf( + "# %s:%s %s %s", + mb_chars_ljust(col_name, max_size), + mb_chars_ljust(col_type, bare_type_allowance), + mb_chars_ljust(simple_formatted_attrs, bare_max_attrs_length), + col_comment + ).rstrip + "\n" end def width(string) diff --git a/lib/annotate/constants.rb b/lib/annotate/constants.rb index 57a26151f..0d3225659 100644 --- a/lib/annotate/constants.rb +++ b/lib/annotate/constants.rb @@ -18,7 +18,7 @@ module Constants :trace, :timestamp, :exclude_serializers, :classified_sort, :show_foreign_keys, :show_complete_foreign_keys, :exclude_scaffolds, :exclude_controllers, :exclude_helpers, - :exclude_sti_subclasses, :ignore_unknown_models, :with_comment, + :exclude_sti_subclasses, :ignore_unknown_models, :with_comment, :with_comment_column, :show_check_constraints ].freeze diff --git a/lib/annotate/parser.rb b/lib/annotate/parser.rb index 3f5ebdb00..ad85caf50 100644 --- a/lib/annotate/parser.rb +++ b/lib/annotate/parser.rb @@ -304,6 +304,11 @@ def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength, "include database comments in model annotations") do env['with_comment'] = 'true' end + + option_parser.on('--with-comment-column', + "include database comments in model annotations, as its own column, after all others") do + env['with_comment_column'] = 'true' + end end end end diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index 33b220173..096474610 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -1308,6 +1308,146 @@ def mock_column(name, type, options = {}) end end end + + context 'when "with_comment_column" is specified in options' do + let :options do + { with_comment_column: 'yes' } + end + + context 'when columns have comments' do + let :columns do + [ + mock_column(:id, :integer, limit: 8, comment: 'ID'), + mock_column(:active, :boolean, limit: 1, comment: 'Active'), + mock_column(:name, :string, limit: 50, comment: 'Name'), + mock_column(:notes, :text, limit: 55, comment: 'Notes'), + mock_column(:no_comment, :text, limit: 20, comment: nil) + ] + end + + let :expected_result do + <<~EOS + # Schema Info + # + # Table name: users + # + # id :integer not null, primary key ID + # active :boolean not null Active + # name :string(50) not null Name + # notes :text(55) not null Notes + # no_comment :text(20) not null + # + EOS + end + + it 'works with option "with_comment_column"' do + is_expected.to eq expected_result + end + end + + context 'when columns have multibyte comments' do + let :columns do + [ + mock_column(:id, :integer, limit: 8, comment: 'ID'), + mock_column(:active, :boolean, limit: 1, comment: 'ACTIVE'), + mock_column(:name, :string, limit: 50, comment: 'NAME'), + mock_column(:notes, :text, limit: 55, comment: 'NOTES'), + mock_column(:cyrillic, :text, limit: 30, comment: 'Кириллица'), + mock_column(:japanese, :text, limit: 60, comment: '熊本大学 イタリア 宝島'), + mock_column(:arabic, :text, limit: 20, comment: 'لغة'), + mock_column(:no_comment, :text, limit: 20, comment: nil), + mock_column(:location, :geometry_collection, limit: nil, comment: nil) + ] + end + + let :expected_result do + <<~EOS + # Schema Info + # + # Table name: users + # + # id :integer not null, primary key ID + # active :boolean not null ACTIVE + # name :string(50) not null NAME + # notes :text(55) not null NOTES + # cyrillic :text(30) not null Кириллица + # japanese :text(60) not null 熊本大学 イタリア 宝島 + # arabic :text(20) not null لغة + # no_comment :text(20) not null + # location :geometry_collect not null + # + EOS + end + + it 'works with option "with_comment_column"' do + is_expected.to eq expected_result + end + end + + context 'when columns have multiline comments' do + let :columns do + [ + mock_column(:id, :integer, limit: 8, comment: 'ID'), + mock_column(:notes, :text, limit: 55, comment: "Notes.\nMay include things like notes."), + mock_column(:no_comment, :text, limit: 20, comment: nil) + ] + end + + let :expected_result do + <<~EOS + # Schema Info + # + # Table name: users + # + # id :integer not null, primary key ID + # notes :text(55) not null Notes.\\nMay include things like notes. + # no_comment :text(20) not null + # + EOS + end + + it 'works with option "with_comment_column"' do + is_expected.to eq expected_result + end + end + + context 'when geometry columns are included' do + let :columns do + [ + mock_column(:id, :integer, limit: 8), + mock_column(:active, :boolean, default: false, null: false), + mock_column(:geometry, :geometry, + geometric_type: 'Geometry', srid: 4326, + limit: { srid: 4326, type: 'geometry' }), + mock_column(:location, :geography, + geometric_type: 'Point', srid: 0, + limit: { srid: 0, type: 'geometry' }), + mock_column(:non_srid, :geography, + geometric_type: 'Point', + limit: { type: 'geometry' }) + ] + end + + let :expected_result do + <<~EOS + # Schema Info + # + # Table name: users + # + # id :integer not null, primary key + # active :boolean default(FALSE), not null + # geometry :geometry not null, geometry, 4326 + # location :geography not null, point, 0 + # non_srid :geography not null, point + # + EOS + end + + it 'works with option "with_comment_column"' do + is_expected.to eq expected_result + end + end + end end end end diff --git a/spec/lib/annotate/parser_spec.rb b/spec/lib/annotate/parser_spec.rb index 16a18e25f..16084b02b 100644 --- a/spec/lib/annotate/parser_spec.rb +++ b/spec/lib/annotate/parser_spec.rb @@ -560,5 +560,15 @@ module Annotate # rubocop:disable Metrics/ModuleLength Parser.parse([option]) end end + + describe '--with-comment-column' do + let(:option) { '--with-comment-column' } + let(:env_key) { 'with_comment_column' } + let(:set_value) { 'true' } + it 'sets the ENV variable' do + expect(ENV).to receive(:[]=).with(env_key, set_value) + Parser.parse([option]) + end + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 91df96e3b..e461e55bb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -36,4 +36,5 @@ RSpec.configure do |config| config.order = 'random' + config.filter_run_when_matching :focus end From 5d01c4171990c4fe7b9b0977b05ce14a98209e53 Mon Sep 17 00:00:00 2001 From: "Adeynack (David)" Date: Thu, 30 Nov 2023 04:48:30 +0100 Subject: [PATCH 11/11] Make `with_comment_column` work with `Annotate.set_defaults` (#999) --- .../templates/auto_annotate_models.rake | 3 +- lib/tasks/annotate_models.rake | 1 + spec/lib/tasks/annotate_models_spec.rb | 36 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 spec/lib/tasks/annotate_models_spec.rb diff --git a/lib/generators/annotate/templates/auto_annotate_models.rake b/lib/generators/annotate/templates/auto_annotate_models.rake index 78b75eb51..61cdcd7a1 100644 --- a/lib/generators/annotate/templates/auto_annotate_models.rake +++ b/lib/generators/annotate/templates/auto_annotate_models.rake @@ -52,7 +52,8 @@ if Rails.env.development? 'trace' => 'false', 'wrapper_open' => nil, 'wrapper_close' => nil, - 'with_comment' => 'true' + 'with_comment' => 'true', + 'with_comment_column' => 'false' ) end diff --git a/lib/tasks/annotate_models.rake b/lib/tasks/annotate_models.rake index 448fa80b5..776f97ba3 100644 --- a/lib/tasks/annotate_models.rake +++ b/lib/tasks/annotate_models.rake @@ -52,6 +52,7 @@ task annotate_models: :environment do options[:hide_limit_column_types] = Annotate::Helpers.fallback(ENV['hide_limit_column_types'], '') options[:hide_default_column_types] = Annotate::Helpers.fallback(ENV['hide_default_column_types'], '') options[:with_comment] = Annotate::Helpers.true?(ENV['with_comment']) + options[:with_comment_column] = Annotate::Helpers.true?(ENV['with_comment_column']) options[:ignore_unknown_models] = Annotate::Helpers.true?(ENV.fetch('ignore_unknown_models', 'false')) AnnotateModels.do_annotations(options) diff --git a/spec/lib/tasks/annotate_models_spec.rb b/spec/lib/tasks/annotate_models_spec.rb new file mode 100644 index 000000000..03f82391f --- /dev/null +++ b/spec/lib/tasks/annotate_models_spec.rb @@ -0,0 +1,36 @@ +require_relative '../../spec_helper' + +describe 'Annotate annotate_models rake task and Annotate.set_defaults' do # rubocop:disable RSpec/DescribeClass + before do + Rake.application = Rake::Application.new + Rake::Task.define_task('environment') + Rake.load_rakefile('tasks/annotate_models.rake') + end + + after do + Annotate.instance_variable_set('@has_set_defaults', false) + end + + let(:annotate_models_argument) do + argument = nil + allow(AnnotateModels).to receive(:do_annotations) { |arg| argument = arg } + Rake::Task['annotate_models'].invoke + argument + end + + describe 'with_comment_column' do + subject { annotate_models_argument[:with_comment_column] } + + after { ENV.delete('with_comment_column') } + + context 'when Annotate.set_defaults is not called (defaults)' do + it { is_expected.to be_falsey } + end + + context 'when Annotate.set_defaults sets it to "true"' do + before { Annotate.set_defaults('with_comment_column' => 'true') } + + it { is_expected.to be_truthy } + end + end +end