Daniel,
I've taken a look at the Ruby file you attached and it does indeed have a Ruby syntax error -- a couple of missing `end`s.
Every time you use a `do` in Ruby to start a block, you need a matching `end` to finish it. It's standard practice to indent everything between the `do` and `end` so you can easily tell which `end` matches which `do`.
In your `deploy.rb`:
task :sync, :roles => :web do
...
end
Likewise, when you use `if`/`then`, you'll also need an `end`.
if ... then
...
end
if stage == :production then
puts "[Error] ..."
end
In the example you posted, there's an `else` instead of an `end` (and it's indented at the same level as the `puts` which makes it hard to spot).
Making these two changes (extra `end`, replace `else` with `end`) should make a syntactically OK file. If you'd like help simplifying the code itself, post back here (or try live chat with the #ruby channel on Freenode IRC):
https://webchat.freenode.net/
Hunter