Class: OctocatalogDiff::Cli::Diffs
- Inherits:
-
Object
- Object
- OctocatalogDiff::Cli::Diffs
- Defined in:
- lib/octocatalog-diff/cli/diffs.rb
Overview
Wrapper around OctocatalogDiff::CatalogDiff::Differ to provide the logger object, set up ignores, and add additional ignores for items dependent upon the compilation directory.
Instance Method Summary collapse
-
#diffs(catalogs) ⇒ Array<diffs>
The method to call externally, passing in the catalogs as a hash (see parameter).
-
#initialize(options, logger) ⇒ Diffs
constructor
Constructor.
Constructor Details
#initialize(options, logger) ⇒ Diffs
Constructor
13 14 15 16 |
# File 'lib/octocatalog-diff/cli/diffs.rb', line 13 def initialize(, logger) @options = @logger = logger end |
Instance Method Details
#diffs(catalogs) ⇒ Array<diffs>
The method to call externally, passing in the catalogs as a hash (see parameter). This sets up options and ignores and then actually performs the diffs. The result is the array of diffs.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/octocatalog-diff/cli/diffs.rb', line 23 def diffs(catalogs) @logger.debug 'Begin compute diffs between catalogs' diff_opts = @options.merge(logger: @logger) # Construct the actual differ object that the present one wraps differ = OctocatalogDiff::CatalogDiff::Differ.new(diff_opts, catalogs[:from], catalogs[:to]) differ.ignore(attr: 'tags') unless @options.fetch(:include_tags, false) differ.ignore(@options.fetch(:ignore, [])) differ. # Actually perform the diff diff_result = differ.diff @logger.debug 'Success compute diffs between catalogs' diff_result end |