thufir@arrakis ~/goodfellow-tool/db $
thufir@arrakis ~/goodfellow-tool/db $ rake
(in /home/thufir/goodfellow-tool/db)
rake aborted!
/home/thufir/goodfellow-tool/db/rakefile:12: syntax error, unexpected
tSYMBEG, expecting ')'
:name => name
^
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1940:in
`raw_load_rakefile'
(See full trace by running task with --trace)
thufir@arrakis ~/goodfellow-tool/db $
thufir@arrakis ~/goodfellow-tool/db $ cat rakefile
desc "load int data into development.sqlite3"
task :load_data => ["/home/thufir/goodfellow-tool/db/
data.csv", :environment] do |t|
File.read(t.prerequisites.first).each do | line |
id,name=line.split(/,/)
Call.create(
:id => id
:name => name
)
end
end
thufir@arrakis ~/goodfellow-tool/db $
thufir@arrakis ~/goodfellow-tool/db $ sqlite3 development.sqlite3
SQLite version 3.4.1
Enter ".help" for instructions
`raw_load_rakefile'
(See full trace by running task with --trace)
thufir@arrakis ~/goodfellow-tool/db $
thufir@arrakis ~/goodfellow-tool/db $ cat rakefile
desc "load int data into development.sqlite3"
task :load_data => ["/home/thufir/goodfellow-tool/db/
data.csv", :environment] do |t|
Oh yeah, forgot. I was reading the directions, which include:
"But it's important to include :environment in the task line - that tells
Rails how to connect to the right database. "
http://www.jobwd.com/article/show/5
My rake command is failing with:
thufir@arrakis ~/goodfellow-tool/db $ rake load_data
(in /home/thufir/goodfellow-tool/db)
rake aborted!
Don't know how to build task 'environment'
(See full trace by running task with --trace)
thufir@arrakis ~/goodfellow-tool/db $
So I'm a bit stymied. I mean, presumably the rake file pulls data from
database.yml and so forth...
Thank you for all your help, I'm much closer to tangible results.