From 6355ec8af7c0acf5e472a720d5c71421dea3dae2 Mon Sep 17 00:00:00 2001 From: "Andrew W. Lee" Date: Wed, 8 May 2024 15:39:55 -0700 Subject: [PATCH 1/4] Change Gemfile to use annotaterb --- Gemfile | 2 +- Gemfile.lock | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index eb507e9d185..b5530e7b3d7 100644 --- a/Gemfile +++ b/Gemfile @@ -152,7 +152,7 @@ group :development do gem 'rubocop-rspec', require: false # Annotates modules with schema - gem 'annotate', '~> 3.2' + gem 'annotaterb', '~> 4.7' # Enhanced error message pages for development gem 'better_errors', '~> 2.9' diff --git a/Gemfile.lock b/Gemfile.lock index 435144700f2..3d5814231d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -93,9 +93,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) aes_key_wrap (1.1.0) android_key_attestation (0.3.0) - annotate (3.2.0) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) + annotaterb (4.7.1) ast (2.4.2) attr_required (1.0.2) awrence (1.2.1) @@ -817,7 +815,7 @@ PLATFORMS DEPENDENCIES active_model_serializers (~> 0.10) addressable (~> 2.8) - annotate (~> 3.2) + annotaterb (~> 4.7) aws-sdk-s3 (~> 1.123) better_errors (~> 2.9) binding_of_caller (~> 1.0) From c671ceb72a87b2f4ed1e232ed7bc85a50aec2985 Mon Sep 17 00:00:00 2001 From: "Andrew W. Lee" Date: Wed, 8 May 2024 15:41:21 -0700 Subject: [PATCH 2/4] Run `bin/rails g annotate_rb:install` --- .annotaterb.yml | 57 ++++++++++++++++++++++++++++++++++++++ lib/tasks/annotate_rb.rake | 8 ++++++ 2 files changed, 65 insertions(+) create mode 100644 .annotaterb.yml create mode 100644 lib/tasks/annotate_rb.rake diff --git a/.annotaterb.yml b/.annotaterb.yml new file mode 100644 index 00000000000..d530bbe378a --- /dev/null +++ b/.annotaterb.yml @@ -0,0 +1,57 @@ +--- +:position: before +:position_in_additional_file_patterns: before +:position_in_class: before +:position_in_factory: before +:position_in_fixture: before +:position_in_routes: before +:position_in_serializer: before +:position_in_test: before +:classified_sort: true +:exclude_controllers: true +:exclude_factories: false +:exclude_fixtures: false +:exclude_helpers: true +:exclude_scaffolds: true +:exclude_serializers: false +:exclude_sti_subclasses: false +:exclude_tests: false +:force: false +:format_markdown: false +:format_rdoc: false +:format_yard: false +:frozen: false +:ignore_model_sub_dir: false +:ignore_unknown_models: false +:include_version: false +:show_complete_foreign_keys: false +:show_foreign_keys: true +:show_indexes: true +:simple_indexes: false +:sort: false +:timestamp: false +:trace: false +:with_comment: true +:with_column_comments: true +:with_table_comments: true +:active_admin: false +:command: +:debug: false +:hide_default_column_types: '' +:hide_limit_column_types: '' +:ignore_columns: +:ignore_routes: +:models: true +:routes: false +:skip_on_db_migrate: false +:target_action: :do_annotations +:wrapper: +:wrapper_close: +:wrapper_open: +:classes_default_to_s: [] +:additional_file_patterns: [] +:model_dir: +- app/models +:require: [] +:root_dir: +- '' diff --git a/lib/tasks/annotate_rb.rake b/lib/tasks/annotate_rb.rake new file mode 100644 index 00000000000..1ad0ec39e79 --- /dev/null +++ b/lib/tasks/annotate_rb.rake @@ -0,0 +1,8 @@ +# This rake task was added by annotate_rb gem. + +# Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this +if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil? + require "annotate_rb" + + AnnotateRb::Core.load_rake_tasks +end From df86ac2af2c8287178faac6b2c91f010402112aa Mon Sep 17 00:00:00 2001 From: "Andrew W. Lee" Date: Wed, 8 May 2024 15:43:55 -0700 Subject: [PATCH 3/4] Attempt to match configuration in `auto_annotate_models.rake` --- .annotaterb.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.annotaterb.yml b/.annotaterb.yml index d530bbe378a..5097ced990c 100644 --- a/.annotaterb.yml +++ b/.annotaterb.yml @@ -9,13 +9,13 @@ :position_in_test: before :classified_sort: true :exclude_controllers: true -:exclude_factories: false -:exclude_fixtures: false +:exclude_factories: true +:exclude_fixtures: true :exclude_helpers: true :exclude_scaffolds: true -:exclude_serializers: false -:exclude_sti_subclasses: false -:exclude_tests: false +:exclude_serializers: true +:exclude_sti_subclasses: true +:exclude_tests: true :force: false :format_markdown: false :format_rdoc: false @@ -25,8 +25,8 @@ :ignore_unknown_models: false :include_version: false :show_complete_foreign_keys: false -:show_foreign_keys: true -:show_indexes: true +:show_foreign_keys: false +:show_indexes: false :simple_indexes: false :sort: false :timestamp: false @@ -38,7 +38,7 @@ :command: :debug: false :hide_default_column_types: '' -:hide_limit_column_types: '' +:hide_limit_column_types: 'integer,boolean' :ignore_columns: :ignore_routes: :models: true From 906bbca0d7ad448f561a0f4b608df3d8e783d2f8 Mon Sep 17 00:00:00 2001 From: "Andrew W. Lee" Date: Wed, 8 May 2024 15:49:26 -0700 Subject: [PATCH 4/4] Remove old annotate file --- lib/tasks/auto_annotate_models.rake | 46 ----------------------------- 1 file changed, 46 deletions(-) delete mode 100644 lib/tasks/auto_annotate_models.rake diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake deleted file mode 100644 index 4b5997920a3..00000000000 --- a/lib/tasks/auto_annotate_models.rake +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -if Rails.env.development? - task :set_annotation_options do - Annotate.set_defaults( - 'routes' => 'false', - 'models' => 'true', - 'position_in_routes' => 'before', - 'position_in_class' => 'before', - 'position_in_test' => 'before', - 'position_in_fixture' => 'before', - 'position_in_factory' => 'before', - 'position_in_serializer' => 'before', - 'show_foreign_keys' => 'false', - 'show_indexes' => 'false', - 'simple_indexes' => 'false', - 'model_dir' => 'app/models', - 'root_dir' => '', - 'include_version' => 'false', - 'require' => '', - 'exclude_tests' => 'true', - 'exclude_fixtures' => 'true', - 'exclude_factories' => 'true', - 'exclude_serializers' => 'true', - 'exclude_scaffolds' => 'true', - 'exclude_controllers' => 'true', - 'exclude_helpers' => 'true', - 'ignore_model_sub_dir' => 'false', - 'ignore_columns' => nil, - 'ignore_routes' => nil, - 'ignore_unknown_models' => 'false', - 'hide_limit_column_types' => 'integer,boolean', - 'skip_on_db_migrate' => 'false', - 'format_bare' => 'true', - 'format_rdoc' => 'false', - 'format_markdown' => 'false', - 'sort' => 'false', - 'force' => 'false', - 'trace' => 'false', - 'wrapper_open' => nil, - 'wrapper_close' => nil - ) - end - - Annotate.load_tasks -end