Class: Quality::Config
- Inherits:
-
Object
- Object
- Quality::Config
- Defined in:
- lib/quality/rake/config.rb
Overview
Configuration for running quality tool
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
Relative path to output directory where *_high_water_mark files will be read/written.
-
#quality_name ⇒ Object
Name of quality task.
-
#ratchet_name ⇒ Object
Name of ratchet task.
- #ruby_dirs ⇒ Object
-
#skip_tools ⇒ Object
Array of strings describing tools to be skipped–e.g., [“cane”].
- #source_dirs ⇒ Object
-
#verbose ⇒ Object
Log command executation.
Instance Method Summary collapse
-
#initialize(quality_name: 'quality', ratchet_name: 'ratchet', globber: fail) ⇒ Config
constructor
A new instance of Config.
- #ruby_files ⇒ Object
- #ruby_files_glob ⇒ Object
- #source_files_glob(dirs = source_dirs, extensions = 'rb,swift,cpp,c,java,py,clj,cljs') ⇒ Object
Constructor Details
#initialize(quality_name: 'quality', ratchet_name: 'ratchet', globber: fail) ⇒ Config
Returns a new instance of Config.
63 64 65 66 67 68 69 70 71 |
# File 'lib/quality/rake/config.rb', line 63 def initialize(quality_name: 'quality', ratchet_name: 'ratchet', globber: fail) @quality_name, @ratchet_name = quality_name, ratchet_name @skip_tools = [] @output_dir = 'metrics' @verbose = false @globber = globber end |
Instance Attribute Details
#output_dir ⇒ Object
Relative path to output directory where *_high_water_mark files will be read/written
Defaults to .
39 40 41 |
# File 'lib/quality/rake/config.rb', line 39 def output_dir @output_dir end |
#quality_name ⇒ Object
Name of quality task. Defaults to :quality.
7 8 9 |
# File 'lib/quality/rake/config.rb', line 7 def quality_name @quality_name end |
#ratchet_name ⇒ Object
Name of ratchet task. Defaults to :ratchet.
11 12 13 |
# File 'lib/quality/rake/config.rb', line 11 def ratchet_name @ratchet_name end |
#ruby_dirs ⇒ Object
41 42 43 |
# File 'lib/quality/rake/config.rb', line 41 def ruby_dirs @ruby_dirs ||= %w(src app lib test spec feature) end |
#skip_tools ⇒ Object
Array of strings describing tools to be skipped–e.g., [“cane”]
Defaults to []
16 17 18 |
# File 'lib/quality/rake/config.rb', line 16 def skip_tools @skip_tools end |
#source_dirs ⇒ Object
45 46 47 |
# File 'lib/quality/rake/config.rb', line 45 def source_dirs @source_dirs ||= ruby_dirs.clone end |
#verbose ⇒ Object
Log command executation
Defaults to false
21 22 23 |
# File 'lib/quality/rake/config.rb', line 21 def verbose @verbose end |
Instance Method Details
#ruby_files ⇒ Object
58 59 60 61 |
# File 'lib/quality/rake/config.rb', line 58 def ruby_files @globber.glob('{*.rb,Rakefile}') .concat(@globber.glob(ruby_files_glob)).join(' ') end |
#ruby_files_glob ⇒ Object
54 55 56 |
# File 'lib/quality/rake/config.rb', line 54 def ruby_files_glob source_files_glob(ruby_dirs, 'rb') end |
#source_files_glob(dirs = source_dirs, extensions = 'rb,swift,cpp,c,java,py,clj,cljs') ⇒ Object
49 50 51 52 |
# File 'lib/quality/rake/config.rb', line 49 def source_files_glob(dirs = source_dirs, extensions = 'rb,swift,cpp,c,java,py,clj,cljs') File.join("{#{dirs.join(',')}}", '**', "*.{#{extensions}}") end |