Frankly, I found the new book to be pretty weak as a training manual.
I went all the way through, and then went hunting for tutorials. It
probably would have been easier if I wasn't starting with a poorly
designed distributed MS SQL Server database. The ones you mentioned
were all I found. I don't recall any really major problems with the
tutorials.
I know that InstaRails is no longer supported. I would advise getting
it anyway. Three gochas:
1) Run gem update immediately. If you have firewall troubles, you
want to find out right away anyway. (I'm downloading all gems & doing
local installs)
2) Instarails insists that it knows where your projects are. This is
very inconvenient for the way I use subversion, so I just pop a
console & cd.
3) Rails itself is really, really stupid about subversion. Do NOT do
a rails -c if you value your sanity.
I like to have a repo image on my local drive. YMMV:
mkdir TEMP_DIR
cd TEMP_DIR
mkdir branches
mkdir tags
cd ..
svn import PROJECT_URL
cd ..
svn checkout PROJECT_URL PROJECT_NAME
cd PROJECT_NAME
rails PROJECT_NAME
mov PROJECT_NAME trunk
add_svn trunk
svn commit -m "Initial rails commit"
Here is my (ugly) add_svn script. The most contentious decision is
probably about whether or not you ignore database.yml. This is
discussed in the book.
#!/usr/bin/ruby
# add_svn by Nathan Zook
# usage: add_svn [directory]
# Adds rails files with reasonable ignore properties
def add_excepting(base, excludes)
excludes.each do |dir, controls|
next unless dir
reldir = "#{base}/#{dir}"
svn("add --non-recursive #{reldir}")
if controls.is_a? Hash
add_excepting(reldir, controls)
else
process(reldir, controls)
end
end
if excludes.has_key?(nil)
process(base, excludes[nil])
end
addset (Dir.glob("#{base}/*") - excludes.keys.select{|file|
file}.collect{|file| "#{base}/#{file}"})
end
def process(reldir, controls)
ignore =
controls.each do |pat|
if exec?(pat)
callout(reldir, exec?(pat))
elsif backup?(pat)
ignore << backup(reldir, backup?(pat))
else
ignore << pat
end
end
svn("propset svn:ignore \"#{ignore.join("\n")}\" #{reldir}") unless
ignore.empty?
files = Dir.glob("#{reldir}/*") + Dir.glob("#{reldir}/.*") -
%w(.svn . ..).collect{|file| "#{reldir}/#{file}"}
addset ignore.inject(files) { |files, pattern|
files - Dir.glob("#{reldir}/#{pattern}")
}
end
def addset(files)
svn("add #{files.join(' ')}") unless files.empty?
end
def exec?(directive)
match_and_strip( /\A /, directive)
end
def backup?(directive)
match_and_strip(/\A:backup /, directive)
end
def match_and_strip(rexp, directive)
if rexp.match(directive)
directive.sub(rexp, '')
else
nil
end
end
def backup(dir, file)
File.rename("#{dir}/#{file}", "#{dir}/#{file}.example")
file
end
def svn(args)
callout(".", "svn #{args}")
end
def callout(dir, cmd)
cwd = Dir.getwd
Dir.chdir dir
system(cmd) or raise "'#{cmd}' in directory #{dir} went bang: #{$?}"
Dir.chdir cwd
end
root = ARGV.shift || '.'
Dir.chdir root
cwd = Dir.getwd
Dir.chdir '..'
base = File.basename(cwd)
if ! File.directory? "#{base}/.svn"
svn("add #{base} -N")
end
add_excepting( base, {
'log' => ['*.log'],
'db' => ['schema.rb', 'development_structure.sql', '*.rb'],
'doc' => ['*.doc'],
'tmp' => {
nil => ['*'],
'sessions' => ['*'],
'sockets' => ['*'],
'cache' => ['*'],
'pids' => ['*'],
},
'config' => [':backup database.yml'],
'public' => [':backup dispatch.rb', ':backup dispatch.cgi', ':backup
dispatch.fcgi']
})