Class: StaticDb::Dump

Inherits:
Object
  • Object
show all
Defined in:
lib/static_db/dump.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fixture_path:) ⇒ Dump

Returns a new instance of Dump.



6
7
8
9
# File 'lib/static_db/dump.rb', line 6

def initialize(fixture_path:)
  @fixture_path = Pathname.new(fixture_path)
  @models_to_be_saved = models
end

Instance Attribute Details

#fixture_pathObject (readonly)

Returns the value of attribute fixture_path.



4
5
6
# File 'lib/static_db/dump.rb', line 4

def fixture_path
  @fixture_path
end

#models_to_be_savedObject (readonly)

Returns the value of attribute models_to_be_saved.



4
5
6
# File 'lib/static_db/dump.rb', line 4

def models_to_be_saved
  @models_to_be_saved
end

Instance Method Details

#performObject



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

def perform
  exit 1 if $skip_active_fixtures_dump

  reenable_rake_tasks!
  validate_records!

  puts green("Dumping fixtures ...")

  dump_fixtures!
  Rake::Task["db:drop"].invoke

  puts green("Done!")
end