1. 26 Apr, 2021 4 commits
  2. 24 Mar, 2021 3 commits
  3. 03 Jan, 2021 3 commits
  4. 01 Jul, 2020 1 commit
  5. 18 May, 2020 2 commits
  6. 17 May, 2020 1 commit
  7. 09 May, 2020 1 commit
  8. 08 May, 2020 1 commit
    • Adding option to skip loading models from subdirectories (#767) · 508d06a8
      ethanbresler authored
      Currently, the models annotator automatically attempts to find a class with a matching name at the bottom of project's directory tree before going up into specific engine's models.  This causes issues with models that share names with classes in other engines or lower classes in the project's directory.   This PR adds the option to skip attempts to load classes from lower directories and just uses the model's file path directly. 
      
      #674 
  9. 07 May, 2020 1 commit
  10. 06 Apr, 2020 2 commits
  11. 05 Apr, 2020 5 commits
    • Add methods to AnnotateRoutes::HeaderGenerator and refactor methods (#792) · ce7f22df
      Shu Fujita authored
      cf. #790 
      
      In order to refactor `AnnoateRoutes`, I added methods to `AnnotateRoutes::HeaderGenerator` and refactor methods.
      
      I will add `AnnotateRoutes::AnnotationProcessor` and `AnnotateRoutes::RemovalProcessor` in next PR.
    • Fix output for multiline column comments (#779) · 214da4f6
      Troy Rosenberg authored
      Closes #778 
      
      If a column comment includes the newline character, the newline character
      would be "printed" into the annotation block resulting in a line break
      and an uncommented line.
      
      For example, for the following table:
      
      ```
      create_table "users", force: :cascade do |t|
        t.string "name", comment: "This is a comment.\nWith two lines!"
        t.datetime "created_at", precision: 6, null: false
        t.datetime "updated_at", precision: 6, null: false
      end
      ```
      
      annotating the model with the `--with-comment` flag will result in:
      
      ```
      \# == Schema Information
      \#
      \# Table name: users
      \#
      \#  id                                       :bigint           not null, primary key
      \#  name(This is a comment.
      With two lines!) :string
      \#  created_at                               :datetime         not null
      \#  updated_at                               :datetime         not null
      \#
      ```
      
      This uncommented line would result in invalid Ruby and cause the file to
      no longer be valid.
      
      This fix replaces the newline character with an escaped version, so the
      output will look more like:
      
      ```
      \# == Schema Information
      \#
      \# Table name: users
      \#
      \#  id                                       :bigint           not null, primary key
      \#  name(This is a comment.\nWith two lines!):string
      \#  created_at                               :datetime         not null
      \#  updated_at                               :datetime         not null
      \#
      ```
    • Reactors AnnotateModels.get_schema_info (#791) · da1e6052
      Troy Rosenberg authored
      This is a bit of a cheat of a refactoring that simply extracts the logic for collecting a column's attributes out of `get_schema_info` and into its own method (`get_attributes`).
      
      I found that in PRs like #779 that the Rubocop ABC limit was being exceeded:
      
      ```
      lib/annotate/annotate_models.rb:235:5: C: Metrics/AbcSize: Assignment Branch Condition size for get_schema_info is too high. [145/145]
          def get_schema_info(klass, header, options = {}) ...
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      ```
      
      Hopefully, this should break this up and reduce the complexity of the method.
      
      There are opportunities to go further, but I thought this could be a good place to start. 
      
      I would be open and interested in discussing further refactoring opportunities if it would make sense (maybe creating some new classes to encapsulate some of this logic). 
    • Refactor AnnotateRoutes by adding AnnotateRoutes::HeaderGenerator (#790) · d89ddefa
      Shu Fujita authored
      I noticed that `AnnotateRoutes` can be more maintainable by refactoring.
      
      I am planning to refactor `AnnotateRoutes` in this order.
      *   separate logic of `AnnotateRoutes` into `AnnotateRoutes::HeaderGenerator`.
      *   add methods to `AnnotateRoutes::HeaderGenerator` and refactor methods.
      *   add `AnnotateRoutes::AnnotationProcessor` and `AnnotateRoutes::RemovalProcessor`
      
      The final goal of this refactoring is as follows.
      * https://github.com/nard-tech/annotate_models/blob/feature/refactor_annotate_routes/processors/lib/annotate/annotate_routes.rb
      * https://github.com/nard-tech/annotate_models/tree/feature/refactor_annotate_routes/processors/lib/annotate/annotate_routes
      
      So in the first I added `AnnotateRoutes::HeaderGenerator` in order to separate logic of `AnnotateRoutes` in this PR.
      
      When refactor of `AnnotateRoutes` is finished, I would like to refactor `AnnotateModels` in a like way.
    • Fix "undefined method `<'" error message (#774) · d9392d9e
      Erik Kessler authored
      ## Problem
      
      I have some files in the "models" directory that are not true a `Class`. For example, a [`dry-types`](https://dry-rb.org/gems/dry-types/1.2/sum/) sum type:
      
      ```ruby
      # app/models/foo.rb
      Foo = Types::String | Types::Integer
      ```
      
      This results in the following line when I annotate.
      
      ```
      Unable to annotate app/models/foo.rb: undefined method `<' for #<Dry::Struct::Sum:0x00007ff2dd262988>
      ```
      
      Not a blocking issue but somewhat annoying nonetheless.
      
      ## Solution
      
      When annotating a file, check that the file's object is a `Class` to ensure it has the interface we expect.
  12. 01 Apr, 2020 1 commit
    • Add integration test env var to CI (#788) · 8ecd0116
      Andrew W. Lee authored
      Integration tests were made conditional in #786 and so they stopped running in CI. This PR adds the `INTEGRATION_TESTS` environment variable to CI so that integration tests start running again.
  13. 31 Mar, 2020 1 commit
  14. 30 Mar, 2020 1 commit
    • Some project clean up (#786) · 1c1c5850
      Andrew W. Lee authored
      This PR does the following:
      * moves code coverage generation to happen when `COVERAGE` environment variable is present.
      * makes integration tests run when when `INTEGRATION_TESTS` is present.
      * moves `ruby-head` from TravisCI build. Previously the configuration allowed for `ruby-head` to be ignored if it failed, but it conflicted with the gem release build job step.
  15. 24 Mar, 2020 1 commit
  16. 09 Mar, 2020 4 commits
  17. 08 Mar, 2020 3 commits
  18. 01 Mar, 2020 4 commits
  19. 25 Feb, 2020 1 commit