Class: PhilColumns::Seeder

Inherits:
Object
  • Object
show all
Includes:
Output, SeedUtils
Defined in:
lib/phil_columns/seeder.rb

Constant Summary

Constants included from SeedUtils

PhilColumns::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, #seeds_path

Methods included from Output

#confirm, included, #say, #say_error, #say_ok, #say_skipping, #write

Constructor Details

#initialize(config) ⇒ Seeder

Returns a new instance of Seeder.



7
8
9
# File 'lib/phil_columns/seeder.rb', line 7

def initialize( config )
  @config = config
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/phil_columns/seeder.rb', line 11

def execute
  seeds.each do |seed_meta|
    confirm "Executing seed: #{seed_meta.name} ... ", :cyan do
      unless dependencies_satisfied?( seed_meta.klass.depends_on )
        raise PhilColumns::Error, failed_dependencies_message( seed_meta )
      end

      instance = seed_meta.klass.new( config )
      instance.send( method_name )
      record_seed( seed_meta )
    end
  end
end