Class: SeedFu::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/seed-fu/runner.rb

Overview

Runs seed files.

It is not recommended to use this class directly. Instead, use SeedFu.seed, which creates an instead of Runner and calls #run.

See Also:

Instance Method Summary collapse

Constructor Details

#initialize(fixture_paths = nil, filter = nil) ⇒ Runner

Returns a new instance of Runner

Parameters:

  • fixture_paths (Array<String>) (defaults to: nil)

    The paths where fixtures are located. Will use SeedFu.fixture_paths if nil. If the argument is not an array, it will be wrapped by one.

  • filter (Regexp) (defaults to: nil)

    If given, only seed files with a file name matching this pattern will be used



16
17
18
19
# File 'lib/seed-fu/runner.rb', line 16

def initialize(fixture_paths = nil, filter = nil)
  @fixture_paths = Array.wrap(fixture_paths || SeedFu.fixture_paths)
  @filter        = filter
end

Instance Method Details

#runObject

Run the seed files.



22
23
24
25
26
27
28
# File 'lib/seed-fu/runner.rb', line 22

def run
  puts "\n== Filtering seed files against regexp: #{@filter.inspect}" if @filter && !SeedFu.quiet

  filenames.each do |filename|
    run_file(filename)
  end
end