Class: PhilColumns::Filter

Inherits:
Object
  • Object
show all
Includes:
SeedUtils
Defined in:
lib/phil_columns/filter.rb

Constant Summary

Constants included from SeedUtils

SeedUtils::SEED_REGEX

Instance Method Summary collapse

Methods included from SeedUtils

#archivist, #discover_seed_class, #discover_seed_timestamp, #each_seed_meta_for_current_env, #load_seeds, #map_seeds, #seed_already_executed?, #seed_filepaths, #seeds_for_current_env

Constructor Details

#initialize(config) ⇒ Filter

Returns a new instance of Filter.



6
7
8
9
10
# File 'lib/phil_columns/filter.rb', line 6

def initialize( config )
  @config      = config
  @seeds_path  = config.seeds_path
  @tags        = config.tags
end

Instance Method Details

#calculate_seed_set_allObject



17
18
# File 'lib/phil_columns/filter.rb', line 17

def calculate_seed_set_all
end

#calculate_seed_set_anyObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/phil_columns/filter.rb', line 20

def calculate_seed_set_any
  if any_exclusion_tags?
    raise PhilColumns::Error,
          "Cannot provide exclusion tags (#{config.exclusion_tags.join( ', ' )}) when operation is any"
  end

  seeds_for_current_env.tap do |seeds|
    unless tags.empty?
      seeds.select! { |seed_meta| (seed_meta.tags & tags).size > 0 }
    end
  end
end

#seedsObject



12
13
14
15
# File 'lib/phil_columns/filter.rb', line 12

def seeds
  load_seeds
  calculate_seed_set
end