Sha256: fc59afd5a824d9a0162b169ba6f1f4c2559c48c087fe0ce0d4907358bfee6e56

Contents?: true

Size: 1.27 KB

Versions: 31

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

require "rails/source_annotation_extractor"

module Rails
  module Command
    class NotesCommand < Base # :nodoc:
      class_option :annotations, aliases: "-a", desc: "Filter by specific annotations, e.g. Foobar TODO", type: :array, default: Rails::SourceAnnotationExtractor::Annotation.tags

      def perform(*)
        require_application_and_environment!

        deprecation_warning
        display_annotations
      end

      private
        def display_annotations
          annotations = options[:annotations]
          tag = (annotations.length > 1)

          Rails::SourceAnnotationExtractor.enumerate annotations.join("|"), tag: tag, dirs: directories
        end

        def directories
          Rails::SourceAnnotationExtractor::Annotation.directories + source_annotation_directories
        end

        def deprecation_warning
          return if source_annotation_directories.empty?
          ActiveSupport::Deprecation.warn("`SOURCE_ANNOTATION_DIRECTORIES` is deprecated and will be removed in Rails 6.1. You can add default directories by using config.annotations.register_directories instead.")
        end

        def source_annotation_directories
          ENV["SOURCE_ANNOTATION_DIRECTORIES"].to_s.split(",")
        end
    end
  end
end

Version data entries

31 entries across 29 versions & 5 rubygems

Version Path
railties-6.0.3.7 lib/rails/commands/notes/notes_command.rb
railties-6.0.3.6 lib/rails/commands/notes/notes_command.rb
railties-6.0.3.5 lib/rails/commands/notes/notes_command.rb
railties-6.0.3.4 lib/rails/commands/notes/notes_command.rb
railties-6.0.3.3 lib/rails/commands/notes/notes_command.rb
railties-6.0.3.2 lib/rails/commands/notes/notes_command.rb
railties-6.0.3.1 lib/rails/commands/notes/notes_command.rb
railties-6.0.3 lib/rails/commands/notes/notes_command.rb
railties-6.0.3.rc1 lib/rails/commands/notes/notes_command.rb
railties-6.0.2.2 lib/rails/commands/notes/notes_command.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/railties-6.0.2.1/lib/rails/commands/notes/notes_command.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/railties-6.0.2.1/lib/rails/commands/notes/notes_command.rb
railties-6.0.2.1 lib/rails/commands/notes/notes_command.rb
railties-6.0.2 lib/rails/commands/notes/notes_command.rb
railties-6.0.2.rc2 lib/rails/commands/notes/notes_command.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/railties-6.0.0/lib/rails/commands/notes/notes_command.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/railties-6.0.1/lib/rails/commands/notes/notes_command.rb
railties-6.0.2.rc1 lib/rails/commands/notes/notes_command.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/railties-6.0.0/lib/rails/commands/notes/notes_command.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/railties-6.0.1/lib/rails/commands/notes/notes_command.rb