seattlerb/rake-remote_task — Issue #12: setting deploy_timestamped=false throws errors if first deploy
Author: goosetav
Created: 2012-02-08 22:58:25+00:00
State: open

took awhile to track this one down...

If ```deploy_timestamped``` is set to false, the very first release will throw a stack trace when ```vlad:deploy``` is invoked.

```
rake aborted!
can't convert nil into String
/opt/local/lib/ruby/gems/1.8/gems/rake-remote_task-2.0.6/lib/rake/remote_task.rb:464:in `join'
/opt/local/lib/ruby/gems/1.8/gems/rake-remote_task-2.0.6/lib/rake/remote_task.rb:638:in `join'
/opt/local/lib/ruby/gems/1.8/gems/rake-remote_task-2.0.6/lib/rake/remote_task.rb:638:in `execute'
...
...
```

The problem comes from asking for ```current_release``` when there are no releases. ```current_release``` ends up being called via ```latest_release``` on line 71 of core.rb. [rake-remote_task](https://github.com/seattlerb/rake-remote_task/blob/master/lib/rake/remote_task.rb) defaults ```latest_release``` to:

```
set(:latest_release) {
deploy_timestamped ? release_path : current_release
}
```

which ultimately boils down to ```File.join(releases_path, releases[-1])``` where ```releases[-1]``` returns nil, thus causing ```File.join``` to complain.

I'm not sure what the behavior of ```latest_release``` is supposed to be when ```deploy_timestamped``` is false. Perhaps ```current_release``` should just return ```nil``` when there are no releases?