Sha256: 08f125cbff4999c401d5637318e354d8dcd6b72d5b6e82cb872cd696a8fa874f

Contents?: true

Size: 1.63 KB

Versions: 20

Compression:

Stored size: 1.63 KB

Contents

module Bones::Plugins::Notes
  include ::Bones::Helpers
  extend self

  def initialize_notes
    ::Bones.config {
      desc 'Configuration for extracting annotations from project files.'
      notes {
        exclude [], :desc => <<-__
          A list of regular expression patterns that will be used to exclude
          certain files from the annotation search. Each pattern is given as a
          string, and they are all combined using the regular expression or
          "|" operator.
        __

        extensions %w[.txt .rb .erb .rdoc .md] << '', :desc => <<-__
          Only files with these extensions will be searched for annotations.
        __

        tags %w[FIXME OPTIMIZE TODO], :desc => <<-__
          The list of annotation tags that will be extracted from the files
          being searched.
        __
      }
    }

    have?(:notes) { true }
  end

  def define_tasks
    config = ::Bones.config

    desc "Enumerate all annotations"
    task :notes do |t|
      id = if t.application.top_level_tasks.length > 1
        t.application.top_level_tasks.slice!(1..-1).join(' ')
      end
      Bones::AnnotationExtractor.enumerate(
          config, config.notes.tags.join('|'), id, :tag => true)
    end

    namespace :notes do
      config.notes.tags.each do |tag|
        desc "Enumerate all #{tag} annotations"
        task tag.downcase.to_sym do |t|
          id = if t.application.top_level_tasks.length > 1
            t.application.top_level_tasks.slice!(1..-1).join(' ')
          end
          Bones::AnnotationExtractor.enumerate(config, tag, id)
        end
      end
    end
  end

end  # module Bones::Plugins::Notes

# EOF

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
bones-3.9.0 lib/bones/plugins/notes.rb
bones-3.8.5 lib/bones/plugins/notes.rb
bones-3.8.4 lib/bones/plugins/notes.rb
bones-3.8.3 lib/bones/plugins/notes.rb
bones-3.8.2 lib/bones/plugins/notes.rb
bones-3.8.1 lib/bones/plugins/notes.rb
bones-3.8.0 lib/bones/plugins/notes.rb
bones-3.7.3 lib/bones/plugins/notes.rb
bones-3.7.2 lib/bones/plugins/notes.rb
bones-3.7.1 lib/bones/plugins/notes.rb
bones-3.7.0 lib/bones/plugins/notes.rb
bones-3.6.5 lib/bones/plugins/notes.rb
bones-3.6.4 lib/bones/plugins/notes.rb
bones-3.6.2 lib/bones/plugins/notes.rb
bones-3.6.1 lib/bones/plugins/notes.rb
bones-3.6.0 lib/bones/plugins/notes.rb
bones-3.5.5 lib/bones/plugins/notes.rb
bones-3.5.4 lib/bones/plugins/notes.rb
bones-3.5.3 lib/bones/plugins/notes.rb
bones-3.5.2 lib/bones/plugins/notes.rb