10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/fixation/fixtures.rb', line 10
def compile_fixture_files(connection = ActiveRecord::Base.connection)
puts "#{Time.now} building fixtures" if Fixation.trace
@class_names = {}
@loaded_at = ActiveRecord::Base.default_timezone == :utc ? Time.now.utc : Time.now
Fixation.paths.each do |path|
Fixation.extensions.each do |extension|
Dir["#{path}/{**,*}/*#{extension}"].each do |pathname|
basename = pathname[path.size + 1..-(extension.size + 1)]
load_fixture_file(pathname, basename, connection) if ::File.file?(pathname)
end
end
end
Fixation.paths.each do |path|
Dir["#{path}/{**,*}/*.rb"].each do |pathname|
FixtureContent.instance_eval(File.read(pathname)) if ::File.file?(pathname)
end
end
bake_fixtures
puts "#{Time.now} built fixtures for #{@fixture_ids.size} tables" if Fixation.trace
end
|