aboutsummaryrefslogtreecommitdiffstats
path: root/script/load-sample-data
blob: 84b8a28ebf85b053348b2609b614727aa923fb63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

# This script loads spec fixtures, but also needs to do a hack around
# the fact that the fixtures aren't aware of the fact that RawEmails
# have a filesystem representation of their contents

LOC=`dirname $0`
rake --silent spec:db:fixtures:load
"$LOC/runner" /dev/stdin <<END
env = ENV["RAILS_ENV"]
require "spec/spec_helper.rb" # Sets RAILS_ENV to 'test'
ENV["RAILS_ENV"] = env

RawEmail.all().each do |email|
    puts "Writing #{email.filepath}"
    email.data = load_file_fixture("useless_raw_email.email")
end
END

echo "Loaded fixtures."