Class: Batteries::Tasks::Notes
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Batteries::Tasks::Notes
- Defined in:
- lib/batteries/tasks/notes.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#excluded_dirs ⇒ Object
Returns the value of attribute excluded_dirs.
-
#matchers ⇒ Object
Returns the value of attribute matchers.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name = :notes, options: {}) {|_self| ... } ⇒ Notes
constructor
A new instance of Notes.
Constructor Details
#initialize(name = :notes, options: {}) {|_self| ... } ⇒ Notes
Returns a new instance of Notes.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/batteries/tasks/notes.rb', line 10 def initialize(name = :notes, options: {}) @name = [:name] || name @description = .fetch(:description) { "Notes" } @excluded_dirs = .fetch(:excluded_dirs) { %w(node_modules public) } @matchers = .fetch(:matchers) { %w(FIXME TODO) } yield self if block_given? define end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/batteries/tasks/notes.rb', line 8 def description @description end |
#excluded_dirs ⇒ Object
Returns the value of attribute excluded_dirs.
8 9 10 |
# File 'lib/batteries/tasks/notes.rb', line 8 def excluded_dirs @excluded_dirs end |
#matchers ⇒ Object
Returns the value of attribute matchers.
8 9 10 |
# File 'lib/batteries/tasks/notes.rb', line 8 def matchers @matchers end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/batteries/tasks/notes.rb', line 8 def name @name end |
Instance Method Details
#define ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/batteries/tasks/notes.rb', line 21 def define desc @description task name do excludes = @excluded_dirs .map { |dir| "--exclude-dir '#{dir}'" }.join(" ") matchers = @matchers.map { |matcher| "-e '#{matcher}'" }.join(" ") sh "grep #{excludes} -n -R --color #{matchers} *" end self end |