Class: PolishGeeks::DevTools::Commands::ExamplesComparator
- Defined in:
- lib/polish_geeks/dev_tools/commands/examples_comparator.rb
Overview
Command wrapper for ExamplesComparator rake task It informs us if our .example files structure is the same as non-example once
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#execute ⇒ String
Executes this command.
-
#valid? ⇒ Boolean
True if all the example files have the same structure as non-example once, false otherwise.
Methods inherited from Base
#ensure_executable!, #error_message
Instance Method Details
#execute ⇒ String
Executes this command
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/polish_geeks/dev_tools/commands/examples_comparator.rb', line 11 def execute @output = "Comparing yaml structure of example files\n\n" Dir[config_path].each do |example_file| dedicated_file = example_file.gsub('.example', '') if File.exist?(dedicated_file) header = compare_header(example_file, dedicated_file) @output << compare_output(header, example_file, dedicated_file) else @output << missing_file(dedicated_file) end end end |
#valid? ⇒ Boolean
Returns true if all the example files have the same structure as non-example once, false otherwise.
27 28 29 |
# File 'lib/polish_geeks/dev_tools/commands/examples_comparator.rb', line 27 def valid? !output.include?('failed') end |