From 516ed58e5662e32fca5114c6dbe20be93a4e5507 Mon Sep 17 00:00:00 2001 From: Takafumi ONAKA Date: Mon, 4 Jan 2021 05:17:38 +0900 Subject: [PATCH 01/31] Fix: RuntimeError - Don't know how to build task 'db:migrate' (#844) ActiveRecord's migrate tasks are required since v2.7.5 (#588). --- lib/tasks/annotate_models_migrate.rake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tasks/annotate_models_migrate.rake b/lib/tasks/annotate_models_migrate.rake index 8e39868b1..58c07a5a9 100644 --- a/lib/tasks/annotate_models_migrate.rake +++ b/lib/tasks/annotate_models_migrate.rake @@ -16,6 +16,8 @@ if defined?(Rails::Application) && Rails.version.split('.').first.to_i >= 6 end migration_tasks.each do |task| + next unless Rake::Task.task_defined?(task) + Rake::Task[task].enhance do Rake::Task[Rake.application.top_level_tasks.last].enhance do annotation_options_task = if Rake::Task.task_defined?('app:set_annotation_options') From 206d970a8e703dd009379ccd89682a4121461479 Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Sun, 3 Jan 2021 12:31:06 -0800 Subject: [PATCH 02/31] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 12de50ca4..5ce6ec569 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,9 +2,12 @@ name: "Code scanning - action" on: push: + branches-ignore: + - pr/* + - scratch/* pull_request: schedule: - - cron: '0 6 * * 4' + - cron: '0 20 * * 7' jobs: CodeQL-Build: From 7d211ddebb95154a30f1b056782dca9ee8e919bc Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Sun, 3 Jan 2021 12:34:01 -0800 Subject: [PATCH 03/31] Create release-drafter.yml (#846) Automate release notes with https://github.com/marketplace/actions/release-drafter --- .github/workflows/release-drafter.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..72a6bb16b --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,17 @@ +name: Release Drafter + +on: + push: + branches: + - develop + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "develop" + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7b4bcdebc61fe00b0cb09e6bbe064a5312c8c369 Mon Sep 17 00:00:00 2001 From: Taher Ghaleb Date: Tue, 23 Mar 2021 23:35:16 -0400 Subject: [PATCH 04/31] Enable bundler caching for travis (#853) --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 554f29dbc..05d05d26d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ rvm: env: - RAILS_ENV=development RACK_ENV=development INTEGRATION_TESTS=1 +cache: bundler + addons: apt_packages: - libsqlite3-dev From 83ff912bb6ebd6dbd31bf89814e50e19d19ebf8d Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Wed, 24 Mar 2021 04:55:54 +0100 Subject: [PATCH 05/31] Fix typo invlaid -> invalid (#835) --- spec/lib/annotate/annotate_models_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index e2d6f41ab..370298f3c 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -1971,7 +1971,7 @@ class FooWithKnownMacro < ActiveRecord::Base end end - context 'when the file includes invlaid multibyte chars (USASCII)' do + context 'when the file includes invalid multibyte chars (USASCII)' do context 'when class FooWithUtf8 is defined in "foo_with_utf8.rb"' do let :filename do 'foo_with_utf8.rb' From 70aba780b44c8fad14b76c2e051529a6c78299bc Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Tue, 23 Mar 2021 21:36:22 -0700 Subject: [PATCH 06/31] Use ruby/setup-ruby since actions/ruby is deprecated (#855) --- .github/workflows/ci.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbb859ca5..953cc7013 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,29 +14,22 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.4.x', '2.5.x', '2.6.x'] + ruby: ['2.4', '2.5', '2.6'] steps: - name: Checkout uses: actions/checkout@v1 - name: Setup Ruby - uses: actions/setup-ruby@v1 + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} + bundler-cache: true - name: Install sqlite run: | sudo apt-get install libsqlite3-dev - - name: Update System - run: | - gem update --system --no-document - - - name: Bundle install for Annotate models - run: | - bundle install --jobs=4 --retry=3 - - name: Run Tests run: INTEGRATION_TESTS=1 bundle exec rspec From 18e9e289f9d1b18d8f9da8af7d9e235bde9d66a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 09:26:05 -0700 Subject: [PATCH 07/31] Bump puma from 4.3.3 to 4.3.5 in /spec/integration/rails_6.0.2.1 (#808) Bumps [puma](https://github.com/puma/puma) from 4.3.3 to 4.3.5. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/commits) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_6.0.2.1/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/rails_6.0.2.1/Gemfile.lock b/spec/integration/rails_6.0.2.1/Gemfile.lock index 06ea963e4..e8b81d6b9 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile.lock +++ b/spec/integration/rails_6.0.2.1/Gemfile.lock @@ -110,7 +110,7 @@ GEM nokogiri (1.10.8) mini_portile2 (~> 2.4.0) public_suffix (4.0.3) - puma (4.3.3) + puma (4.3.5) nio4r (~> 2.0) rack (2.1.2) rack-test (1.1.0) From 4c41913ffaa46804edf529034bea5166b17167e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 09:26:22 -0700 Subject: [PATCH 08/31] Bump puma from 4.3.3 to 4.3.5 in /spec/integration/rails_5.2.4.1 (#809) Bumps [puma](https://github.com/puma/puma) from 4.3.3 to 4.3.5. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/commits) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_5.2.4.1/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/rails_5.2.4.1/Gemfile.lock b/spec/integration/rails_5.2.4.1/Gemfile.lock index 46eead470..eef14a66e 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile.lock +++ b/spec/integration/rails_5.2.4.1/Gemfile.lock @@ -111,7 +111,7 @@ GEM nokogiri (1.10.8) mini_portile2 (~> 2.4.0) public_suffix (4.0.3) - puma (4.3.3) + puma (4.3.5) nio4r (~> 2.0) rack (2.1.2) rack-test (1.1.0) From 4ddc7f1b83f1789001a9a07909f8bf4ae191e5d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 09:26:27 -0700 Subject: [PATCH 09/31] Bump websocket-extensions in /spec/integration/rails_5.2.4.1 (#812) Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-ruby) from 0.1.4 to 0.1.5. - [Release notes](https://github.com/faye/websocket-extensions-ruby/releases) - [Changelog](https://github.com/faye/websocket-extensions-ruby/blob/master/CHANGELOG.md) - [Commits](https://github.com/faye/websocket-extensions-ruby/compare/0.1.4...0.1.5) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_5.2.4.1/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/rails_5.2.4.1/Gemfile.lock b/spec/integration/rails_5.2.4.1/Gemfile.lock index eef14a66e..34bc731b1 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile.lock +++ b/spec/integration/rails_5.2.4.1/Gemfile.lock @@ -186,7 +186,7 @@ GEM railties (>= 5.0) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) From de1e9621373bee6ed8ee706df60eda571aaaa241 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 09:26:33 -0700 Subject: [PATCH 10/31] Bump websocket-extensions in /spec/integration/rails_6.0.2.1 (#813) Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-ruby) from 0.1.4 to 0.1.5. - [Release notes](https://github.com/faye/websocket-extensions-ruby/releases) - [Changelog](https://github.com/faye/websocket-extensions-ruby/blob/master/CHANGELOG.md) - [Commits](https://github.com/faye/websocket-extensions-ruby/compare/0.1.4...0.1.5) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_6.0.2.1/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/rails_6.0.2.1/Gemfile.lock b/spec/integration/rails_6.0.2.1/Gemfile.lock index e8b81d6b9..e95270627 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile.lock +++ b/spec/integration/rails_6.0.2.1/Gemfile.lock @@ -174,7 +174,7 @@ GEM selenium-webdriver (>= 3.0, < 4.0) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.2.2) From f6658954ef9717c42348c23c13bfa1a90617b74c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 09:26:39 -0700 Subject: [PATCH 11/31] Bump rack from 2.1.2 to 2.2.3 in /spec/integration/rails_6.0.2.1 (#819) Bumps [rack](https://github.com/rack/rack) from 2.1.2 to 2.2.3. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/master/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/2.1.2...2.2.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_6.0.2.1/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/rails_6.0.2.1/Gemfile.lock b/spec/integration/rails_6.0.2.1/Gemfile.lock index e95270627..29c192daa 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile.lock +++ b/spec/integration/rails_6.0.2.1/Gemfile.lock @@ -112,7 +112,7 @@ GEM public_suffix (4.0.3) puma (4.3.5) nio4r (~> 2.0) - rack (2.1.2) + rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) rails (6.0.2.1) From a867eb09fe18a30f1ffe0ed79966a93a5acf6e6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 09:26:52 -0700 Subject: [PATCH 12/31] Bump rack from 2.1.2 to 2.2.3 in /spec/integration/rails_5.2.4.1 (#820) Bumps [rack](https://github.com/rack/rack) from 2.1.2 to 2.2.3. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/master/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/2.1.2...2.2.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_5.2.4.1/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/rails_5.2.4.1/Gemfile.lock b/spec/integration/rails_5.2.4.1/Gemfile.lock index 34bc731b1..eeefd6303 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile.lock +++ b/spec/integration/rails_5.2.4.1/Gemfile.lock @@ -113,7 +113,7 @@ GEM public_suffix (4.0.3) puma (4.3.5) nio4r (~> 2.0) - rack (2.1.2) + rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.2.4.1) From e075a21481ecfea6c7fc984c0978ff807332af62 Mon Sep 17 00:00:00 2001 From: Elijah Hamovitz Date: Mon, 10 May 2021 10:24:05 -0700 Subject: [PATCH 13/31] Allow `get_loaded_model` to succeed when `$LOAD_PATH` contains non-string values (#848) As currently implemented, `get_loaded_model` inspects the `$LOAD_PATH` global for path values when trying to find the path for a model file. This would be fine, except that variable is affected by userspace, which means that it will sometimes contain non-string values, often Pathnames. To avoid responding with the error `Unable to annotate #{model_path}: no implicit conversion of Pathname into String` in this situation, we simply add an explicit `to_s` call before performing string-specific operations. Fixes https://github.com/ctran/annotate_models/issues/758 --- lib/annotate/annotate_models.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 1b9911ee3..1d84b7945 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -608,7 +608,8 @@ def get_loaded_model(model_path, file) # auto_load/eager_load paths. Try all possible model paths one by one. absolute_file = File.expand_path(file) model_paths = - $LOAD_PATH.select { |path| absolute_file.include?(path) } + $LOAD_PATH.map(&:to_s) + .select { |path| absolute_file.include?(path) } .map { |path| absolute_file.sub(path, '').sub(/\.rb$/, '').sub(/^\//, '') } model_paths .map { |path| get_loaded_model_by_path(path) } From 80fbfa557e5a241dfbbb0801103ad005575c4f7e Mon Sep 17 00:00:00 2001 From: ocarta-l Date: Sat, 12 Jun 2021 23:35:23 +0200 Subject: [PATCH 14/31] fix ci: conflicts with removed gems (#865) --- spec/integration/rails_5.2.4.1/Gemfile.lock | 134 ++++++++++---------- spec/integration/rails_6.0.2.1/Gemfile.lock | 30 +++-- 2 files changed, 83 insertions(+), 81 deletions(-) diff --git a/spec/integration/rails_5.2.4.1/Gemfile.lock b/spec/integration/rails_5.2.4.1/Gemfile.lock index eeefd6303..376897094 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile.lock +++ b/spec/integration/rails_5.2.4.1/Gemfile.lock @@ -8,43 +8,43 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4.1) - actionpack (= 5.2.4.1) + actioncable (5.2.5) + actionpack (= 5.2.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.1) - actionpack (= 5.2.4.1) - actionview (= 5.2.4.1) - activejob (= 5.2.4.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.4.1) - actionview (= 5.2.4.1) - activesupport (= 5.2.4.1) + 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.4.1) - activesupport (= 5.2.4.1) + 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.4.1) - activesupport (= 5.2.4.1) + activejob (5.2.5) + activesupport (= 5.2.5) globalid (>= 0.3.6) - activemodel (5.2.4.1) - activesupport (= 5.2.4.1) - activerecord (5.2.4.1) - activemodel (= 5.2.4.1) - activesupport (= 5.2.4.1) + 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.4.1) - actionpack (= 5.2.4.1) - activerecord (= 5.2.4.1) - marcel (~> 0.3.1) - activesupport (5.2.4.1) + 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) @@ -55,11 +55,11 @@ GEM io-like (~> 0.3.0) arel (9.0.0) bindex (0.8.1) - bootsnap (1.4.5) + bootsnap (1.7.3) msgpack (~> 1.0) builder (3.2.4) - byebug (11.1.1) - capybara (3.31.0) + byebug (11.1.3) + capybara (3.32.2) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -78,75 +78,73 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.8) crass (1.0.6) - erubi (1.9.0) + erubi (1.10.0) execjs (2.7.0) - ffi (1.12.2) + ffi (1.15.0) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.8.2) + i18n (1.8.10) concurrent-ruby (~> 1.0) - io-like (0.3.0) - jbuilder (2.9.1) - activesupport (>= 4.2.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.4.0) + 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.4) - mini_mime (1.0.2) + marcel (1.0.1) + method_source (1.0.0) + mini_mime (1.0.3) mini_portile2 (2.4.0) - minitest (5.14.0) - msgpack (1.3.2) - nio4r (2.5.2) - nokogiri (1.10.8) + minitest (5.14.4) + msgpack (1.4.2) + nio4r (2.5.7) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - public_suffix (4.0.3) - puma (4.3.5) + public_suffix (4.0.6) + puma (4.3.7) nio4r (~> 2.0) rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.1) - actioncable (= 5.2.4.1) - actionmailer (= 5.2.4.1) - actionpack (= 5.2.4.1) - actionview (= 5.2.4.1) - activejob (= 5.2.4.1) - activemodel (= 5.2.4.1) - activerecord (= 5.2.4.1) - activestorage (= 5.2.4.1) - activesupport (= 5.2.4.1) + 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.4.1) + 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.4.1) - actionpack (= 5.2.4.1) - activesupport (= 5.2.4.1) + 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.1) - rb-fsevent (0.10.3) + rake (13.0.3) + rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (1.6.0) + regexp_parser (1.8.2) ruby_dep (1.5.0) - rubyzip (2.2.0) + rubyzip (2.3.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -164,18 +162,18 @@ GEM sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.4.2) - thor (1.0.1) + 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.6) + tzinfo (1.2.9) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) @@ -184,7 +182,7 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.7.1) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) @@ -213,4 +211,4 @@ DEPENDENCIES web-console (>= 3.3.0) BUNDLED WITH - 2.1.2 + 2.2.15 diff --git a/spec/integration/rails_6.0.2.1/Gemfile.lock b/spec/integration/rails_6.0.2.1/Gemfile.lock index 29c192daa..27f471106 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile.lock +++ b/spec/integration/rails_6.0.2.1/Gemfile.lock @@ -79,13 +79,13 @@ GEM regexp_parser (~> 1.5) xpath (~> 3.2) childprocess (3.0.0) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.8) crass (1.0.6) - erubi (1.9.0) + erubi (1.10.0) ffi (1.12.2) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.8.2) + i18n (1.8.10) concurrent-ruby (~> 1.0) jbuilder (2.9.1) activesupport (>= 4.2.0) @@ -93,7 +93,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.4.0) + loofah (2.9.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -101,17 +101,21 @@ GEM marcel (0.3.3) mimemagic (~> 0.3.2) method_source (0.9.2) - mimemagic (0.3.4) + mimemagic (0.3.10) + nokogiri (~> 1) + rake mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.14.0) + mini_portile2 (2.5.0) + minitest (5.14.4) msgpack (1.3.1) nio4r (2.5.2) - nokogiri (1.10.8) - mini_portile2 (~> 2.4.0) + nokogiri (1.11.2) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) public_suffix (4.0.3) puma (4.3.5) nio4r (~> 2.0) + racc (1.5.2) rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) @@ -141,7 +145,7 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) - rake (13.0.1) + rake (13.0.3) rb-fsevent (0.10.3) rb-inotify (0.10.1) ffi (~> 1.0) @@ -161,7 +165,7 @@ GEM sqlite3 (1.4.2) thor (1.0.1) thread_safe (0.3.6) - tzinfo (1.2.6) + tzinfo (1.2.9) thread_safe (~> 0.1) web-console (4.0.1) actionview (>= 6.0.0) @@ -177,7 +181,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.2.2) + zeitwerk (2.4.2) PLATFORMS ruby @@ -198,4 +202,4 @@ DEPENDENCIES webdrivers BUNDLED WITH - 2.1.2 + 2.2.15 From 3aa43ea354f5d1943e2afa06ed3b76afcaf7dfa7 Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Sun, 13 Jun 2021 18:25:25 -0700 Subject: [PATCH 15/31] Remove support for Ruby < 2.4 (#884) --- .tool-versions | 1 + Gemfile | 7 +++++-- Guardfile | 2 +- Rakefile | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..9b6768d19 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 2.6.7 diff --git a/Gemfile b/Gemfile index 184fe0ba4..4acd9cb84 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '>= 2.2.0' +ruby '>= 2.4.0' gem 'activerecord', '>= 4.2.5', '< 6', require: false gem 'rake', require: false @@ -20,7 +20,10 @@ group :development, :test do gem 'rspec', require: false gem 'rubocop', '~> 0.68.1', require: false unless RUBY_VERSION =~ /^1.8/ - gem 'simplecov', require: false + # gem 'rubocop', '~> 1.12', require: false + # gem 'rubocop-rake', require: false + # gem 'rubocop-rspec', require: false + # gem 'simplecov', require: false gem 'terminal-notifier-guard', require: false gem 'codeclimate-test-reporter' diff --git a/Guardfile b/Guardfile index 602c7b57c..f93bc135e 100644 --- a/Guardfile +++ b/Guardfile @@ -1,4 +1,4 @@ -# Note: The cmd option is now required due to the increasing number of ways +# NOTE: The cmd option is now required due to the increasing number of ways # rspec may be run, below are examples of the most common uses. # * bundler: 'bundle exec rspec' # * bundler binstubs: 'bin/rspec' diff --git a/Rakefile b/Rakefile index bfbd51b7d..43944f2dc 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,7 @@ def exit_exception(e) exit e.status_code end -# Note : this causes annoying psych warnings under Ruby 1.9.2-p180; to fix, upgrade to 1.9.3 +# NOTE: this causes annoying psych warnings under Ruby 1.9.2-p180; to fix, upgrade to 1.9.3 begin require 'bundler' Bundler.setup(:default, :development) @@ -162,7 +162,7 @@ namespace :integration do fixtures[Digest::MD5.hexdigest(File.read(fname))] = File.expand_path(fname) end - candidates.keys.each do |digest| + candidates.each_key do |digest| next unless fixtures.key?(digest) candidates[digest].each do |fname| # Double-check contents in case of hash collision... From e4f761c636e77e1f042a32060fb2a8bb80278fd4 Mon Sep 17 00:00:00 2001 From: Junichi Sato <22004610+sato11@users.noreply.github.com> Date: Mon, 14 Jun 2021 10:38:13 +0900 Subject: [PATCH 16/31] `get_loaded_model_by_path` is supposed to be nil-safe (#883) This commit partially reverts #801, which by declaring conditional return has turned `get_loaded_model_by_path` to a less safe method that can return nil when its the condition is not met. Apparently the very same condition has been brought to `annotate_model_file` by #774, which seems to cover the "bug" insisted in #801 as well. On the other hand #801 has brought an inconvenient behaviour as well: whenever a non-activerecord model file is found, `get_loaded_model_by_path` returns nil, which leads to raising `BadModelFileError` and ends up printing a bunch of "Unable to annotate ..." messages. Now it seems tests added by #801 are running right and I do not find a problem restoring the previous behaviour and turn it nil-safe again. --- lib/annotate/annotate_models.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 1d84b7945..ac214ffb4 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -618,9 +618,7 @@ def get_loaded_model(model_path, file) # Retrieve loaded model class by path to the file where it's supposed to be defined. def get_loaded_model_by_path(model_path) - klass = ActiveSupport::Inflector.constantize(ActiveSupport::Inflector.camelize(model_path)) - - klass if klass.is_a?(Class) && klass < ActiveRecord::Base + ActiveSupport::Inflector.constantize(ActiveSupport::Inflector.camelize(model_path)) rescue StandardError, LoadError # Revert to the old way but it is not really robust ObjectSpace.each_object(::Class) From ea3c30997089b37c5490b34980af685ed1df5677 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Jun 2021 18:41:37 -0700 Subject: [PATCH 17/31] Bump puma from 4.3.7 to 5.3.2 in /spec/integration/rails_5.2.4.1 (#887) Bumps [puma](https://github.com/puma/puma) from 4.3.7 to 5.3.2. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v4.3.7...v5.3.2) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_5.2.4.1/Gemfile | 2 +- spec/integration/rails_5.2.4.1/Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/integration/rails_5.2.4.1/Gemfile b/spec/integration/rails_5.2.4.1/Gemfile index bf49d057f..54570fed0 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile +++ b/spec/integration/rails_5.2.4.1/Gemfile @@ -6,7 +6,7 @@ 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', '~> 4.3' +gem 'puma', '~> 5.3' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets diff --git a/spec/integration/rails_5.2.4.1/Gemfile.lock b/spec/integration/rails_5.2.4.1/Gemfile.lock index 376897094..28cf579c5 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile.lock +++ b/spec/integration/rails_5.2.4.1/Gemfile.lock @@ -109,7 +109,7 @@ GEM nokogiri (1.10.10) mini_portile2 (~> 2.4.0) public_suffix (4.0.6) - puma (4.3.7) + puma (5.3.2) nio4r (~> 2.0) rack (2.2.3) rack-test (1.1.0) @@ -200,7 +200,7 @@ DEPENDENCIES coffee-rails (~> 4.2) jbuilder (~> 2.5) listen (>= 3.0.5, < 3.2) - puma (~> 4.3) + puma (~> 5.3) rails (~> 5.2.4, >= 5.2.4.1) sass-rails (~> 5.0) selenium-webdriver From 786394947c041f781df2ee0ea003e09452fa9dba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Jun 2021 18:41:47 -0700 Subject: [PATCH 18/31] Bump nokogiri from 1.11.2 to 1.11.7 in /spec/integration/rails_6.0.2.1 (#886) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.11.2 to 1.11.7. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.11.2...v1.11.7) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_6.0.2.1/Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/rails_6.0.2.1/Gemfile.lock b/spec/integration/rails_6.0.2.1/Gemfile.lock index 27f471106..aaae8ef30 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile.lock +++ b/spec/integration/rails_6.0.2.1/Gemfile.lock @@ -105,11 +105,11 @@ GEM nokogiri (~> 1) rake mini_mime (1.0.2) - mini_portile2 (2.5.0) + mini_portile2 (2.5.3) minitest (5.14.4) msgpack (1.3.1) nio4r (2.5.2) - nokogiri (1.11.2) + nokogiri (1.11.7) mini_portile2 (~> 2.5.0) racc (~> 1.4) public_suffix (4.0.3) From 69ab1842451728f1b5331a854bb33331a6815306 Mon Sep 17 00:00:00 2001 From: ocarta-l Date: Mon, 31 Jan 2022 17:51:27 +0100 Subject: [PATCH 19/31] Fix: use klass.table_name instead of guessing from associated models (#847) Thanks! --- lib/annotate/annotate_models.rb | 4 +--- spec/lib/annotate/annotate_models_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index ac214ffb4..cacf73cad 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -846,9 +846,7 @@ def ignored_translation_table_colums(klass) # Construct the foreign column name in the translations table # eg. Model: Car, foreign column name: car_id foreign_column_name = [ - klass.translation_class.to_s - .gsub('::Translation', '').gsub('::', '_') - .downcase, + klass.table_name.to_s.singularize, '_id' ].join.to_sym diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index 370298f3c..0cab5f55f 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -389,8 +389,8 @@ def mock_column(name, type, options = {}) context 'with Globalize gem' do let :translation_klass do - double('Post::Translation', - to_s: 'Post::Translation', + double('Folder::Post::Translation', + to_s: 'Folder::Post::Translation', columns: [ mock_column(:id, :integer, limit: 8), mock_column(:post_id, :integer, limit: 8), From ecf70d8f8bb0f770a71b246732b8aa77f8c75501 Mon Sep 17 00:00:00 2001 From: Hiroki Koike Date: Wed, 2 Feb 2022 08:55:21 +0900 Subject: [PATCH 20/31] Fix undefined method error when geometric columns have no `srid` (#920) --- lib/annotate/annotate_models.rb | 4 ++-- spec/lib/annotate/annotate_models_spec.rb | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index cacf73cad..fc503839b 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -887,9 +887,9 @@ def get_attributes(column, column_type, klass, options) # Check out if we got a geometric column # and print the type and SRID if column.respond_to?(:geometry_type) - attrs << "#{column.geometry_type}, #{column.srid}" + attrs << [column.geometry_type, column.try(:srid)].compact.join(', ') elsif column.respond_to?(:geometric_type) && column.geometric_type.present? - attrs << "#{column.geometric_type.to_s.downcase}, #{column.srid}" + attrs << [column.geometric_type.to_s.downcase, column.try(:srid)].compact.join(', ') end # Check if the column has indices and print "indexed" if true diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index 0cab5f55f..c813139a2 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -1168,7 +1168,10 @@ def mock_column(name, type, options = {}) limit: { srid: 4326, type: 'geometry' }), mock_column(:location, :geography, geometric_type: 'Point', srid: 0, - limit: { srid: 0, type: 'geometry' }) + limit: { srid: 0, type: 'geometry' }), + mock_column(:non_srid, :geography, + geometric_type: 'Point', + limit: { type: 'geometry' }) ] end @@ -1182,6 +1185,7 @@ def mock_column(name, type, options = {}) # 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 From eaacc0b12307052f18ef636f9136122d91e35516 Mon Sep 17 00:00:00 2001 From: David Padilla <83060+dabit@users.noreply.github.com> Date: Thu, 3 Feb 2022 12:36:59 -0600 Subject: [PATCH 21/31] Loosen activerecord restriction to work with rails 7 (#912) --- annotate.gemspec | 2 +- spec/integration/rails_5.2.4.1/Gemfile.lock | 2 +- spec/integration/rails_6.0.2.1/Gemfile | 2 +- spec/integration/rails_6.0.2.1/Gemfile.lock | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/annotate.gemspec b/annotate.gemspec index 81e2e6967..43b2ac990 100644 --- a/annotate.gemspec +++ b/annotate.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.specification_version = 4 if s.respond_to? :specification_version s.add_runtime_dependency(%q, '>= 10.4', '< 14.0') - s.add_runtime_dependency(%q, ['>= 3.2', '< 7.0']) + s.add_runtime_dependency(%q, ['>= 3.2', '< 8.0']) s.metadata = { "bug_tracker_uri" => "https://github.com/ctran/annotate_models/issues/", diff --git a/spec/integration/rails_5.2.4.1/Gemfile.lock b/spec/integration/rails_5.2.4.1/Gemfile.lock index 28cf579c5..bc3a50810 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile.lock +++ b/spec/integration/rails_5.2.4.1/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: ../../.. specs: annotate (3.1.1) - activerecord (>= 3.2, < 7.0) + activerecord (>= 3.2, < 8.0) rake (>= 10.4, < 14.0) GEM diff --git a/spec/integration/rails_6.0.2.1/Gemfile b/spec/integration/rails_6.0.2.1/Gemfile index faf2f58ab..4d2b38e57 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile +++ b/spec/integration/rails_6.0.2.1/Gemfile @@ -6,7 +6,7 @@ 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', '~> 4.3' +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 diff --git a/spec/integration/rails_6.0.2.1/Gemfile.lock b/spec/integration/rails_6.0.2.1/Gemfile.lock index aaae8ef30..8e1690675 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile.lock +++ b/spec/integration/rails_6.0.2.1/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: ../../.. specs: annotate (3.1.1) - activerecord (>= 3.2, < 7.0) + activerecord (>= 3.2, < 8.0) rake (>= 10.4, < 14.0) GEM @@ -82,7 +82,7 @@ GEM concurrent-ruby (1.1.8) crass (1.0.6) erubi (1.10.0) - ffi (1.12.2) + ffi (1.15.5) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.10) @@ -113,7 +113,7 @@ GEM mini_portile2 (~> 2.5.0) racc (~> 1.4) public_suffix (4.0.3) - puma (4.3.5) + puma (5.6.1) nio4r (~> 2.0) racc (1.5.2) rack (2.2.3) @@ -146,7 +146,7 @@ GEM rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rake (13.0.3) - rb-fsevent (0.10.3) + rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (1.6.0) @@ -193,7 +193,7 @@ DEPENDENCIES capybara (>= 2.15) jbuilder (~> 2.7) listen (>= 3.0.5, < 3.2) - puma (~> 4.3) + puma (~> 5.6.1) rails (~> 6.0.2, >= 6.0.2.1) selenium-webdriver sqlite3 (~> 1.4) From bbb79eb62b8487dce73d0c9278b02db2da225a41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 13:23:42 -0800 Subject: [PATCH 22/31] Bump puma from 5.3.2 to 5.6.1 in /spec/integration/rails_5.2.4.1 (#925) Bumps [puma](https://github.com/puma/puma) from 5.3.2 to 5.6.1. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v5.3.2...v5.6.1) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_5.2.4.1/Gemfile | 2 +- spec/integration/rails_5.2.4.1/Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/integration/rails_5.2.4.1/Gemfile b/spec/integration/rails_5.2.4.1/Gemfile index 54570fed0..db73e4e13 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile +++ b/spec/integration/rails_5.2.4.1/Gemfile @@ -6,7 +6,7 @@ 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.3' +gem 'puma', '~> 5.6' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets diff --git a/spec/integration/rails_5.2.4.1/Gemfile.lock b/spec/integration/rails_5.2.4.1/Gemfile.lock index bc3a50810..d8f28a0fa 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile.lock +++ b/spec/integration/rails_5.2.4.1/Gemfile.lock @@ -105,11 +105,11 @@ GEM mini_portile2 (2.4.0) minitest (5.14.4) msgpack (1.4.2) - nio4r (2.5.7) + nio4r (2.5.8) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) public_suffix (4.0.6) - puma (5.3.2) + puma (5.6.1) nio4r (~> 2.0) rack (2.2.3) rack-test (1.1.0) @@ -200,7 +200,7 @@ DEPENDENCIES coffee-rails (~> 4.2) jbuilder (~> 2.5) listen (>= 3.0.5, < 3.2) - puma (~> 5.3) + puma (~> 5.6) rails (~> 5.2.4, >= 5.2.4.1) sass-rails (~> 5.0) selenium-webdriver From 77b8cac4dbc95e39f8fbfc5cbe9940289ca53e28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Feb 2022 16:25:39 -0800 Subject: [PATCH 23/31] Bump addressable from 2.7.0 to 2.8.0 in /spec/integration/rails_6.0.2.1 (#889) Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.7.0 to 2.8.0. - [Release notes](https://github.com/sporkmonger/addressable/releases) - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.7.0...addressable-2.8.0) --- updated-dependencies: - dependency-name: addressable dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- spec/integration/rails_6.0.2.1/Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/rails_6.0.2.1/Gemfile.lock b/spec/integration/rails_6.0.2.1/Gemfile.lock index 8e1690675..da8b82f98 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile.lock +++ b/spec/integration/rails_6.0.2.1/Gemfile.lock @@ -63,7 +63,7 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2) - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) bindex (0.8.1) bootsnap (1.4.5) @@ -112,7 +112,7 @@ GEM nokogiri (1.11.7) mini_portile2 (~> 2.5.0) racc (~> 1.4) - public_suffix (4.0.3) + public_suffix (4.0.6) puma (5.6.1) nio4r (~> 2.0) racc (1.5.2) From d3a135de5e3d4d5d853c7d0b9c51819f7bbae6b7 Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Wed, 9 Feb 2022 21:48:58 -0800 Subject: [PATCH 24/31] bump: version to 3.2.0 --- lib/annotate/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/annotate/version.rb b/lib/annotate/version.rb index d08e5a822..e103c6b87 100644 --- a/lib/annotate/version.rb +++ b/lib/annotate/version.rb @@ -1,5 +1,5 @@ module Annotate def self.version - '3.1.1' + '3.2.0' end end From 4319ec855b4d13a136ab3a373aed825857b2a528 Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Wed, 9 Feb 2022 21:57:15 -0800 Subject: [PATCH 25/31] Bump version to 3.2.0 --- lib/annotate/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/annotate/version.rb b/lib/annotate/version.rb index d08e5a822..e103c6b87 100644 --- a/lib/annotate/version.rb +++ b/lib/annotate/version.rb @@ -1,5 +1,5 @@ module Annotate def self.version - '3.1.1' + '3.2.0' end end From 94f499d37837b2b7944ae244869aa3c55f27de68 Mon Sep 17 00:00:00 2001 From: Cuong Tran Date: Wed, 9 Feb 2022 22:00:17 -0800 Subject: [PATCH 26/31] Bump to v3.2.0 --- lib/annotate/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/annotate/version.rb b/lib/annotate/version.rb index d08e5a822..e103c6b87 100644 --- a/lib/annotate/version.rb +++ b/lib/annotate/version.rb @@ -1,5 +1,5 @@ module Annotate def self.version - '3.1.1' + '3.2.0' end end From 09d47235fb776b55ecacdf58d7edbe899f2c34a7 Mon Sep 17 00:00:00 2001 From: Danny Eiden Date: Wed, 23 Sep 2020 16:33:30 -0700 Subject: [PATCH 27/31] Put Comments on New Line for Bare Formatting Prevent unusably spaced formatting that occurs when comments are the length of normal sentences. --- lib/annotate/annotate_models.rb | 41 +++++++++++++------- spec/lib/annotate/annotate_models_spec.rb | 47 +++++++++++++++-------- 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index fc503839b..aa99c14cd 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -138,7 +138,6 @@ def get_schema_info(klass, header, options = {}) max_size = max_schema_info_width(klass, options) md_names_overhead = 6 md_type_allowance = 18 - bare_type_allowance = 16 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' ) @@ -149,24 +148,23 @@ def get_schema_info(klass, header, options = {}) cols.each do |col| 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")})" - else - col.name - end + comment = if with_comments?(klass, options) && col.comment + col.comment.gsub(/\n/, "\\n") + end + commented_name = comment ? "#{col.name}(#{comment})" : col.name if options[:format_rdoc] - info << sprintf("# %-#{max_size}.#{max_size}s%s", "*#{col_name}*::", attrs.unshift(col_type).join(", ")).rstrip + "\n" + info << sprintf("# %-#{max_size}.#{max_size}s%s", "*#{commented_name}*::", attrs.unshift(col_type).join(", ")).rstrip + "\n" elsif options[:format_yard] - info << sprintf("# @!attribute #{col_name}") + "\n" + info << sprintf("# @!attribute #{commented_name}") + "\n" ruby_class = col.respond_to?(:array) && col.array ? "Array<#{map_col_type_to_ruby_classes(col_type)}>": map_col_type_to_ruby_classes(col_type) info << sprintf("# @return [#{ruby_class}]") + "\n" elsif options[:format_markdown] - name_remainder = max_size - col_name.length - non_ascii_length(col_name) + name_remainder = max_size - commented_name.length - non_ascii_length(commented_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" + info << (sprintf("# **`%s`**%#{name_remainder}s | `%s`%#{type_remainder}s | `%s`", commented_name, " ", col_type, " ", attrs.join(", ").rstrip)).gsub('``', ' ').rstrip + "\n" else - info << format_default(col_name, max_size, col_type, bare_type_allowance, attrs) + info << format_default(col.name, max_size, col_type, comment, attrs) end end @@ -764,7 +762,9 @@ def with_comments?(klass, options) def max_schema_info_width(klass, options) cols = columns(klass, options) - if with_comments?(klass, options) + if with_comments?(klass, options) && [ + :format_rdoc, :format_markdown, :format_yard + ].any? { |f| options[f] } max_size = cols.map do |column| column.name.size + (column.comment ? width(column.comment) : 0) end.max || 0 @@ -777,8 +777,21 @@ 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" + def format_default(col_name, max_size, col_type, comment, attrs) + output = sprintf( + "# %s:%s %s", + mb_chars_ljust(col_name, max_size), + mb_chars_ljust(col_type, 16), + attrs.join(", ") + ).rstrip + "\n" + if comment + # Limit comment line length to 73 characters with padding + comment.scan(/.{1,73}(?: |$)/).each_with_index do |comment_part, idx| + template = idx == 0 ? '# ^ %s' : '# %s' + output += sprintf(template, comment_part).rstrip + "\n" + end + end + output end def width(string) diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index c813139a2..33acd2e1b 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -1078,11 +1078,15 @@ def mock_column(name, type, options = {}) # # Table name: users # - # id(ID) :integer not null, primary key - # active(Active) :boolean not null - # name(Name) :string(50) not null - # notes(Notes) :text(55) not null - # no_comment :text(20) not null + # 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 @@ -1113,15 +1117,22 @@ def mock_column(name, type, options = {}) # # Table name: users # - # id(ID) :integer not null, primary key - # active(ACTIVE) :boolean not null - # name(NAME) :string(50) not null - # notes(NOTES) :text(55) not null - # 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 + # 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 @@ -1146,9 +1157,11 @@ def mock_column(name, type, options = {}) # # Table name: users # - # id(ID) :integer not null, primary key - # notes(Notes.\\nMay include things like notes.):text(55) not null - # no_comment :text(20) not null + # 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 From 6620b6ec9b9cf9bdcb8a9f1fad6f26c99630c980 Mon Sep 17 00:00:00 2001 From: Dan McAulay Date: Fri, 23 Jul 2021 17:44:43 -0700 Subject: [PATCH 28/31] feat: add the ability to annotate nested namespaced models --- lib/annotate/annotate_models.rb | 63 ++++++++-- spec/lib/annotate/annotate_models_spec.rb | 142 +++++++++++++++++++++- 2 files changed, 191 insertions(+), 14 deletions(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index aa99c14cd..81f8217da 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -41,12 +41,15 @@ module AnnotateModels MAGIC_COMMENT_MATCHER = Regexp.new(/(^#\s*encoding:.*(?:\n|r\n))|(^# coding:.*(?:\n|\r\n))|(^# -\*- coding:.*(?:\n|\r\n))|(^# -\*- encoding\s?:.*(?:\n|\r\n))|(^#\s*frozen_string_literal:.+(?:\n|\r\n))|(^# -\*- frozen_string_literal\s*:.+-\*-(?:\n|\r\n))/).freeze + # match a basic nested module block with no extra lines between modules. + MODULE_BLOCK_MATCHER = Regexp.new(/( *module \w+(\n|\r\n))+/).freeze + class << self def annotate_pattern(options = {}) if options[:wrapper_open] - return /(?:^(\n|\r\n)?# (?:#{options[:wrapper_open]}).*(\n|\r\n)?# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)(#.*(\n|\r\n))*(\n|\r\n)*)|^(\n|\r\n)?# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)(#.*(\n|\r\n))*(\n|\r\n)*/ + return /(?:^(\n|\r\n)? *# (?:#{options[:wrapper_open]}).*(\n|\r\n)? *# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)( *#.*(\n|\r\n))*(\n|\r\n)*)|^(\n|\r\n)? *# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)( *#.*(\n|\r\n))*(\n|\r\n)*/ end - /^(\n|\r\n)?# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)(#.*(\n|\r\n))*(\n|\r\n)*/ + /^(\n|\r\n)? *# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?(\n|\r\n)( *#.*(\n|\r\n))*(\n|\r\n)*/ end def model_dir @@ -369,14 +372,17 @@ def annotate_one_file(file_name, info_block, position, options = {}) return false if old_content =~ /#{SKIP_ANNOTATION_PREFIX}.*\n/ # Ignore the Schema version line because it changes with each migration - header_pattern = /(^# Table name:.*?\n(#.*[\r]?\n)*[\r]?)/ + header_pattern = /(^ *# Table name:.*?\n( *#.*[\r]?\n)*[\r]?)/ old_header = old_content.match(header_pattern).to_s new_header = info_block.match(header_pattern).to_s - column_pattern = /^#[\t ]+[\w\*\.`]+[\t ]+.+$/ + column_pattern = /^ *#[\t ]+[\w\*\.`]+[\t ]+.+$/ old_columns = old_header && old_header.scan(column_pattern).sort new_columns = new_header && new_header.scan(column_pattern).sort + # remove indentation from old content for comparison + old_columns.each { |c| c.gsub!(/^ *#/, '#') } + return false if old_columns == new_columns && !options[:force] abort "annotate error. #{file_name} needs to be updated, but annotate was run with `--frozen`." if options[:frozen] @@ -386,22 +392,44 @@ def annotate_one_file(file_name, info_block, position, options = {}) wrapper_close = options[:wrapper_close] ? "# #{options[:wrapper_close]}\n" : "" wrapped_info_block = "#{wrapper_open}#{info_block}#{wrapper_close}" + module_block = old_content[MODULE_BLOCK_MATCHER] || '' + unless module_block.empty? + wrapped_info_block = indent_content(wrapped_info_block, module_block.lines.length * 2) + end + old_annotation = old_content.match(annotate_pattern(options)).to_s # if there *was* no old schema info or :force was passed, we simply # need to insert it in correct position if old_annotation.empty? || options[:force] - magic_comments_block = magic_comments_as_string(old_content) - old_content.gsub!(MAGIC_COMMENT_MATCHER, '') old_content.sub!(annotate_pattern(options), '') - new_content = if %w(after bottom).include?(options[position].to_s) - magic_comments_block + (old_content.rstrip + "\n\n" + wrapped_info_block) - elsif magic_comments_block.empty? - magic_comments_block + wrapped_info_block + old_content.lstrip - else - magic_comments_block + "\n" + wrapped_info_block + old_content.lstrip - end + if %w(after bottom).include?(options[position].to_s) + module_end_block = '' + unless module_block.empty? + # build expected end block for each nested module with no extra lines between end statements + module_end_block = (module_block.lines.length - 1).downto(0).map { |l| (' ' * l * 2) + 'end' }.join("\n") + # remove an identical end block. + old_content.gsub!("\n#{module_end_block}", '') + end + new_content = old_content.rstrip + "\n\n" + wrapped_info_block + module_end_block + else + magic_comments_block = magic_comments_as_string(old_content) + old_content.gsub!(MAGIC_COMMENT_MATCHER, '') + + unless module_block.empty? + # remove the module block. + old_content.gsub!(/\n?#{module_block}/, '') + end + + if magic_comments_block.empty? + new_content = module_block + wrapped_info_block + old_content + elsif module_block.empty? + new_content = magic_comments_block + "\n" + wrapped_info_block + old_content.lstrip + else + new_content = magic_comments_block + "\n" + module_block.lstrip + wrapped_info_block + old_content + end + end else # replace the old annotation with the new one @@ -409,6 +437,11 @@ def annotate_one_file(file_name, info_block, position, options = {}) space_match = old_annotation.match(/\A(?\s*).*?\n(?\s*)\z/m) new_annotation = space_match[:start] + wrapped_info_block + space_match[:end] + unless module_block.empty? + # remove extra indentation for the first line. + new_annotation = new_annotation[(module_block.lines.length * 2)..-1] + end + new_content = old_content.sub(annotate_pattern(options), new_annotation) end @@ -426,6 +459,10 @@ def magic_comments_as_string(content) end end + def indent_content(content, indentation) + content.lines.map { |line| ' ' * indentation + line }.join + end + def remove_annotation_of_file(file_name, options = {}) if File.exist?(file_name) content = File.read(file_name) diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index 33acd2e1b..7ee0c3373 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -2543,13 +2543,14 @@ def write_model(file_name, file_content) 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) + result = AnnotateModels.annotate_one_file(@model_file_name, @schema_info, :position_in_class, options) # 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] = '' } Annotate::Constants::FLAG_OPTIONS.each { |key| ENV[key.to_s] = '' } Annotate::Constants::PATH_OPTIONS.each { |key| ENV[key.to_s] = '' } + result end ['before', :before, 'top', :top].each do |position| @@ -2574,6 +2575,60 @@ def annotate_one_file(options = {}) .to eq("# START\n#{@schema_info}# END\n#{@file_content}") end + describe 'handles nested namespaced models without magic comments' do + before do + _, file_content = write_model 'user.rb', <<~EOS + module Foo + # my docs + class User < ActiveRecord::Base + end + end + EOS + + @indented_schema = AnnotateModels.indent_content(@schema_info, 2) + @class_block = file_content.lines[1...-1].join[0...-1] + end + + it 'should place the comment above the class when before' do + annotate_one_file position: :before + expect(File.read(@model_file_name)).to eq("module Foo\n#{@indented_schema}#{@class_block}\nend\n") + end + + it 'should place the comment below the class when after' do + annotate_one_file position: :after + expect(File.read(@model_file_name)).to eq("module Foo\n#{@class_block}\n\n#{@indented_schema}end\n") + end + end + + describe 'handles nested namespaced models with magic comments' do + before do + _, file_content = write_model 'user.rb', <<~EOS + # frozen_string_literal: true + + module Foo + # my docs + class User < ActiveRecord::Base + end + end + EOS + + @indented_schema = AnnotateModels.indent_content(@schema_info, 2) + @class_block = file_content.lines[3...-1].join[0...-1] + end + + it 'should place the comment above the class when before' do + annotate_one_file position: :before + expect(File.read(@model_file_name)) + .to eq("# frozen_string_literal: true\n\nmodule Foo\n#{@indented_schema}#{@class_block}\nend\n") + end + + it 'should place the comment below the class when after' do + annotate_one_file position: :after + expect(File.read(@model_file_name)) + .to eq("# frozen_string_literal: true\n\nmodule Foo\n#{@class_block}\n\n#{@indented_schema}end\n") + end + end + describe 'with existing annotation' do context 'of a foreign key' do before do @@ -2638,6 +2693,58 @@ def annotate_one_file(options = {}) annotate_one_file position: :after, force: true expect(File.read(@model_file_name)).to eq("#{@file_content}\n#{@schema_info}") end + + it 'should skip nested namespaced models that did not change' do + write_model 'user.rb', <<~EOS + module Foo + # == Schema Info + # + # Table name: users + # + # id :integer not null, primary key + # + + # my docs + class User < ActiveRecord::Base + end + end + EOS + expect(annotate_one_file(position: :before)).to be_falsy + end + + it 'should retain the current position for nested namesapced models' do + write_model 'user.rb', <<~EOS + module Foo + # == Schema Info + # + # Table name: users + # + # id :integer not null, primary key + # user_id indexed + + # my docs + class User < ActiveRecord::Base + end + end + EOS + annotate_one_file position: :before + expect(File.read(@model_file_name)).to eq( + <<~HEREDOC, + module Foo + # == Schema Info + # + # Table name: users + # + # id :integer not null, primary key + # + + # my docs + class User < ActiveRecord::Base + end + end + HEREDOC + ) + end end describe 'with existing annotation => :after' do @@ -2661,6 +2768,39 @@ def annotate_one_file(options = {}) annotate_one_file position: :before, force: true expect(File.read(@model_file_name)).to eq("#{@schema_info}#{@file_content}") end + + it 'should retain the current position for nested namesapced models' do + write_model 'user.rb', <<~EOS + module Foo + # my docs + class User < ActiveRecord::Base + end + # == Schema Info + # + # Table name: users + # + # id :integer not null, primary key + # user_id indexed + # + end + EOS + annotate_one_file position: :after + expect(File.read(@model_file_name)).to eq( + <<~HEREDOC, + module Foo + # my docs + class User < ActiveRecord::Base + end + # == Schema Info + # + # Table name: users + # + # id :integer not null, primary key + # + end + HEREDOC + ) + end end it 'should skip columns with option[:ignore_columns] set' do From 658760b95bd5a38a99412aa1a5e68cbce349e1e7 Mon Sep 17 00:00:00 2001 From: Dan McAulay Date: Mon, 2 Aug 2021 11:08:13 -0700 Subject: [PATCH 29/31] chore: update setup ruby ci step --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 953cc7013..f5c11f271 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,14 +14,14 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.4', '2.5', '2.6'] + ruby: ['2.4.10', '2.5.9', '2.6.8'] steps: - name: Checkout uses: actions/checkout@v1 - name: Setup Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@v1.79.0 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From 77f3d29ad238a7c593d428762b6e279f06e5c649 Mon Sep 17 00:00:00 2001 From: Dan McAulay Date: Mon, 2 Aug 2021 11:43:48 -0700 Subject: [PATCH 30/31] fix rubocop errors --- lib/annotate/annotate_models.rb | 60 +++++++++++++---------- spec/lib/annotate/annotate_models_spec.rb | 4 +- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 81f8217da..23af4d540 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -404,32 +404,11 @@ def annotate_one_file(file_name, info_block, position, options = {}) if old_annotation.empty? || options[:force] old_content.sub!(annotate_pattern(options), '') - if %w(after bottom).include?(options[position].to_s) - module_end_block = '' - unless module_block.empty? - # build expected end block for each nested module with no extra lines between end statements - module_end_block = (module_block.lines.length - 1).downto(0).map { |l| (' ' * l * 2) + 'end' }.join("\n") - # remove an identical end block. - old_content.gsub!("\n#{module_end_block}", '') - end - new_content = old_content.rstrip + "\n\n" + wrapped_info_block + module_end_block - else - magic_comments_block = magic_comments_as_string(old_content) - old_content.gsub!(MAGIC_COMMENT_MATCHER, '') - - unless module_block.empty? - # remove the module block. - old_content.gsub!(/\n?#{module_block}/, '') - end - - if magic_comments_block.empty? - new_content = module_block + wrapped_info_block + old_content - elsif module_block.empty? - new_content = magic_comments_block + "\n" + wrapped_info_block + old_content.lstrip - else - new_content = magic_comments_block + "\n" + module_block.lstrip + wrapped_info_block + old_content - end - end + new_content = if %w(after bottom).include?(options[position].to_s) + build_new_content_after(wrapped_info_block, old_content, module_block) + else + build_new_content_before(wrapped_info_block, old_content, module_block) + end else # replace the old annotation with the new one @@ -449,6 +428,35 @@ def annotate_one_file(file_name, info_block, position, options = {}) true end + def build_new_content_after(wrapped_info_block, old_content, module_block) + module_end_block = '' + unless module_block.empty? + # build expected end block for each nested module with no extra lines between end statements + module_end_block = (module_block.lines.length - 1).downto(0).map { |l| (' ' * l * 2) + 'end' }.join("\n") + # remove an identical end block. + old_content.gsub!("\n#{module_end_block}", '') + end + old_content.rstrip + "\n\n" + wrapped_info_block + module_end_block + end + + def build_new_content_before(wrapped_info_block, old_content, module_block) + magic_comments_block = magic_comments_as_string(old_content) + old_content.gsub!(MAGIC_COMMENT_MATCHER, '') + + unless module_block.empty? + # remove the module block. + old_content.gsub!(/\n?#{module_block}/, '') + end + + if magic_comments_block.empty? + module_block + wrapped_info_block + old_content + elsif module_block.empty? + magic_comments_block + "\n" + wrapped_info_block + old_content.lstrip + else + magic_comments_block + "\n" + module_block.lstrip + wrapped_info_block + old_content + end + end + def magic_comments_as_string(content) magic_comments = content.scan(MAGIC_COMMENT_MATCHER).flatten.compact diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index 7ee0c3373..e45b99fd8 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -2729,7 +2729,7 @@ class User < ActiveRecord::Base EOS annotate_one_file position: :before expect(File.read(@model_file_name)).to eq( - <<~HEREDOC, + <<~HEREDOC module Foo # == Schema Info # @@ -2786,7 +2786,7 @@ class User < ActiveRecord::Base EOS annotate_one_file position: :after expect(File.read(@model_file_name)).to eq( - <<~HEREDOC, + <<~HEREDOC module Foo # my docs class User < ActiveRecord::Base From 2e3d977027cc39a94a3ac47030dbb4b3e51f7051 Mon Sep 17 00:00:00 2001 From: Dan McAulay Date: Mon, 19 Sep 2022 16:52:30 -0700 Subject: [PATCH 31/31] chore: add rails 7 support --- .github/workflows/ci.yml | 2 +- .rubocop.yml | 3 +- .rubocop_todo.yml | 220 +++++++++++------- Gemfile | 11 +- annotate.gemspec | 2 +- lib/annotate/annotate_routes.rb | 2 +- .../annotate_routes/header_generator.rb | 2 +- lib/annotate/parser.rb | 2 +- spec/integration/integration_helper.rb | 4 +- spec/integration/rails_5.2.4.1/Gemfile.lock | 214 ----------------- .../app/assets/javascripts/application.js | 16 -- .../app/assets/javascripts/cable.js | 13 -- .../rails_5.2.4.1/app/jobs/application_job.rb | 2 - .../app/views/layouts/application.html.erb | 15 -- spec/integration/rails_5.2.4.1/bin/bundle | 3 - spec/integration/rails_5.2.4.1/bin/update | 31 --- spec/integration/rails_5.2.4.1/bin/yarn | 11 - .../rails_5.2.4.1/config/application.rb | 19 -- .../rails_5.2.4.1/config/credentials.yml.enc | 1 - .../config/initializers/assets.rb | 14 -- .../rails_5.2.4.1/config/routes.rb | 4 - .../rails_5.2.4.1/config/spring.rb | 6 - spec/integration/rails_5.2.4.1/package.json | 5 - .../rails_5.2.4.1/public/robots.txt | 1 - spec/integration/rails_5.2.4.1_spec.rb | 171 -------------- spec/integration/rails_6.0.2.1/Gemfile.lock | 205 ---------------- spec/integration/rails_6.0.2.1_spec.rb | 200 ---------------- .../{rails_6.0.2.1 => rails_6.1.7}/.gitignore | 0 .../app/assets/images => rails_6.1.7}/.keep | 0 .../.rubocop.yml | 0 .../.rubocop_todo.yml | 0 .../{rails_5.2.4.1 => rails_6.1.7}/Gemfile | 21 +- spec/integration/rails_6.1.7/Gemfile.lock | 204 ++++++++++++++++ .../{rails_5.2.4.1 => rails_6.1.7}/README.md | 0 .../{rails_5.2.4.1 => rails_6.1.7}/Rakefile | 0 .../app/assets/config/manifest.js | 0 .../app/assets/images}/.keep | 0 .../app/assets/stylesheets/application.css | 0 .../app/channels/application_cable/channel.rb | 0 .../channels/application_cable/connection.rb | 0 .../app/controllers/application_controller.rb | 0 .../app/controllers/concerns/.keep | 0 .../app/helpers/application_helper.rb | 0 .../app/jobs/application_job.rb | 0 .../app/mailers/application_mailer.rb | 0 .../app/models/application_record.rb | 0 .../app/models/concerns/.keep | 0 .../app/models/task.rb | 0 .../app/views/layouts/application.html.erb | 14 ++ .../app/views/layouts/mailer.html.erb | 0 .../app/views/layouts/mailer.text.erb | 0 .../{rails_6.0.2.1 => rails_6.1.7}/bin/bundle | 0 .../{rails_5.2.4.1 => rails_6.1.7}/bin/rails | 0 .../{rails_5.2.4.1 => rails_6.1.7}/bin/rake | 0 .../{rails_6.0.2.1 => rails_6.1.7}/bin/setup | 0 .../{rails_5.2.4.1 => rails_6.1.7}/config.ru | 0 .../rails_6.1.7/config/application.rb | 30 +++ .../config/boot.rb | 0 .../config/cable.yml | 0 .../config/credentials.yml.enc | 0 .../config/database.yml | 0 .../config/environment.rb | 0 .../config/environments/development.rb | 0 .../config/environments/production.rb | 0 .../config/environments/test.rb | 0 .../application_controller_renderer.rb | 0 .../initializers/backtrace_silencers.rb | 0 .../initializers/content_security_policy.rb | 0 .../config/initializers/cookies_serializer.rb | 0 .../initializers/filter_parameter_logging.rb | 0 .../config/initializers/inflections.rb | 0 .../config/initializers/mime_types.rb | 0 .../config/initializers/wrap_parameters.rb | 0 .../config/locales/en.yml | 0 .../config/multi-database.yml | 0 .../config/puma.rb | 0 .../config/routes.rb | 0 .../config/storage.yml | 0 .../db/migrate/20200201204456_create_tasks.rb | 0 .../db/schema.rb | 4 +- .../db/seeds.rb | 0 .../lib/assets/.keep | 0 .../lib/tasks/.keep | 0 .../{rails_5.2.4.1 => rails_6.1.7}/log/.keep | 0 .../public/404.html | 0 .../public/422.html | 0 .../public/500.html | 0 .../public/apple-touch-icon-precomposed.png | 0 .../public/apple-touch-icon.png | 0 .../public/favicon.ico | 0 .../public/robots.txt | 0 .../storage/.keep | 0 .../test/application_system_test_case.rb | 0 .../application_cable/connection_test.rb | 0 .../test/controllers/.keep | 0 .../test/fixtures/.keep | 0 .../test/fixtures/files/.keep | 0 .../test/fixtures/tasks.yml | 0 .../test/helpers/.keep | 0 .../test/integration/.keep | 0 .../test/mailers/.keep | 0 .../test/models/.keep | 0 .../test/models/task_test.rb | 0 .../test/system/.keep | 0 .../test/test_helper.rb | 0 .../{rails_5.2.4.1 => rails_6.1.7}/tmp/.keep | 0 .../vendor/.keep | 0 spec/integration/rails_6.1.7_spec.rb | 207 ++++++++++++++++ .../{rails_5.2.4.1 => rails_7.0.4}/.gitignore | 13 +- .../{rails_6.0.2.1 => rails_7.0.4}/.keep | 0 spec/integration/rails_7.0.4/.rubocop.yml | 1 + .../integration/rails_7.0.4/.rubocop_todo.yml | 156 +++++++++++++ .../{rails_6.0.2.1 => rails_7.0.4}/Gemfile | 2 +- spec/integration/rails_7.0.4/Gemfile.lock | 220 ++++++++++++++++++ .../{rails_6.0.2.1 => rails_7.0.4}/README.md | 0 .../{rails_6.0.2.1 => rails_7.0.4}/Rakefile | 0 .../app/assets/config/manifest.js | 1 - .../app/assets/images/.keep | 0 .../app/assets/stylesheets/application.css | 0 .../app/channels/application_cable/channel.rb | 0 .../channels/application_cable/connection.rb | 0 .../app/controllers/application_controller.rb | 0 .../app/controllers/concerns/.keep | 0 .../app/helpers/application_helper.rb | 0 .../rails_7.0.4/app/jobs/application_job.rb | 7 + .../app/mailers/application_mailer.rb | 0 .../app/models/application_record.rb | 0 .../app/models/concerns/.keep | 0 .../app/models/task.rb | 0 .../app/views/layouts/application.html.erb | 0 .../app/views/layouts/mailer.html.erb | 0 .../app/views/layouts/mailer.text.erb | 0 spec/integration/rails_7.0.4/bin/bundle | 105 +++++++++ .../{rails_6.0.2.1 => rails_7.0.4}/bin/rails | 0 .../{rails_6.0.2.1 => rails_7.0.4}/bin/rake | 0 .../{rails_5.2.4.1 => rails_7.0.4}/bin/setup | 13 +- .../{rails_6.0.2.1 => rails_7.0.4}/config.ru | 0 .../config/application.rb | 0 .../config/boot.rb | 0 .../config/cable.yml | 4 +- .../rails_7.0.4/config/credentials.yml.enc | 1 + .../config/database.yml | 2 +- .../config/environment.rb | 0 .../config/environments/development.rb | 12 +- .../config/environments/production.rb | 38 +-- .../config/environments/test.rb | 14 +- .../application_controller_renderer.rb | 0 .../initializers/backtrace_silencers.rb | 0 .../initializers/content_security_policy.rb | 3 + .../config/initializers/cookies_serializer.rb | 0 .../initializers/filter_parameter_logging.rb | 0 .../config/initializers/inflections.rb | 0 .../config/initializers/mime_types.rb | 0 .../config/initializers/wrap_parameters.rb | 0 .../config/locales/en.yml | 2 +- .../rails_7.0.4/config/multi-database.yml | 37 +++ .../config/puma.rb | 7 +- spec/integration/rails_7.0.4/config/routes.rb | 4 + .../config/storage.yml | 0 .../migrate/20200201204456_create_tasks.rb} | 2 +- .../db/schema.rb | 13 +- .../db/seeds.rb | 0 .../lib/assets/.keep | 0 .../lib/tasks/.keep | 0 .../{rails_6.0.2.1 => rails_7.0.4}/log/.keep | 0 .../public/404.html | 0 .../public/422.html | 0 .../public/500.html | 0 .../public/apple-touch-icon-precomposed.png | 0 .../public/apple-touch-icon.png | 0 .../public/favicon.ico | 0 .../integration/rails_7.0.4/public/robots.txt | 1 + .../storage/.keep | 0 .../test/application_system_test_case.rb | 0 .../application_cable/connection_test.rb | 11 + .../test/controllers/.keep | 0 .../test/fixtures/.keep | 0 .../test/fixtures/files/.keep | 0 .../test/fixtures/tasks.yml | 2 +- .../test/helpers/.keep | 0 .../test/integration/.keep | 0 .../test/mailers/.keep | 0 .../test/models/.keep | 0 .../test/models/task_test.rb | 0 .../test/system/.keep | 0 .../test/test_helper.rb | 3 + .../{rails_6.0.2.1 => rails_7.0.4}/tmp/.keep | 0 .../vendor/.keep | 0 spec/integration/rails_7.0.4_spec.rb | 208 +++++++++++++++++ spec/lib/annotate/annotate_routes_spec.rb | 20 +- 190 files changed, 1447 insertions(+), 1114 deletions(-) delete mode 100644 spec/integration/rails_5.2.4.1/Gemfile.lock 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/jobs/application_job.rb delete mode 100644 spec/integration/rails_5.2.4.1/app/views/layouts/application.html.erb delete mode 100755 spec/integration/rails_5.2.4.1/bin/bundle 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/application.rb 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/initializers/assets.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/package.json delete mode 100644 spec/integration/rails_5.2.4.1/public/robots.txt delete mode 100644 spec/integration/rails_5.2.4.1_spec.rb delete mode 100644 spec/integration/rails_6.0.2.1/Gemfile.lock delete mode 100644 spec/integration/rails_6.0.2.1_spec.rb rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/.gitignore (100%) rename spec/integration/{rails_5.2.4.1/app/assets/images => rails_6.1.7}/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/.rubocop.yml (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/.rubocop_todo.yml (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/Gemfile (80%) create mode 100644 spec/integration/rails_6.1.7/Gemfile.lock rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/README.md (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/Rakefile (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/app/assets/config/manifest.js (100%) rename spec/integration/{rails_5.2.4.1/app/assets/javascripts/channels => rails_6.1.7/app/assets/images}/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/assets/stylesheets/application.css (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/channels/application_cable/channel.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/channels/application_cable/connection.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/controllers/application_controller.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/controllers/concerns/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/helpers/application_helper.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/app/jobs/application_job.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/mailers/application_mailer.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/models/application_record.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/models/concerns/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/models/task.rb (100%) create mode 100644 spec/integration/rails_6.1.7/app/views/layouts/application.html.erb rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/views/layouts/mailer.html.erb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/app/views/layouts/mailer.text.erb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/bin/bundle (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/bin/rails (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/bin/rake (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/bin/setup (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config.ru (100%) create mode 100644 spec/integration/rails_6.1.7/config/application.rb rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/boot.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/cable.yml (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/credentials.yml.enc (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/database.yml (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/environment.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/environments/development.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/environments/production.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/environments/test.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/initializers/application_controller_renderer.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/initializers/backtrace_silencers.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/initializers/content_security_policy.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/initializers/cookies_serializer.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/initializers/filter_parameter_logging.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/initializers/inflections.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/initializers/mime_types.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/initializers/wrap_parameters.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/locales/en.yml (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/multi-database.yml (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/puma.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/config/routes.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/config/storage.yml (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/db/migrate/20200201204456_create_tasks.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/db/schema.rb (89%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/db/seeds.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/lib/assets/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/lib/tasks/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/log/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/public/404.html (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/public/422.html (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/public/500.html (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/public/apple-touch-icon-precomposed.png (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/public/apple-touch-icon.png (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/public/favicon.ico (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/public/robots.txt (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/storage/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/application_system_test_case.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/test/channels/application_cable/connection_test.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/controllers/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/fixtures/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/fixtures/files/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/test/fixtures/tasks.yml (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/helpers/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/integration/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/mailers/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/models/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/models/task_test.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/test/system/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_6.1.7}/test/test_helper.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/tmp/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_6.1.7}/vendor/.keep (100%) create mode 100644 spec/integration/rails_6.1.7_spec.rb rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/.gitignore (84%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/.keep (100%) create mode 100644 spec/integration/rails_7.0.4/.rubocop.yml create mode 100644 spec/integration/rails_7.0.4/.rubocop_todo.yml rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/Gemfile (97%) create mode 100644 spec/integration/rails_7.0.4/Gemfile.lock rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/README.md (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/Rakefile (100%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/app/assets/config/manifest.js (62%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/assets/images/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/assets/stylesheets/application.css (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/channels/application_cable/channel.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/channels/application_cable/connection.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/controllers/application_controller.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/controllers/concerns/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/helpers/application_helper.rb (100%) create mode 100644 spec/integration/rails_7.0.4/app/jobs/application_job.rb rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/mailers/application_mailer.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/models/application_record.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/models/concerns/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/models/task.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/views/layouts/application.html.erb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/views/layouts/mailer.html.erb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/app/views/layouts/mailer.text.erb (100%) create mode 100755 spec/integration/rails_7.0.4/bin/bundle rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/bin/rails (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/bin/rake (100%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/bin/setup (68%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config.ru (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/application.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/boot.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/config/cable.yml (69%) create mode 100644 spec/integration/rails_7.0.4/config/credentials.yml.enc rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/config/database.yml (92%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/environment.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/config/environments/development.rb (84%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/config/environments/production.rb (71%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/config/environments/test.rb (80%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/initializers/application_controller_renderer.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/initializers/backtrace_silencers.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/config/initializers/content_security_policy.rb (89%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/initializers/cookies_serializer.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/initializers/filter_parameter_logging.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/initializers/inflections.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/initializers/mime_types.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/initializers/wrap_parameters.rb (100%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/config/locales/en.yml (93%) create mode 100644 spec/integration/rails_7.0.4/config/multi-database.yml rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/config/puma.rb (83%) create mode 100644 spec/integration/rails_7.0.4/config/routes.rb rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/config/storage.yml (100%) rename spec/integration/{rails_5.2.4.1/db/migrate/20200204052946_create_tasks.rb => rails_7.0.4/db/migrate/20200201204456_create_tasks.rb} (78%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/db/schema.rb (55%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/db/seeds.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/lib/assets/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/lib/tasks/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/log/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/public/404.html (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/public/422.html (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/public/500.html (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/public/apple-touch-icon-precomposed.png (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/public/apple-touch-icon.png (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/public/favicon.ico (100%) create mode 100644 spec/integration/rails_7.0.4/public/robots.txt rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/storage/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/application_system_test_case.rb (100%) create mode 100644 spec/integration/rails_7.0.4/test/channels/application_cable/connection_test.rb rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/controllers/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/fixtures/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/fixtures/files/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/test/fixtures/tasks.yml (54%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/helpers/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/integration/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/mailers/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/models/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/models/task_test.rb (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/test/system/.keep (100%) rename spec/integration/{rails_5.2.4.1 => rails_7.0.4}/test/test_helper.rb (75%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/tmp/.keep (100%) rename spec/integration/{rails_6.0.2.1 => rails_7.0.4}/vendor/.keep (100%) create mode 100644 spec/integration/rails_7.0.4_spec.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5c11f271..76b0b891b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.4.10', '2.5.9', '2.6.8'] + ruby: ['2.7.4'] steps: - name: Checkout diff --git a/.rubocop.yml b/.rubocop.yml index 0ee94770e..fab95fe63 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,4 @@ -inherit_from: - - .rubocop_todo.yml +inherit_from: .rubocop_todo.yml AllCops: Exclude: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 246a23ea6..7b50e7198 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-09-26 19:57:02 UTC using RuboCop version 1.7.0. # 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,30 +8,12 @@ # Offense count: 1 # Cop supports --auto-correct. -# Configuration parameters: TreatCommentsAsGroupSeparators, Include. +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. # Include: **/*.gemspec Gemspec/OrderedDependencies: Exclude: - 'annotate.gemspec' -# Offense count: 1 -# Configuration parameters: Include. -# Include: **/*.gemspec -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. @@ -55,22 +37,32 @@ Layout/EmptyLineAfterMagicComment: - 'annotate.gemspec' - 'spec/lib/annotate/annotate_models_spec.rb' -# Offense count: 3 +# Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. Layout/ExtraSpacing: Exclude: - 'Guardfile' - - '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 +81,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 +129,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 +150,13 @@ Lint/AssignmentInCondition: Exclude: - 'lib/annotate/annotate_models.rb' -# Offense count: 1 -Lint/HandleExceptions: +# Offense count: 9 +# 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 +182,20 @@ Lint/ShadowingOuterLocalVariable: Exclude: - 'Rakefile' -# Offense count: 22 +# Offense count: 1 +# Configuration parameters: AllowComments. +Lint/SuppressedException: + Exclude: + - 'bin/annotate' + +# 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 +204,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: 33 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: - Max: 40 + Max: 38 -# 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: 110 +# Configuration parameters: ForbiddenDelimiters. +# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) Naming/HeredocDelimiterNaming: Exclude: - 'spec/lib/annotate/annotate_models_spec.rb' @@ -236,37 +241,56 @@ 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: 2 +# 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: 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: 3 +# Cop supports --auto-correct. +# Configuration parameters: Keywords. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE +Style/CommentAnnotation: + Exclude: + - 'Guardfile' + - 'Rakefile' + - 'lib/annotate/annotate_models.rb' + # Offense count: 1 # Cop supports --auto-correct. Style/Dir: @@ -301,7 +325,7 @@ Style/ExpandPathArguments: Exclude: - 'annotate.gemspec' -# Offense count: 9 +# Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: format, sprintf, percent @@ -309,17 +333,16 @@ Style/FormatString: Exclude: - 'lib/annotate/annotate_models.rb' -# Offense count: 23 -# Configuration parameters: EnforcedStyle. +# Offense count: 12 +# Configuration parameters: MaxUnannotatedPlaceholdersAllowed. # 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 +352,12 @@ Style/GuardClause: Exclude: - 'lib/tasks/annotate_models_migrate.rake' +# Offense count: 1 +# Cop supports --auto-correct. +Style/HashEachMethods: + Exclude: + - 'Rakefile' + # Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. @@ -338,7 +367,7 @@ Style/HashSyntax: - 'lib/tasks/annotate_routes.rake' - 'spec/lib/annotate/annotate_models_spec.rb' -# Offense count: 7 +# Offense count: 9 # Cop supports --auto-correct. Style/IfUnlessModifier: Exclude: @@ -353,11 +382,6 @@ Style/InverseMethods: Exclude: - 'Rakefile' -# Offense count: 1 -Style/MethodMissingSuper: - Exclude: - - 'lib/annotate/active_record_patch.rb' - # Offense count: 1 Style/MissingRespondToMissing: Exclude: @@ -376,15 +400,15 @@ Style/MultilineBlockChain: # 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 +# Offense count: 4 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# Configuration parameters: EnforcedStyle, IgnoredMethods. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: @@ -392,7 +416,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,7 +430,7 @@ Style/PercentLiteralDelimiters: # Offense count: 1 # Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. +# Configuration parameters: EnforcedStyle, AllowedCompactTypes. # SupportedStyles: compact, exploded Style/RaiseArgs: Exclude: @@ -425,6 +449,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. @@ -461,14 +504,21 @@ Style/RescueStandardError: Exclude: - 'lib/annotate.rb' -# Offense count: 2 +# Offense count: 3 # 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: 4 +# 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 +527,13 @@ Style/StderrPuts: - 'lib/annotate.rb' - 'lib/annotate/annotate_models.rb' -# Offense count: 55 +# Offense count: 16 +# Cop supports --auto-correct. +Style/StringConcatenation: + Exclude: + - 'lib/annotate/annotate_models.rb' + +# Offense count: 58 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # SupportedStyles: single_quotes, double_quotes @@ -491,7 +547,7 @@ Style/StringLiterals: - 'spec/lib/annotate/annotate_models_spec.rb' - 'spec/lib/annotate/parser_spec.rb' -# Offense count: 2 +# Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: single_quotes, double_quotes @@ -499,7 +555,7 @@ Style/StringLiteralsInInterpolation: Exclude: - 'lib/annotate/annotate_models.rb' -# Offense count: 8 +# Offense count: 9 # Cop supports --auto-correct. # Configuration parameters: MinSize. # SupportedStyles: percent, brackets @@ -520,15 +576,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: 51 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https -Metrics/LineLength: +Layout/LineLength: Max: 264 diff --git a/Gemfile b/Gemfile index 4acd9cb84..8065a1312 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -ruby '>= 2.4.0' +ruby '>= 2.7.0' -gem 'activerecord', '>= 4.2.5', '< 6', require: false +gem 'activerecord', '>= 6.1', '< 7.1', require: false gem 'rake', require: false group :development do @@ -19,11 +19,8 @@ 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.7.0' + gem 'simplecov', require: false gem 'terminal-notifier-guard', require: false gem 'codeclimate-test-reporter' diff --git a/annotate.gemspec b/annotate.gemspec index 43b2ac990..2a2d9bd12 100644 --- a/annotate.gemspec +++ b/annotate.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |s| s.name = 'annotate' s.version = Annotate.version - s.required_ruby_version = '>= 2.4.0' + s.required_ruby_version = '>= 2.7.0' s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version= s.authors = ['Alex Chaffee', 'Cuong Tran', 'Marcos Piccinini', 'Turadg Aleahmad', 'Jon Frisby'] s.description = 'Annotates Rails/ActiveRecord Models, routes, fixtures, and others based on the database schema.' diff --git a/lib/annotate/annotate_routes.rb b/lib/annotate/annotate_routes.rb index 75cc421ed..f85cadc56 100644 --- a/lib/annotate/annotate_routes.rb +++ b/lib/annotate/annotate_routes.rb @@ -4,7 +4,7 @@ # # # -# Prepends the output of "rake routes" to the top of your routes.rb file. +# Prepends the output of "rails routes" to the top of your routes.rb file. # Yes, it's simple but I'm thick and often need a reminder of what my routes # mean. # diff --git a/lib/annotate/annotate_routes/header_generator.rb b/lib/annotate/annotate_routes/header_generator.rb index b1c93acf7..19a74c106 100644 --- a/lib/annotate/annotate_routes/header_generator.rb +++ b/lib/annotate/annotate_routes/header_generator.rb @@ -16,7 +16,7 @@ def generate(options = {}) private def routes_map(options) - result = `rake routes`.chomp("\n").split(/\n/, -1) + result = `rails routes`.chomp("\n").split(/\n/, -1) # In old versions of Rake, the first line of output was the cwd. Not so # much in newer ones. We ditch that line if it exists, and if not, we diff --git a/lib/annotate/parser.rb b/lib/annotate/parser.rb index cb27b8b5d..683abcadd 100644 --- a/lib/annotate/parser.rb +++ b/lib/annotate/parser.rb @@ -145,7 +145,7 @@ def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength option_parser.on('-r', '--routes', - "Annotate routes.rb with the output of 'rake routes'") do + "Annotate routes.rb with the output of 'rails routes'") do env['routes'] = 'true' end diff --git a/spec/integration/integration_helper.rb b/spec/integration/integration_helper.rb index 79ce49a50..153a8b547 100644 --- a/spec/integration/integration_helper.rb +++ b/spec/integration/integration_helper.rb @@ -1,7 +1,7 @@ class IntegrationHelper MIN_RUBY_VERSIONS = { - 'rails_5.2.4.1' => '>= 2.2.2', - 'rails_6.0.2.1' => '>= 2.5.0' + 'rails_6.1.7' => '>= 2.7.0', + 'rails_7.0.4' => '>= 2.7.0', }.freeze def self.able_to_run?(file_path, ruby_version) 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/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/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/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/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/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/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/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/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/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/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/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_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/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_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/integration/rails_6.0.2.1/.gitignore b/spec/integration/rails_6.1.7/.gitignore similarity index 100% rename from spec/integration/rails_6.0.2.1/.gitignore rename to spec/integration/rails_6.1.7/.gitignore diff --git a/spec/integration/rails_5.2.4.1/app/assets/images/.keep b/spec/integration/rails_6.1.7/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/app/assets/images/.keep rename to spec/integration/rails_6.1.7/.keep diff --git a/spec/integration/rails_6.0.2.1/.rubocop.yml b/spec/integration/rails_6.1.7/.rubocop.yml similarity index 100% rename from spec/integration/rails_6.0.2.1/.rubocop.yml rename to spec/integration/rails_6.1.7/.rubocop.yml diff --git a/spec/integration/rails_6.0.2.1/.rubocop_todo.yml b/spec/integration/rails_6.1.7/.rubocop_todo.yml similarity index 100% rename from spec/integration/rails_6.0.2.1/.rubocop_todo.yml rename to spec/integration/rails_6.1.7/.rubocop_todo.yml diff --git a/spec/integration/rails_5.2.4.1/Gemfile b/spec/integration/rails_6.1.7/Gemfile similarity index 80% rename from spec/integration/rails_5.2.4.1/Gemfile rename to spec/integration/rails_6.1.7/Gemfile index db73e4e13..4271cddee 100644 --- a/spec/integration/rails_5.2.4.1/Gemfile +++ b/spec/integration/rails_6.1.7/Gemfile @@ -2,9 +2,9 @@ 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' +gem 'rails', '6.1.7' # Use sqlite3 as the database for Active Record -gem 'sqlite3' +gem 'sqlite3', '~> 1.4' # Use Puma as the app server gem 'puma', '~> 5.6' # Use SCSS for stylesheets @@ -19,20 +19,17 @@ 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' +gem 'jbuilder', '~> 2.7' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' -# Use ActiveModel has_secure_password +# Use Active Model 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 +# Use Active Storage variant +# gem 'image_processing', '~> 1.2' # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.1.0', require: false +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 @@ -51,8 +48,8 @@ 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' + # 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 diff --git a/spec/integration/rails_6.1.7/Gemfile.lock b/spec/integration/rails_6.1.7/Gemfile.lock new file mode 100644 index 000000000..2a88fbe96 --- /dev/null +++ b/spec/integration/rails_6.1.7/Gemfile.lock @@ -0,0 +1,204 @@ +PATH + remote: ../../.. + specs: + annotate (3.1.1) + activerecord (>= 6.1, < 7.1) + rake (>= 10.4, < 14.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.7) + actionpack (= 6.1.7) + activesupport (= 6.1.7) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7) + actionpack (= 6.1.7) + activejob (= 6.1.7) + activerecord (= 6.1.7) + activestorage (= 6.1.7) + activesupport (= 6.1.7) + mail (>= 2.7.1) + actionmailer (6.1.7) + actionpack (= 6.1.7) + actionview (= 6.1.7) + activejob (= 6.1.7) + activesupport (= 6.1.7) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7) + actionview (= 6.1.7) + activesupport (= 6.1.7) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7) + actionpack (= 6.1.7) + activerecord (= 6.1.7) + activestorage (= 6.1.7) + activesupport (= 6.1.7) + nokogiri (>= 1.8.5) + actionview (6.1.7) + activesupport (= 6.1.7) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7) + activesupport (= 6.1.7) + globalid (>= 0.3.6) + activemodel (6.1.7) + activesupport (= 6.1.7) + activerecord (6.1.7) + activemodel (= 6.1.7) + activesupport (= 6.1.7) + activestorage (6.1.7) + actionpack (= 6.1.7) + activejob (= 6.1.7) + activerecord (= 6.1.7) + activesupport (= 6.1.7) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.7.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.10) + crass (1.0.6) + erubi (1.11.0) + ffi (1.12.2) + globalid (1.0.0) + activesupport (>= 5.0) + i18n (1.12.0) + 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.19.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (1.0.2) + method_source (1.0.0) + mini_mime (1.1.2) + mini_portile2 (2.8.0) + minitest (5.16.3) + msgpack (1.3.1) + nio4r (2.5.8) + nokogiri (1.13.8) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + public_suffix (4.0.3) + puma (4.3.8) + nio4r (~> 2.0) + racc (1.6.0) + rack (2.2.4) + rack-test (2.0.2) + rack (>= 1.3) + rails (6.1.7) + actioncable (= 6.1.7) + actionmailbox (= 6.1.7) + actionmailer (= 6.1.7) + actionpack (= 6.1.7) + actiontext (= 6.1.7) + actionview (= 6.1.7) + activejob (= 6.1.7) + activemodel (= 6.1.7) + activerecord (= 6.1.7) + activestorage (= 6.1.7) + activesupport (= 6.1.7) + bundler (>= 1.15.0) + railties (= 6.1.7) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.4.3) + loofah (~> 2.3) + railties (6.1.7) + actionpack (= 6.1.7) + activesupport (= 6.1.7) + method_source + rake (>= 12.2) + thor (~> 1.0) + rake (13.0.6) + rb-fsevent (0.10.3) + 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.1.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + thor (1.2.1) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) + 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.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.6.0) + +PLATFORMS + ruby + +DEPENDENCIES + annotate! + bootsnap (>= 1.4.2) + byebug + capybara (>= 2.15) + jbuilder (~> 2.7) + listen (>= 3.0.5, < 3.2) + puma (~> 4.3.8) + rails (= 6.1.7) + selenium-webdriver + sqlite3 (~> 1.4) + tzinfo-data + web-console (>= 3.3.0) + webdrivers + +BUNDLED WITH + 2.2.33 diff --git a/spec/integration/rails_5.2.4.1/README.md b/spec/integration/rails_6.1.7/README.md similarity index 100% rename from spec/integration/rails_5.2.4.1/README.md rename to spec/integration/rails_6.1.7/README.md diff --git a/spec/integration/rails_5.2.4.1/Rakefile b/spec/integration/rails_6.1.7/Rakefile similarity index 100% rename from spec/integration/rails_5.2.4.1/Rakefile rename to spec/integration/rails_6.1.7/Rakefile diff --git a/spec/integration/rails_6.0.2.1/app/assets/config/manifest.js b/spec/integration/rails_6.1.7/app/assets/config/manifest.js similarity index 100% rename from spec/integration/rails_6.0.2.1/app/assets/config/manifest.js rename to spec/integration/rails_6.1.7/app/assets/config/manifest.js diff --git a/spec/integration/rails_5.2.4.1/app/assets/javascripts/channels/.keep b/spec/integration/rails_6.1.7/app/assets/images/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/app/assets/javascripts/channels/.keep rename to spec/integration/rails_6.1.7/app/assets/images/.keep diff --git a/spec/integration/rails_5.2.4.1/app/assets/stylesheets/application.css b/spec/integration/rails_6.1.7/app/assets/stylesheets/application.css similarity index 100% rename from spec/integration/rails_5.2.4.1/app/assets/stylesheets/application.css rename to spec/integration/rails_6.1.7/app/assets/stylesheets/application.css diff --git a/spec/integration/rails_5.2.4.1/app/channels/application_cable/channel.rb b/spec/integration/rails_6.1.7/app/channels/application_cable/channel.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/channels/application_cable/channel.rb rename to spec/integration/rails_6.1.7/app/channels/application_cable/channel.rb diff --git a/spec/integration/rails_5.2.4.1/app/channels/application_cable/connection.rb b/spec/integration/rails_6.1.7/app/channels/application_cable/connection.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/channels/application_cable/connection.rb rename to spec/integration/rails_6.1.7/app/channels/application_cable/connection.rb diff --git a/spec/integration/rails_5.2.4.1/app/controllers/application_controller.rb b/spec/integration/rails_6.1.7/app/controllers/application_controller.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/controllers/application_controller.rb rename to spec/integration/rails_6.1.7/app/controllers/application_controller.rb diff --git a/spec/integration/rails_5.2.4.1/app/controllers/concerns/.keep b/spec/integration/rails_6.1.7/app/controllers/concerns/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/app/controllers/concerns/.keep rename to spec/integration/rails_6.1.7/app/controllers/concerns/.keep diff --git a/spec/integration/rails_5.2.4.1/app/helpers/application_helper.rb b/spec/integration/rails_6.1.7/app/helpers/application_helper.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/helpers/application_helper.rb rename to spec/integration/rails_6.1.7/app/helpers/application_helper.rb diff --git a/spec/integration/rails_6.0.2.1/app/jobs/application_job.rb b/spec/integration/rails_6.1.7/app/jobs/application_job.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/jobs/application_job.rb rename to spec/integration/rails_6.1.7/app/jobs/application_job.rb diff --git a/spec/integration/rails_5.2.4.1/app/mailers/application_mailer.rb b/spec/integration/rails_6.1.7/app/mailers/application_mailer.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/mailers/application_mailer.rb rename to spec/integration/rails_6.1.7/app/mailers/application_mailer.rb diff --git a/spec/integration/rails_5.2.4.1/app/models/application_record.rb b/spec/integration/rails_6.1.7/app/models/application_record.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/models/application_record.rb rename to spec/integration/rails_6.1.7/app/models/application_record.rb diff --git a/spec/integration/rails_5.2.4.1/app/models/concerns/.keep b/spec/integration/rails_6.1.7/app/models/concerns/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/app/models/concerns/.keep rename to spec/integration/rails_6.1.7/app/models/concerns/.keep diff --git a/spec/integration/rails_5.2.4.1/app/models/task.rb b/spec/integration/rails_6.1.7/app/models/task.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/models/task.rb rename to spec/integration/rails_6.1.7/app/models/task.rb diff --git a/spec/integration/rails_6.1.7/app/views/layouts/application.html.erb b/spec/integration/rails_6.1.7/app/views/layouts/application.html.erb new file mode 100644 index 000000000..2b798dcd5 --- /dev/null +++ b/spec/integration/rails_6.1.7/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Rails617 + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= stylesheet_link_tag 'application', media: 'all' %> + + + + <%= yield %> + + diff --git a/spec/integration/rails_5.2.4.1/app/views/layouts/mailer.html.erb b/spec/integration/rails_6.1.7/app/views/layouts/mailer.html.erb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/views/layouts/mailer.html.erb rename to spec/integration/rails_6.1.7/app/views/layouts/mailer.html.erb diff --git a/spec/integration/rails_5.2.4.1/app/views/layouts/mailer.text.erb b/spec/integration/rails_6.1.7/app/views/layouts/mailer.text.erb similarity index 100% rename from spec/integration/rails_5.2.4.1/app/views/layouts/mailer.text.erb rename to spec/integration/rails_6.1.7/app/views/layouts/mailer.text.erb diff --git a/spec/integration/rails_6.0.2.1/bin/bundle b/spec/integration/rails_6.1.7/bin/bundle similarity index 100% rename from spec/integration/rails_6.0.2.1/bin/bundle rename to spec/integration/rails_6.1.7/bin/bundle diff --git a/spec/integration/rails_5.2.4.1/bin/rails b/spec/integration/rails_6.1.7/bin/rails similarity index 100% rename from spec/integration/rails_5.2.4.1/bin/rails rename to spec/integration/rails_6.1.7/bin/rails diff --git a/spec/integration/rails_5.2.4.1/bin/rake b/spec/integration/rails_6.1.7/bin/rake similarity index 100% rename from spec/integration/rails_5.2.4.1/bin/rake rename to spec/integration/rails_6.1.7/bin/rake diff --git a/spec/integration/rails_6.0.2.1/bin/setup b/spec/integration/rails_6.1.7/bin/setup similarity index 100% rename from spec/integration/rails_6.0.2.1/bin/setup rename to spec/integration/rails_6.1.7/bin/setup diff --git a/spec/integration/rails_5.2.4.1/config.ru b/spec/integration/rails_6.1.7/config.ru similarity index 100% rename from spec/integration/rails_5.2.4.1/config.ru rename to spec/integration/rails_6.1.7/config.ru diff --git a/spec/integration/rails_6.1.7/config/application.rb b/spec/integration/rails_6.1.7/config/application.rb new file mode 100644 index 000000000..8b1ea0da0 --- /dev/null +++ b/spec/integration/rails_6.1.7/config/application.rb @@ -0,0 +1,30 @@ +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 Rails617 + class Application < Rails::Application + # 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_5.2.4.1/config/boot.rb b/spec/integration/rails_6.1.7/config/boot.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/boot.rb rename to spec/integration/rails_6.1.7/config/boot.rb diff --git a/spec/integration/rails_6.0.2.1/config/cable.yml b/spec/integration/rails_6.1.7/config/cable.yml similarity index 100% rename from spec/integration/rails_6.0.2.1/config/cable.yml rename to spec/integration/rails_6.1.7/config/cable.yml diff --git a/spec/integration/rails_6.0.2.1/config/credentials.yml.enc b/spec/integration/rails_6.1.7/config/credentials.yml.enc similarity index 100% rename from spec/integration/rails_6.0.2.1/config/credentials.yml.enc rename to spec/integration/rails_6.1.7/config/credentials.yml.enc diff --git a/spec/integration/rails_6.0.2.1/config/database.yml b/spec/integration/rails_6.1.7/config/database.yml similarity index 100% rename from spec/integration/rails_6.0.2.1/config/database.yml rename to spec/integration/rails_6.1.7/config/database.yml diff --git a/spec/integration/rails_5.2.4.1/config/environment.rb b/spec/integration/rails_6.1.7/config/environment.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/environment.rb rename to spec/integration/rails_6.1.7/config/environment.rb diff --git a/spec/integration/rails_6.0.2.1/config/environments/development.rb b/spec/integration/rails_6.1.7/config/environments/development.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/environments/development.rb rename to spec/integration/rails_6.1.7/config/environments/development.rb diff --git a/spec/integration/rails_6.0.2.1/config/environments/production.rb b/spec/integration/rails_6.1.7/config/environments/production.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/environments/production.rb rename to spec/integration/rails_6.1.7/config/environments/production.rb diff --git a/spec/integration/rails_6.0.2.1/config/environments/test.rb b/spec/integration/rails_6.1.7/config/environments/test.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/environments/test.rb rename to spec/integration/rails_6.1.7/config/environments/test.rb diff --git a/spec/integration/rails_5.2.4.1/config/initializers/application_controller_renderer.rb b/spec/integration/rails_6.1.7/config/initializers/application_controller_renderer.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/initializers/application_controller_renderer.rb rename to spec/integration/rails_6.1.7/config/initializers/application_controller_renderer.rb diff --git a/spec/integration/rails_5.2.4.1/config/initializers/backtrace_silencers.rb b/spec/integration/rails_6.1.7/config/initializers/backtrace_silencers.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/initializers/backtrace_silencers.rb rename to spec/integration/rails_6.1.7/config/initializers/backtrace_silencers.rb diff --git a/spec/integration/rails_6.0.2.1/config/initializers/content_security_policy.rb b/spec/integration/rails_6.1.7/config/initializers/content_security_policy.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/initializers/content_security_policy.rb rename to spec/integration/rails_6.1.7/config/initializers/content_security_policy.rb diff --git a/spec/integration/rails_5.2.4.1/config/initializers/cookies_serializer.rb b/spec/integration/rails_6.1.7/config/initializers/cookies_serializer.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/initializers/cookies_serializer.rb rename to spec/integration/rails_6.1.7/config/initializers/cookies_serializer.rb diff --git a/spec/integration/rails_5.2.4.1/config/initializers/filter_parameter_logging.rb b/spec/integration/rails_6.1.7/config/initializers/filter_parameter_logging.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/initializers/filter_parameter_logging.rb rename to spec/integration/rails_6.1.7/config/initializers/filter_parameter_logging.rb diff --git a/spec/integration/rails_5.2.4.1/config/initializers/inflections.rb b/spec/integration/rails_6.1.7/config/initializers/inflections.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/initializers/inflections.rb rename to spec/integration/rails_6.1.7/config/initializers/inflections.rb diff --git a/spec/integration/rails_5.2.4.1/config/initializers/mime_types.rb b/spec/integration/rails_6.1.7/config/initializers/mime_types.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/initializers/mime_types.rb rename to spec/integration/rails_6.1.7/config/initializers/mime_types.rb diff --git a/spec/integration/rails_5.2.4.1/config/initializers/wrap_parameters.rb b/spec/integration/rails_6.1.7/config/initializers/wrap_parameters.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/config/initializers/wrap_parameters.rb rename to spec/integration/rails_6.1.7/config/initializers/wrap_parameters.rb diff --git a/spec/integration/rails_6.0.2.1/config/locales/en.yml b/spec/integration/rails_6.1.7/config/locales/en.yml similarity index 100% rename from spec/integration/rails_6.0.2.1/config/locales/en.yml rename to spec/integration/rails_6.1.7/config/locales/en.yml diff --git a/spec/integration/rails_6.0.2.1/config/multi-database.yml b/spec/integration/rails_6.1.7/config/multi-database.yml similarity index 100% rename from spec/integration/rails_6.0.2.1/config/multi-database.yml rename to spec/integration/rails_6.1.7/config/multi-database.yml diff --git a/spec/integration/rails_6.0.2.1/config/puma.rb b/spec/integration/rails_6.1.7/config/puma.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/puma.rb rename to spec/integration/rails_6.1.7/config/puma.rb diff --git a/spec/integration/rails_6.0.2.1/config/routes.rb b/spec/integration/rails_6.1.7/config/routes.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/routes.rb rename to spec/integration/rails_6.1.7/config/routes.rb diff --git a/spec/integration/rails_5.2.4.1/config/storage.yml b/spec/integration/rails_6.1.7/config/storage.yml similarity index 100% rename from spec/integration/rails_5.2.4.1/config/storage.yml rename to spec/integration/rails_6.1.7/config/storage.yml diff --git a/spec/integration/rails_6.0.2.1/db/migrate/20200201204456_create_tasks.rb b/spec/integration/rails_6.1.7/db/migrate/20200201204456_create_tasks.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/db/migrate/20200201204456_create_tasks.rb rename to spec/integration/rails_6.1.7/db/migrate/20200201204456_create_tasks.rb diff --git a/spec/integration/rails_6.0.2.1/db/schema.rb b/spec/integration/rails_6.1.7/db/schema.rb similarity index 89% rename from spec/integration/rails_6.0.2.1/db/schema.rb rename to spec/integration/rails_6.1.7/db/schema.rb index 69b014dfd..85a44d46e 100644 --- a/spec/integration/rails_6.0.2.1/db/schema.rb +++ b/spec/integration/rails_6.1.7/db/schema.rb @@ -2,8 +2,8 @@ # 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 +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/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. diff --git a/spec/integration/rails_5.2.4.1/db/seeds.rb b/spec/integration/rails_6.1.7/db/seeds.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/db/seeds.rb rename to spec/integration/rails_6.1.7/db/seeds.rb diff --git a/spec/integration/rails_5.2.4.1/lib/assets/.keep b/spec/integration/rails_6.1.7/lib/assets/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/lib/assets/.keep rename to spec/integration/rails_6.1.7/lib/assets/.keep diff --git a/spec/integration/rails_5.2.4.1/lib/tasks/.keep b/spec/integration/rails_6.1.7/lib/tasks/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/lib/tasks/.keep rename to spec/integration/rails_6.1.7/lib/tasks/.keep diff --git a/spec/integration/rails_5.2.4.1/log/.keep b/spec/integration/rails_6.1.7/log/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/log/.keep rename to spec/integration/rails_6.1.7/log/.keep diff --git a/spec/integration/rails_5.2.4.1/public/404.html b/spec/integration/rails_6.1.7/public/404.html similarity index 100% rename from spec/integration/rails_5.2.4.1/public/404.html rename to spec/integration/rails_6.1.7/public/404.html diff --git a/spec/integration/rails_5.2.4.1/public/422.html b/spec/integration/rails_6.1.7/public/422.html similarity index 100% rename from spec/integration/rails_5.2.4.1/public/422.html rename to spec/integration/rails_6.1.7/public/422.html diff --git a/spec/integration/rails_5.2.4.1/public/500.html b/spec/integration/rails_6.1.7/public/500.html similarity index 100% rename from spec/integration/rails_5.2.4.1/public/500.html rename to spec/integration/rails_6.1.7/public/500.html diff --git a/spec/integration/rails_5.2.4.1/public/apple-touch-icon-precomposed.png b/spec/integration/rails_6.1.7/public/apple-touch-icon-precomposed.png similarity index 100% rename from spec/integration/rails_5.2.4.1/public/apple-touch-icon-precomposed.png rename to spec/integration/rails_6.1.7/public/apple-touch-icon-precomposed.png diff --git a/spec/integration/rails_5.2.4.1/public/apple-touch-icon.png b/spec/integration/rails_6.1.7/public/apple-touch-icon.png similarity index 100% rename from spec/integration/rails_5.2.4.1/public/apple-touch-icon.png rename to spec/integration/rails_6.1.7/public/apple-touch-icon.png diff --git a/spec/integration/rails_5.2.4.1/public/favicon.ico b/spec/integration/rails_6.1.7/public/favicon.ico similarity index 100% rename from spec/integration/rails_5.2.4.1/public/favicon.ico rename to spec/integration/rails_6.1.7/public/favicon.ico diff --git a/spec/integration/rails_6.0.2.1/public/robots.txt b/spec/integration/rails_6.1.7/public/robots.txt similarity index 100% rename from spec/integration/rails_6.0.2.1/public/robots.txt rename to spec/integration/rails_6.1.7/public/robots.txt diff --git a/spec/integration/rails_5.2.4.1/storage/.keep b/spec/integration/rails_6.1.7/storage/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/storage/.keep rename to spec/integration/rails_6.1.7/storage/.keep diff --git a/spec/integration/rails_5.2.4.1/test/application_system_test_case.rb b/spec/integration/rails_6.1.7/test/application_system_test_case.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/test/application_system_test_case.rb rename to spec/integration/rails_6.1.7/test/application_system_test_case.rb diff --git a/spec/integration/rails_6.0.2.1/test/channels/application_cable/connection_test.rb b/spec/integration/rails_6.1.7/test/channels/application_cable/connection_test.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/test/channels/application_cable/connection_test.rb rename to spec/integration/rails_6.1.7/test/channels/application_cable/connection_test.rb diff --git a/spec/integration/rails_5.2.4.1/test/controllers/.keep b/spec/integration/rails_6.1.7/test/controllers/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/test/controllers/.keep rename to spec/integration/rails_6.1.7/test/controllers/.keep diff --git a/spec/integration/rails_5.2.4.1/test/fixtures/.keep b/spec/integration/rails_6.1.7/test/fixtures/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/test/fixtures/.keep rename to spec/integration/rails_6.1.7/test/fixtures/.keep diff --git a/spec/integration/rails_5.2.4.1/test/fixtures/files/.keep b/spec/integration/rails_6.1.7/test/fixtures/files/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/test/fixtures/files/.keep rename to spec/integration/rails_6.1.7/test/fixtures/files/.keep diff --git a/spec/integration/rails_6.0.2.1/test/fixtures/tasks.yml b/spec/integration/rails_6.1.7/test/fixtures/tasks.yml similarity index 100% rename from spec/integration/rails_6.0.2.1/test/fixtures/tasks.yml rename to spec/integration/rails_6.1.7/test/fixtures/tasks.yml diff --git a/spec/integration/rails_5.2.4.1/test/helpers/.keep b/spec/integration/rails_6.1.7/test/helpers/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/test/helpers/.keep rename to spec/integration/rails_6.1.7/test/helpers/.keep diff --git a/spec/integration/rails_5.2.4.1/test/integration/.keep b/spec/integration/rails_6.1.7/test/integration/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/test/integration/.keep rename to spec/integration/rails_6.1.7/test/integration/.keep diff --git a/spec/integration/rails_5.2.4.1/test/mailers/.keep b/spec/integration/rails_6.1.7/test/mailers/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/test/mailers/.keep rename to spec/integration/rails_6.1.7/test/mailers/.keep diff --git a/spec/integration/rails_5.2.4.1/test/models/.keep b/spec/integration/rails_6.1.7/test/models/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/test/models/.keep rename to spec/integration/rails_6.1.7/test/models/.keep diff --git a/spec/integration/rails_5.2.4.1/test/models/task_test.rb b/spec/integration/rails_6.1.7/test/models/task_test.rb similarity index 100% rename from spec/integration/rails_5.2.4.1/test/models/task_test.rb rename to spec/integration/rails_6.1.7/test/models/task_test.rb diff --git a/spec/integration/rails_5.2.4.1/test/system/.keep b/spec/integration/rails_6.1.7/test/system/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/test/system/.keep rename to spec/integration/rails_6.1.7/test/system/.keep diff --git a/spec/integration/rails_6.0.2.1/test/test_helper.rb b/spec/integration/rails_6.1.7/test/test_helper.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/test/test_helper.rb rename to spec/integration/rails_6.1.7/test/test_helper.rb diff --git a/spec/integration/rails_5.2.4.1/tmp/.keep b/spec/integration/rails_6.1.7/tmp/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/tmp/.keep rename to spec/integration/rails_6.1.7/tmp/.keep diff --git a/spec/integration/rails_5.2.4.1/vendor/.keep b/spec/integration/rails_6.1.7/vendor/.keep similarity index 100% rename from spec/integration/rails_5.2.4.1/vendor/.keep rename to spec/integration/rails_6.1.7/vendor/.keep diff --git a/spec/integration/rails_6.1.7_spec.rb b/spec/integration/rails_6.1.7_spec.rb new file mode 100644 index 000000000..eb6a90ade --- /dev/null +++ b/spec/integration/rails_6.1.7_spec.rb @@ -0,0 +1,207 @@ +require 'bundler' +require 'rspec' +require 'git' +require_relative 'integration_helper' + +describe 'Integration testing on Rails 6.1.7', if: IntegrationHelper.able_to_run?(__FILE__, RUBY_VERSION) do + ::RAILS_6_1_APP_NAME = 'rails_6.1.7'.freeze + ::RAILS_6_1_PROJECT_PATH = File.expand_path('../..', __dir__).freeze + ::RAILS_6_1_APP_PATH = File.expand_path(RAILS_6_1_APP_NAME, __dir__).freeze + + let!(:git) { Git.open(RAILS_6_1_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_1_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_1_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_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_mandrill_inbound_health_check GET /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#health_check ++# rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/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 ++# new_rails_conductor_inbound_email_source GET /rails/conductor/action_mailbox/inbound_emails/sources/new(.:format) rails/conductor/action_mailbox/inbound_emails/sources#new ++# rails_conductor_inbound_email_sources POST /rails/conductor/action_mailbox/inbound_emails/sources(.:format) rails/conductor/action_mailbox/inbound_emails/sources#create ++# 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/redirect/:signed_id/*filename(.:format) active_storage/blobs/redirect#show ++# rails_service_blob_proxy GET /rails/active_storage/blobs/proxy/:signed_id/*filename(.:format) active_storage/blobs/proxy#show ++# GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs/redirect#show ++# rails_blob_representation GET /rails/active_storage/representations/redirect/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/redirect#show ++# rails_blob_representation_proxy GET /rails/active_storage/representations/proxy/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/proxy#show ++# GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/redirect#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/integration/rails_5.2.4.1/.gitignore b/spec/integration/rails_7.0.4/.gitignore similarity index 84% rename from spec/integration/rails_5.2.4.1/.gitignore rename to spec/integration/rails_7.0.4/.gitignore index 81452db92..376e85884 100644 --- a/spec/integration/rails_5.2.4.1/.gitignore +++ b/spec/integration/rails_7.0.4/.gitignore @@ -10,6 +10,7 @@ # Ignore the default SQLite database. /db/*.sqlite3 /db/*.sqlite3-journal +/db/*.sqlite3-* # Ignore all logfiles and tempfiles. /log/* @@ -17,15 +18,19 @@ !/log/.keep !/tmp/.keep -# Ignore uploaded files in development +# 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 + +/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_7.0.4/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/.keep rename to spec/integration/rails_7.0.4/.keep diff --git a/spec/integration/rails_7.0.4/.rubocop.yml b/spec/integration/rails_7.0.4/.rubocop.yml new file mode 100644 index 000000000..cc32da4b9 --- /dev/null +++ b/spec/integration/rails_7.0.4/.rubocop.yml @@ -0,0 +1 @@ +inherit_from: .rubocop_todo.yml diff --git a/spec/integration/rails_7.0.4/.rubocop_todo.yml b/spec/integration/rails_7.0.4/.rubocop_todo.yml new file mode 100644 index 000000000..b7b989b77 --- /dev/null +++ b/spec/integration/rails_7.0.4/.rubocop_todo.yml @@ -0,0 +1,156 @@ +# 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_7.0.4/Gemfile similarity index 97% rename from spec/integration/rails_6.0.2.1/Gemfile rename to spec/integration/rails_7.0.4/Gemfile index 4d2b38e57..6bdd0f6cc 100644 --- a/spec/integration/rails_6.0.2.1/Gemfile +++ b/spec/integration/rails_7.0.4/Gemfile @@ -2,7 +2,7 @@ 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' +gem 'rails', '7.0.4' # Use sqlite3 as the database for Active Record gem 'sqlite3', '~> 1.4' # Use Puma as the app server diff --git a/spec/integration/rails_7.0.4/Gemfile.lock b/spec/integration/rails_7.0.4/Gemfile.lock new file mode 100644 index 000000000..8121eca8c --- /dev/null +++ b/spec/integration/rails_7.0.4/Gemfile.lock @@ -0,0 +1,220 @@ +PATH + remote: ../../.. + specs: + annotate (3.1.1) + activerecord (>= 6.1, < 7.1) + rake (>= 10.4, < 14.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.4) + actionpack (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activesupport (= 7.0.4) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.0) + actionpack (7.0.4) + actionview (= 7.0.4) + activesupport (= 7.0.4) + rack (~> 2.0, >= 2.2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.4) + actionpack (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.4) + activesupport (= 7.0.4) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.4) + activesupport (= 7.0.4) + globalid (>= 0.3.6) + activemodel (7.0.4) + activesupport (= 7.0.4) + activerecord (7.0.4) + activemodel (= 7.0.4) + activesupport (= 7.0.4) + activestorage (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activesupport (= 7.0.4) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + addressable (2.7.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.10) + crass (1.0.6) + digest (3.1.0) + erubi (1.11.0) + ffi (1.12.2) + globalid (1.0.0) + activesupport (>= 5.0) + i18n (1.12.0) + 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.19.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (1.0.2) + method_source (1.0.0) + mini_mime (1.1.2) + mini_portile2 (2.8.0) + minitest (5.16.3) + msgpack (1.3.1) + net-imap (0.2.3) + digest + net-protocol + strscan + net-pop (0.1.1) + digest + net-protocol + timeout + net-protocol (0.1.3) + timeout + net-smtp (0.3.1) + digest + net-protocol + timeout + nio4r (2.5.8) + nokogiri (1.13.8) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + public_suffix (4.0.3) + puma (4.3.8) + nio4r (~> 2.0) + racc (1.6.0) + rack (2.2.4) + rack-test (2.0.2) + rack (>= 1.3) + rails (7.0.4) + actioncable (= 7.0.4) + actionmailbox (= 7.0.4) + actionmailer (= 7.0.4) + actionpack (= 7.0.4) + actiontext (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activemodel (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) + bundler (>= 1.15.0) + railties (= 7.0.4) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.4.3) + loofah (~> 2.3) + railties (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rake (13.0.6) + rb-fsevent (0.10.3) + 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) + sqlite3 (1.4.2) + strscan (3.0.4) + thor (1.2.1) + timeout (0.3.0) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) + 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.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.6.0) + +PLATFORMS + ruby + +DEPENDENCIES + annotate! + bootsnap (>= 1.4.2) + byebug + capybara (>= 2.15) + jbuilder (~> 2.7) + listen (>= 3.0.5, < 3.2) + puma (~> 4.3.8) + rails (= 7.0.4) + selenium-webdriver + sqlite3 (~> 1.4) + tzinfo-data + web-console (>= 3.3.0) + webdrivers + +BUNDLED WITH + 2.2.33 diff --git a/spec/integration/rails_6.0.2.1/README.md b/spec/integration/rails_7.0.4/README.md similarity index 100% rename from spec/integration/rails_6.0.2.1/README.md rename to spec/integration/rails_7.0.4/README.md diff --git a/spec/integration/rails_6.0.2.1/Rakefile b/spec/integration/rails_7.0.4/Rakefile similarity index 100% rename from spec/integration/rails_6.0.2.1/Rakefile rename to spec/integration/rails_7.0.4/Rakefile diff --git a/spec/integration/rails_5.2.4.1/app/assets/config/manifest.js b/spec/integration/rails_7.0.4/app/assets/config/manifest.js similarity index 62% rename from spec/integration/rails_5.2.4.1/app/assets/config/manifest.js rename to spec/integration/rails_7.0.4/app/assets/config/manifest.js index b16e53d6d..591819335 100644 --- a/spec/integration/rails_5.2.4.1/app/assets/config/manifest.js +++ b/spec/integration/rails_7.0.4/app/assets/config/manifest.js @@ -1,3 +1,2 @@ //= link_tree ../images -//= link_directory ../javascripts .js //= link_directory ../stylesheets .css diff --git a/spec/integration/rails_6.0.2.1/app/assets/images/.keep b/spec/integration/rails_7.0.4/app/assets/images/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/app/assets/images/.keep rename to spec/integration/rails_7.0.4/app/assets/images/.keep diff --git a/spec/integration/rails_6.0.2.1/app/assets/stylesheets/application.css b/spec/integration/rails_7.0.4/app/assets/stylesheets/application.css similarity index 100% rename from spec/integration/rails_6.0.2.1/app/assets/stylesheets/application.css rename to spec/integration/rails_7.0.4/app/assets/stylesheets/application.css diff --git a/spec/integration/rails_6.0.2.1/app/channels/application_cable/channel.rb b/spec/integration/rails_7.0.4/app/channels/application_cable/channel.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/channels/application_cable/channel.rb rename to spec/integration/rails_7.0.4/app/channels/application_cable/channel.rb diff --git a/spec/integration/rails_6.0.2.1/app/channels/application_cable/connection.rb b/spec/integration/rails_7.0.4/app/channels/application_cable/connection.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/channels/application_cable/connection.rb rename to spec/integration/rails_7.0.4/app/channels/application_cable/connection.rb diff --git a/spec/integration/rails_6.0.2.1/app/controllers/application_controller.rb b/spec/integration/rails_7.0.4/app/controllers/application_controller.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/controllers/application_controller.rb rename to spec/integration/rails_7.0.4/app/controllers/application_controller.rb diff --git a/spec/integration/rails_6.0.2.1/app/controllers/concerns/.keep b/spec/integration/rails_7.0.4/app/controllers/concerns/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/app/controllers/concerns/.keep rename to spec/integration/rails_7.0.4/app/controllers/concerns/.keep diff --git a/spec/integration/rails_6.0.2.1/app/helpers/application_helper.rb b/spec/integration/rails_7.0.4/app/helpers/application_helper.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/helpers/application_helper.rb rename to spec/integration/rails_7.0.4/app/helpers/application_helper.rb diff --git a/spec/integration/rails_7.0.4/app/jobs/application_job.rb b/spec/integration/rails_7.0.4/app/jobs/application_job.rb new file mode 100644 index 000000000..d394c3d10 --- /dev/null +++ b/spec/integration/rails_7.0.4/app/jobs/application_job.rb @@ -0,0 +1,7 @@ +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_7.0.4/app/mailers/application_mailer.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/mailers/application_mailer.rb rename to spec/integration/rails_7.0.4/app/mailers/application_mailer.rb diff --git a/spec/integration/rails_6.0.2.1/app/models/application_record.rb b/spec/integration/rails_7.0.4/app/models/application_record.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/models/application_record.rb rename to spec/integration/rails_7.0.4/app/models/application_record.rb diff --git a/spec/integration/rails_6.0.2.1/app/models/concerns/.keep b/spec/integration/rails_7.0.4/app/models/concerns/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/app/models/concerns/.keep rename to spec/integration/rails_7.0.4/app/models/concerns/.keep diff --git a/spec/integration/rails_6.0.2.1/app/models/task.rb b/spec/integration/rails_7.0.4/app/models/task.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/models/task.rb rename to spec/integration/rails_7.0.4/app/models/task.rb diff --git a/spec/integration/rails_6.0.2.1/app/views/layouts/application.html.erb b/spec/integration/rails_7.0.4/app/views/layouts/application.html.erb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/views/layouts/application.html.erb rename to spec/integration/rails_7.0.4/app/views/layouts/application.html.erb diff --git a/spec/integration/rails_6.0.2.1/app/views/layouts/mailer.html.erb b/spec/integration/rails_7.0.4/app/views/layouts/mailer.html.erb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/views/layouts/mailer.html.erb rename to spec/integration/rails_7.0.4/app/views/layouts/mailer.html.erb diff --git a/spec/integration/rails_6.0.2.1/app/views/layouts/mailer.text.erb b/spec/integration/rails_7.0.4/app/views/layouts/mailer.text.erb similarity index 100% rename from spec/integration/rails_6.0.2.1/app/views/layouts/mailer.text.erb rename to spec/integration/rails_7.0.4/app/views/layouts/mailer.text.erb diff --git a/spec/integration/rails_7.0.4/bin/bundle b/spec/integration/rails_7.0.4/bin/bundle new file mode 100755 index 000000000..524dfd3f2 --- /dev/null +++ b/spec/integration/rails_7.0.4/bin/bundle @@ -0,0 +1,105 @@ +#!/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_7.0.4/bin/rails similarity index 100% rename from spec/integration/rails_6.0.2.1/bin/rails rename to spec/integration/rails_7.0.4/bin/rails diff --git a/spec/integration/rails_6.0.2.1/bin/rake b/spec/integration/rails_7.0.4/bin/rake similarity index 100% rename from spec/integration/rails_6.0.2.1/bin/rake rename to spec/integration/rails_7.0.4/bin/rake diff --git a/spec/integration/rails_5.2.4.1/bin/setup b/spec/integration/rails_7.0.4/bin/setup similarity index 68% rename from spec/integration/rails_5.2.4.1/bin/setup rename to spec/integration/rails_7.0.4/bin/setup index 94fd4d797..0e39e8cb1 100755 --- a/spec/integration/rails_5.2.4.1/bin/setup +++ b/spec/integration/rails_7.0.4/bin/setup @@ -1,6 +1,5 @@ #!/usr/bin/env ruby require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,24 +8,22 @@ 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. +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') - # 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' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system! 'bin/rails db:setup' + system! 'bin/rails db:prepare' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rails log:clear tmp:clear' diff --git a/spec/integration/rails_6.0.2.1/config.ru b/spec/integration/rails_7.0.4/config.ru similarity index 100% rename from spec/integration/rails_6.0.2.1/config.ru rename to spec/integration/rails_7.0.4/config.ru diff --git a/spec/integration/rails_6.0.2.1/config/application.rb b/spec/integration/rails_7.0.4/config/application.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/application.rb rename to spec/integration/rails_7.0.4/config/application.rb diff --git a/spec/integration/rails_6.0.2.1/config/boot.rb b/spec/integration/rails_7.0.4/config/boot.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/boot.rb rename to spec/integration/rails_7.0.4/config/boot.rb diff --git a/spec/integration/rails_5.2.4.1/config/cable.yml b/spec/integration/rails_7.0.4/config/cable.yml similarity index 69% rename from spec/integration/rails_5.2.4.1/config/cable.yml rename to spec/integration/rails_7.0.4/config/cable.yml index bbe9fb1e2..3b0858c95 100644 --- a/spec/integration/rails_5.2.4.1/config/cable.yml +++ b/spec/integration/rails_7.0.4/config/cable.yml @@ -2,9 +2,9 @@ development: adapter: async test: - adapter: async + adapter: test production: adapter: redis url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: rails_5_2_4_1_production + channel_prefix: rails_6_0_2_1_production diff --git a/spec/integration/rails_7.0.4/config/credentials.yml.enc b/spec/integration/rails_7.0.4/config/credentials.yml.enc new file mode 100644 index 000000000..51e9ebc8c --- /dev/null +++ b/spec/integration/rails_7.0.4/config/credentials.yml.enc @@ -0,0 +1 @@ +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_5.2.4.1/config/database.yml b/spec/integration/rails_7.0.4/config/database.yml similarity index 92% rename from spec/integration/rails_5.2.4.1/config/database.yml rename to spec/integration/rails_7.0.4/config/database.yml index 0d02f2498..4a8a1b26f 100644 --- a/spec/integration/rails_5.2.4.1/config/database.yml +++ b/spec/integration/rails_7.0.4/config/database.yml @@ -1,4 +1,4 @@ -# SQLite version 3.x +# SQLite. Versions 3.8.0 and up are supported. # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile diff --git a/spec/integration/rails_6.0.2.1/config/environment.rb b/spec/integration/rails_7.0.4/config/environment.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/environment.rb rename to spec/integration/rails_7.0.4/config/environment.rb diff --git a/spec/integration/rails_5.2.4.1/config/environments/development.rb b/spec/integration/rails_7.0.4/config/environments/development.rb similarity index 84% rename from spec/integration/rails_5.2.4.1/config/environments/development.rb rename to spec/integration/rails_7.0.4/config/environments/development.rb index 1311e3e4e..298f8d4b3 100644 --- a/spec/integration/rails_5.2.4.1/config/environments/development.rb +++ b/spec/integration/rails_7.0.4/config/environments/development.rb @@ -16,6 +16,7 @@ # 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 = { @@ -27,7 +28,7 @@ config.cache_store = :null_store end - # Store uploaded files on the local file system (see config/storage.yml for options) + # 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. @@ -44,15 +45,8 @@ # 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 + # 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, diff --git a/spec/integration/rails_5.2.4.1/config/environments/production.rb b/spec/integration/rails_7.0.4/config/environments/production.rb similarity index 71% rename from spec/integration/rails_5.2.4.1/config/environments/production.rb rename to spec/integration/rails_7.0.4/config/environments/production.rb index 431c8ee69..5ce0e884d 100644 --- a/spec/integration/rails_5.2.4.1/config/environments/production.rb +++ b/spec/integration/rails_7.0.4/config/environments/production.rb @@ -22,15 +22,6 @@ # 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' @@ -38,10 +29,10 @@ # 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) + # 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 + # 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.*/ ] @@ -59,9 +50,9 @@ # 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) + # 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.active_job.queue_name_prefix = "rails_6_0_2_1_production" config.action_mailer.perform_caching = false @@ -91,4 +82,25 @@ # 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_5.2.4.1/config/environments/test.rb b/spec/integration/rails_7.0.4/config/environments/test.rb similarity index 80% rename from spec/integration/rails_5.2.4.1/config/environments/test.rb rename to spec/integration/rails_7.0.4/config/environments/test.rb index 0a38fd3ce..470dee4be 100644 --- a/spec/integration/rails_5.2.4.1/config/environments/test.rb +++ b/spec/integration/rails_7.0.4/config/environments/test.rb @@ -1,10 +1,11 @@ +# 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. - # 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 @@ -21,6 +22,7 @@ # 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 @@ -28,7 +30,7 @@ # 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 + # Store uploaded files on the local file system in a temporary directory. config.active_storage.service = :test config.action_mailer.perform_caching = false @@ -41,6 +43,6 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Raises error for missing translations + # 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_7.0.4/config/initializers/application_controller_renderer.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/initializers/application_controller_renderer.rb rename to spec/integration/rails_7.0.4/config/initializers/application_controller_renderer.rb diff --git a/spec/integration/rails_6.0.2.1/config/initializers/backtrace_silencers.rb b/spec/integration/rails_7.0.4/config/initializers/backtrace_silencers.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/initializers/backtrace_silencers.rb rename to spec/integration/rails_7.0.4/config/initializers/backtrace_silencers.rb diff --git a/spec/integration/rails_5.2.4.1/config/initializers/content_security_policy.rb b/spec/integration/rails_7.0.4/config/initializers/content_security_policy.rb similarity index 89% rename from spec/integration/rails_5.2.4.1/config/initializers/content_security_policy.rb rename to spec/integration/rails_7.0.4/config/initializers/content_security_policy.rb index d3bcaa5ec..41c43016f 100644 --- a/spec/integration/rails_5.2.4.1/config/initializers/content_security_policy.rb +++ b/spec/integration/rails_7.0.4/config/initializers/content_security_policy.rb @@ -19,6 +19,9 @@ # 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 diff --git a/spec/integration/rails_6.0.2.1/config/initializers/cookies_serializer.rb b/spec/integration/rails_7.0.4/config/initializers/cookies_serializer.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/initializers/cookies_serializer.rb rename to spec/integration/rails_7.0.4/config/initializers/cookies_serializer.rb diff --git a/spec/integration/rails_6.0.2.1/config/initializers/filter_parameter_logging.rb b/spec/integration/rails_7.0.4/config/initializers/filter_parameter_logging.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/initializers/filter_parameter_logging.rb rename to spec/integration/rails_7.0.4/config/initializers/filter_parameter_logging.rb diff --git a/spec/integration/rails_6.0.2.1/config/initializers/inflections.rb b/spec/integration/rails_7.0.4/config/initializers/inflections.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/initializers/inflections.rb rename to spec/integration/rails_7.0.4/config/initializers/inflections.rb diff --git a/spec/integration/rails_6.0.2.1/config/initializers/mime_types.rb b/spec/integration/rails_7.0.4/config/initializers/mime_types.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/initializers/mime_types.rb rename to spec/integration/rails_7.0.4/config/initializers/mime_types.rb diff --git a/spec/integration/rails_6.0.2.1/config/initializers/wrap_parameters.rb b/spec/integration/rails_7.0.4/config/initializers/wrap_parameters.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/config/initializers/wrap_parameters.rb rename to spec/integration/rails_7.0.4/config/initializers/wrap_parameters.rb diff --git a/spec/integration/rails_5.2.4.1/config/locales/en.yml b/spec/integration/rails_7.0.4/config/locales/en.yml similarity index 93% rename from spec/integration/rails_5.2.4.1/config/locales/en.yml rename to spec/integration/rails_7.0.4/config/locales/en.yml index decc5a857..cf9b342d0 100644 --- a/spec/integration/rails_5.2.4.1/config/locales/en.yml +++ b/spec/integration/rails_7.0.4/config/locales/en.yml @@ -27,7 +27,7 @@ # 'true': 'foo' # # To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. +# available at https://guides.rubyonrails.org/i18n.html. en: hello: "Hello world" diff --git a/spec/integration/rails_7.0.4/config/multi-database.yml b/spec/integration/rails_7.0.4/config/multi-database.yml new file mode 100644 index 000000000..1dbe6d6a9 --- /dev/null +++ b/spec/integration/rails_7.0.4/config/multi-database.yml @@ -0,0 +1,37 @@ +# 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_5.2.4.1/config/puma.rb b/spec/integration/rails_7.0.4/config/puma.rb similarity index 83% rename from spec/integration/rails_5.2.4.1/config/puma.rb rename to spec/integration/rails_7.0.4/config/puma.rb index b2102072b..5ed443774 100644 --- a/spec/integration/rails_5.2.4.1/config/puma.rb +++ b/spec/integration/rails_7.0.4/config/puma.rb @@ -4,8 +4,9 @@ # 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 +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. # @@ -19,7 +20,7 @@ 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 +# 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). diff --git a/spec/integration/rails_7.0.4/config/routes.rb b/spec/integration/rails_7.0.4/config/routes.rb new file mode 100644 index 000000000..b735f52f4 --- /dev/null +++ b/spec/integration/rails_7.0.4/config/routes.rb @@ -0,0 +1,4 @@ +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_7.0.4/config/storage.yml similarity index 100% rename from spec/integration/rails_6.0.2.1/config/storage.yml rename to spec/integration/rails_7.0.4/config/storage.yml diff --git a/spec/integration/rails_5.2.4.1/db/migrate/20200204052946_create_tasks.rb b/spec/integration/rails_7.0.4/db/migrate/20200201204456_create_tasks.rb similarity index 78% rename from spec/integration/rails_5.2.4.1/db/migrate/20200204052946_create_tasks.rb rename to spec/integration/rails_7.0.4/db/migrate/20200201204456_create_tasks.rb index f4b276aa8..42e0141d1 100644 --- a/spec/integration/rails_5.2.4.1/db/migrate/20200204052946_create_tasks.rb +++ b/spec/integration/rails_7.0.4/db/migrate/20200201204456_create_tasks.rb @@ -1,4 +1,4 @@ -class CreateTasks < ActiveRecord::Migration[5.2] +class CreateTasks < ActiveRecord::Migration[6.0] def change create_table :tasks do |t| t.string :content diff --git a/spec/integration/rails_5.2.4.1/db/schema.rb b/spec/integration/rails_7.0.4/db/schema.rb similarity index 55% rename from spec/integration/rails_5.2.4.1/db/schema.rb rename to spec/integration/rails_7.0.4/db/schema.rb index 4d585f43c..7e91ae5ad 100644 --- a/spec/integration/rails_5.2.4.1/db/schema.rb +++ b/spec/integration/rails_7.0.4/db/schema.rb @@ -2,16 +2,15 @@ # 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). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/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_04_052946) do - +ActiveRecord::Schema[7.0].define(version: 2020_02_01_204456) do create_table "tasks", force: :cascade do |t| t.string "content" t.integer "count", default: 0 diff --git a/spec/integration/rails_6.0.2.1/db/seeds.rb b/spec/integration/rails_7.0.4/db/seeds.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/db/seeds.rb rename to spec/integration/rails_7.0.4/db/seeds.rb diff --git a/spec/integration/rails_6.0.2.1/lib/assets/.keep b/spec/integration/rails_7.0.4/lib/assets/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/lib/assets/.keep rename to spec/integration/rails_7.0.4/lib/assets/.keep diff --git a/spec/integration/rails_6.0.2.1/lib/tasks/.keep b/spec/integration/rails_7.0.4/lib/tasks/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/lib/tasks/.keep rename to spec/integration/rails_7.0.4/lib/tasks/.keep diff --git a/spec/integration/rails_6.0.2.1/log/.keep b/spec/integration/rails_7.0.4/log/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/log/.keep rename to spec/integration/rails_7.0.4/log/.keep diff --git a/spec/integration/rails_6.0.2.1/public/404.html b/spec/integration/rails_7.0.4/public/404.html similarity index 100% rename from spec/integration/rails_6.0.2.1/public/404.html rename to spec/integration/rails_7.0.4/public/404.html diff --git a/spec/integration/rails_6.0.2.1/public/422.html b/spec/integration/rails_7.0.4/public/422.html similarity index 100% rename from spec/integration/rails_6.0.2.1/public/422.html rename to spec/integration/rails_7.0.4/public/422.html diff --git a/spec/integration/rails_6.0.2.1/public/500.html b/spec/integration/rails_7.0.4/public/500.html similarity index 100% rename from spec/integration/rails_6.0.2.1/public/500.html rename to spec/integration/rails_7.0.4/public/500.html diff --git a/spec/integration/rails_6.0.2.1/public/apple-touch-icon-precomposed.png b/spec/integration/rails_7.0.4/public/apple-touch-icon-precomposed.png similarity index 100% rename from spec/integration/rails_6.0.2.1/public/apple-touch-icon-precomposed.png rename to spec/integration/rails_7.0.4/public/apple-touch-icon-precomposed.png diff --git a/spec/integration/rails_6.0.2.1/public/apple-touch-icon.png b/spec/integration/rails_7.0.4/public/apple-touch-icon.png similarity index 100% rename from spec/integration/rails_6.0.2.1/public/apple-touch-icon.png rename to spec/integration/rails_7.0.4/public/apple-touch-icon.png diff --git a/spec/integration/rails_6.0.2.1/public/favicon.ico b/spec/integration/rails_7.0.4/public/favicon.ico similarity index 100% rename from spec/integration/rails_6.0.2.1/public/favicon.ico rename to spec/integration/rails_7.0.4/public/favicon.ico diff --git a/spec/integration/rails_7.0.4/public/robots.txt b/spec/integration/rails_7.0.4/public/robots.txt new file mode 100644 index 000000000..c19f78ab6 --- /dev/null +++ b/spec/integration/rails_7.0.4/public/robots.txt @@ -0,0 +1 @@ +# 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_7.0.4/storage/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/storage/.keep rename to spec/integration/rails_7.0.4/storage/.keep diff --git a/spec/integration/rails_6.0.2.1/test/application_system_test_case.rb b/spec/integration/rails_7.0.4/test/application_system_test_case.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/test/application_system_test_case.rb rename to spec/integration/rails_7.0.4/test/application_system_test_case.rb diff --git a/spec/integration/rails_7.0.4/test/channels/application_cable/connection_test.rb b/spec/integration/rails_7.0.4/test/channels/application_cable/connection_test.rb new file mode 100644 index 000000000..800405f15 --- /dev/null +++ b/spec/integration/rails_7.0.4/test/channels/application_cable/connection_test.rb @@ -0,0 +1,11 @@ +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_7.0.4/test/controllers/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/test/controllers/.keep rename to spec/integration/rails_7.0.4/test/controllers/.keep diff --git a/spec/integration/rails_6.0.2.1/test/fixtures/.keep b/spec/integration/rails_7.0.4/test/fixtures/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/test/fixtures/.keep rename to spec/integration/rails_7.0.4/test/fixtures/.keep diff --git a/spec/integration/rails_6.0.2.1/test/fixtures/files/.keep b/spec/integration/rails_7.0.4/test/fixtures/files/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/test/fixtures/files/.keep rename to spec/integration/rails_7.0.4/test/fixtures/files/.keep diff --git a/spec/integration/rails_5.2.4.1/test/fixtures/tasks.yml b/spec/integration/rails_7.0.4/test/fixtures/tasks.yml similarity index 54% rename from spec/integration/rails_5.2.4.1/test/fixtures/tasks.yml rename to spec/integration/rails_7.0.4/test/fixtures/tasks.yml index 552ecdf1e..c9b9807d6 100644 --- a/spec/integration/rails_5.2.4.1/test/fixtures/tasks.yml +++ b/spec/integration/rails_7.0.4/test/fixtures/tasks.yml @@ -1,4 +1,4 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: content: MyString diff --git a/spec/integration/rails_6.0.2.1/test/helpers/.keep b/spec/integration/rails_7.0.4/test/helpers/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/test/helpers/.keep rename to spec/integration/rails_7.0.4/test/helpers/.keep diff --git a/spec/integration/rails_6.0.2.1/test/integration/.keep b/spec/integration/rails_7.0.4/test/integration/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/test/integration/.keep rename to spec/integration/rails_7.0.4/test/integration/.keep diff --git a/spec/integration/rails_6.0.2.1/test/mailers/.keep b/spec/integration/rails_7.0.4/test/mailers/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/test/mailers/.keep rename to spec/integration/rails_7.0.4/test/mailers/.keep diff --git a/spec/integration/rails_6.0.2.1/test/models/.keep b/spec/integration/rails_7.0.4/test/models/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/test/models/.keep rename to spec/integration/rails_7.0.4/test/models/.keep diff --git a/spec/integration/rails_6.0.2.1/test/models/task_test.rb b/spec/integration/rails_7.0.4/test/models/task_test.rb similarity index 100% rename from spec/integration/rails_6.0.2.1/test/models/task_test.rb rename to spec/integration/rails_7.0.4/test/models/task_test.rb diff --git a/spec/integration/rails_6.0.2.1/test/system/.keep b/spec/integration/rails_7.0.4/test/system/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/test/system/.keep rename to spec/integration/rails_7.0.4/test/system/.keep diff --git a/spec/integration/rails_5.2.4.1/test/test_helper.rb b/spec/integration/rails_7.0.4/test/test_helper.rb similarity index 75% rename from spec/integration/rails_5.2.4.1/test/test_helper.rb rename to spec/integration/rails_7.0.4/test/test_helper.rb index 3ab84e3d1..d5300f88c 100644 --- a/spec/integration/rails_5.2.4.1/test/test_helper.rb +++ b/spec/integration/rails_7.0.4/test/test_helper.rb @@ -3,6 +3,9 @@ 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 diff --git a/spec/integration/rails_6.0.2.1/tmp/.keep b/spec/integration/rails_7.0.4/tmp/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/tmp/.keep rename to spec/integration/rails_7.0.4/tmp/.keep diff --git a/spec/integration/rails_6.0.2.1/vendor/.keep b/spec/integration/rails_7.0.4/vendor/.keep similarity index 100% rename from spec/integration/rails_6.0.2.1/vendor/.keep rename to spec/integration/rails_7.0.4/vendor/.keep diff --git a/spec/integration/rails_7.0.4_spec.rb b/spec/integration/rails_7.0.4_spec.rb new file mode 100644 index 000000000..6a8b2f6a8 --- /dev/null +++ b/spec/integration/rails_7.0.4_spec.rb @@ -0,0 +1,208 @@ +require 'bundler' +require 'rspec' +require 'git' +require_relative 'integration_helper' + +describe 'Integration testing on Rails 7.0.4', if: IntegrationHelper.able_to_run?(__FILE__, RUBY_VERSION) do + ::RAILS_7_0_APP_NAME = 'rails_7.0.4'.freeze + ::RAILS_7_0_PROJECT_PATH = File.expand_path('../..', __dir__).freeze + ::RAILS_7_0_APP_PATH = File.expand_path(RAILS_7_0_APP_NAME, __dir__).freeze + + let!(:git) { Git.open(RAILS_7_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_7_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_7_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_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_mandrill_inbound_health_check GET /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#health_check ++# rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/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 ++# new_rails_conductor_inbound_email_source GET /rails/conductor/action_mailbox/inbound_emails/sources/new(.:format) rails/conductor/action_mailbox/inbound_emails/sources#new ++# rails_conductor_inbound_email_sources POST /rails/conductor/action_mailbox/inbound_emails/sources(.:format) rails/conductor/action_mailbox/inbound_emails/sources#create ++# rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create ++# rails_conductor_inbound_email_incinerate POST /rails/conductor/action_mailbox/:inbound_email_id/incinerate(.:format) rails/conductor/action_mailbox/incinerates#create ++# rails_service_blob GET /rails/active_storage/blobs/redirect/:signed_id/*filename(.:format) active_storage/blobs/redirect#show ++# rails_service_blob_proxy GET /rails/active_storage/blobs/proxy/:signed_id/*filename(.:format) active_storage/blobs/proxy#show ++# GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs/redirect#show ++# rails_blob_representation GET /rails/active_storage/representations/redirect/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/redirect#show ++# rails_blob_representation_proxy GET /rails/active_storage/representations/proxy/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/proxy#show ++# GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/redirect#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_routes_spec.rb b/spec/lib/annotate/annotate_routes_spec.rb index a0ed118cc..1b89469cb 100644 --- a/spec/lib/annotate/annotate_routes_spec.rb +++ b/spec/lib/annotate/annotate_routes_spec.rb @@ -49,13 +49,13 @@ 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 + expect(AnnotateRoutes::HeaderGenerator).to receive(:`).with('rails routes').and_return(rails_routes_result).once end - context 'When the result of `rake routes` is present' do - context 'When the result of `rake routes` does not contain Rake version' do + context 'When the result of `rails routes` is present' do + context 'When the result of `rails routes` does not contain rails version' do context 'When the file does not contain magic comment' do - let :rake_routes_result do + let :rails_routes_result do <<-EOS Prefix Verb URI Pattern Controller#Action myaction1 GET /url1(.:format) mycontroller1#action @@ -149,7 +149,7 @@ EOS end - let :rake_routes_result do + let :rails_routes_result do <<-EOS Prefix Verb URI Pattern Controller#Action myaction1 GET /url1(.:format) mycontroller1#action @@ -236,9 +236,9 @@ end end - context 'When the result of `rake routes` contains Rake version' do + context 'When the result of `rails routes` contains Rake version' do context 'with older Rake versions' do - let :rake_routes_result do + let :rails_routes_result do <<~EOS.chomp (in /bad/line) good line @@ -303,7 +303,7 @@ end context 'with newer Rake versions' do - let :rake_routes_result do + let :rails_routes_result do <<~EOS.chomp another good line good line @@ -394,8 +394,8 @@ end end - context 'When the result of `rake routes` is blank' do - let :rake_routes_result do + context 'When the result of `rails routes` is blank' do + let :rails_routes_result do '' end