Class: Graffable::SeedTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/graffable/seed_task.rb

Instance Method Summary collapse

Constructor Details

#initializeSeedTask

Returns a new instance of SeedTask.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/graffable/seed_task.rb', line 8

def initialize

  namespace = 'graffable'

  desc 'Load Graffable seed data from SEED_FILE'
  task "#{namespace}:seed" do
    db   = Graffable::Database.connect
    key  = 'SEED_FILE'
    seed = ENV[key]
    raise "No #{key} was provided" if seed.nil?
    load seed
    puts "<= #{namespace}:seed executed"
  end

end