Class: Prettier::Rake::Task
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Prettier::Rake::Task
- Defined in:
- lib/prettier/rake/task.rb
Overview
A Rake task that runs prettier on a set of source files.
Example:
require 'prettier/rake/task'
Prettier::Rake::Task.new do |t|
t.source_files = '{app,config,lib}/**/*.rb'
end
This will create a task that can be run with:
rake prettier
Instance Attribute Summary collapse
-
#name ⇒ Object
Name of prettier task.
-
#source_files ⇒ Object
Glob pattern to match source files.
-
#write ⇒ Object
Whether or not to overwrite the source files with the prettier output.
Instance Method Summary collapse
-
#initialize(name = :prettier) {|_self| ... } ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(name = :prettier) {|_self| ... } ⇒ Task
Returns a new instance of Task.
35 36 37 38 39 40 41 42 |
# File 'lib/prettier/rake/task.rb', line 35 def initialize(name = :prettier) @name = name @write = true @source_files = 'lib/**/*.rb' yield self if block_given? define_task end |
Instance Attribute Details
#name ⇒ Object
Name of prettier task. Defaults to :prettier.
25 26 27 |
# File 'lib/prettier/rake/task.rb', line 25 def name @name end |
#source_files ⇒ Object
Glob pattern to match source files. Defaults to ‘lib/*/.rb’.
33 34 35 |
# File 'lib/prettier/rake/task.rb', line 33 def source_files @source_files end |
#write ⇒ Object
Whether or not to overwrite the source files with the prettier output. Defaults to true.
29 30 31 |
# File 'lib/prettier/rake/task.rb', line 29 def write @write end |