Class: Fixturizer::ConfigurationLinter
- Inherits:
-
Object
- Object
- Fixturizer::ConfigurationLinter
- Defined in:
- lib/fixturizer/configuration.rb
Constant Summary collapse
- KEYS_BY_LEVEL =
{:fixtures => [:rules,:models,:datasets], :dataset => [:definition, :rules], :models => [:type, :order, :definitions], :model_definition => [:rules,:class,:unicity, :collection], :collection => [:attributes,:belong] }
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
- #display ⇒ Object
-
#initialize(filename:) ⇒ ConfigurationLinter
constructor
A new instance of ConfigurationLinter.
- #validate! ⇒ Object
Constructor Details
#initialize(filename:) ⇒ ConfigurationLinter
Returns a new instance of ConfigurationLinter.
38 39 40 41 |
# File 'lib/fixturizer/configuration.rb', line 38 def initialize(filename:) @status = {status: :ok, warn: [], error: [], cleaned: []} @filename = filename end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
27 28 29 |
# File 'lib/fixturizer/configuration.rb', line 27 def content @content end |
Instance Method Details
#display ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/fixturizer/configuration.rb', line 44 def display puts "Running linter for Configuration file : #{@filename} :" validate puts " => Status : #{@status[:status].to_s.upcase} " unless @status[:error].empty? then puts "Errors : " @status[:error].each do |error| puts " * #{error}" end end unless @status[:warn].empty? then puts "Warnings : " @status[:warn].each do |warning| puts " * #{warning}" end end end |
#validate! ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/fixturizer/configuration.rb', line 63 def validate! validate unless @status[:status] == :ok puts "Configuration error, run rake fixturizer:configuration:lint to show" exit 10 end end |