File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
lib/octocatalog-diff/catalog-diff Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 2
2
require_relative 'filter/absent_file'
3
3
require_relative 'filter/compilation_dir'
4
4
require_relative 'filter/json'
5
+ require_relative 'filter/single_item_array'
5
6
require_relative 'filter/yaml'
6
7
7
8
require 'stringio'
@@ -13,7 +14,7 @@ class Filter
13
14
attr_accessor :logger
14
15
15
16
# List the available filters here (by class name) for use in the validator method.
16
- AVAILABLE_FILTERS = %w( AbsentFile CompilationDir JSON YAML ) . freeze
17
+ AVAILABLE_FILTERS = %w( AbsentFile CompilationDir JSON SingleItemArray YAML ) . freeze
17
18
18
19
# Public: Determine whether a particular filter exists. This can be used to validate
19
20
# a user-submitted filter.
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../filter'
4
+
5
+ require 'set'
6
+
7
+ module OctocatalogDiff
8
+ module CatalogDiff
9
+ class Filter
10
+ # Filter out changes in parameters when one catalog has a parameter that's a string and
11
+ # the other catalog has that same parameter as an array containing the same string.
12
+ # For example, under this filter, the following is not a change:
13
+ # catalog1: notify => "Service[foo]"
14
+ # catalog2: notify => ["Service[foo]"]
15
+ class SingleItemArray < OctocatalogDiff ::CatalogDiff ::Filter
16
+ # Public: Implement the filter for single-item arrays whose item exactly matches the
17
+ # item that's not in an array in the other catalog.
18
+ #
19
+ # @param diff [OctocatalogDiff::API::V1::Diff] Difference
20
+ # @param _options [Hash] Additional options (there are none for this filter)
21
+ # @return [Boolean] true if this difference is a YAML file with identical objects, false otherwise
22
+ def filtered? ( _diff , _options = { } )
23
+ false
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
You can’t perform that action at this time.
0 commit comments