unable to specify deployment file?

47 views
Skip to first unread message

Hassan Schroeder

unread,
Jan 27, 2011, 2:44:01 PM1/27/11
to capis...@googlegroups.com
Haven't done anything too involved with Capistrano yet, but have
just run into a problem that seems like unexpected behavior:

$ cap deploy:check --file config/deploy.rb
the task `deploy:check' does not exist
$ cap --tasks deploy:check
cap deploy:check # Test deployment dependencies.

Extended help may be available for these tasks.
Type `cap -e taskname' to view it.
$

Is there an alternate way to specify which deploy file to use? Am I
missing something blindingly obvious? :-)

$ cap --version
Capistrano v2.5.19
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

TIA,
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan

Tom Copeland

unread,
Jan 28, 2011, 3:56:52 PM1/28/11
to capis...@googlegroups.com
Hm, doesn't "cap deploy:check" work if you don't specify a "--file" parameter? The Capfile should load it,

Yours,

Tom

> --
> * You received this message because you are subscribed to the Google Groups "Capistrano" group.
> * To post to this group, send email to capis...@googlegroups.com
> * To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en

Hassan Schroeder

unread,
Jan 28, 2011, 4:00:46 PM1/28/11
to capis...@googlegroups.com
On Fri, Jan 28, 2011 at 12:56 PM, Tom Copeland <t...@infoether.com> wrote:
> .. doesn't "cap deploy:check" work if you don't specify a "--file" parameter?

> The Capfile should load it,

Yes, but that only works with the default "deploy.rb" file -- I need to be
able to specify alternate filenames for specific situations.

Rafa García

unread,
Jan 28, 2011, 8:36:45 AM1/28/11
to capis...@googlegroups.com
Hi Hassan,

  I just created a foo.rb file with the next task:
##
# SSH parameters
#
set :user, "wadus"
desc "Task for testing to load a config from other file"
task :config_file, :hosts => 'test-server.com' do
  run "sleep 10"
end
   And I have a complete (and working) config/deploy.rb.

  When I did "cap -T -f foo.rb" it showed me three tasks: config_file, invoke and shell. This is the correct result (I didn't want to see the config/deploy.rb tasks).

  After this I did "cap config_file -f foo.rb" and Capistrano executed the task.

  By default Capfile, the file generated by capify command, try to load all plugins from vendorized gems and load config/deploy.rb file. Then you don't need to load config/deploy.rb file.
  
  I cann't reproduce your error, I hope it give you some clues.

Regards
2011/1/27 Hassan Schroeder <hassan.s...@gmail.com>

Hassan Schroeder

unread,
Jan 30, 2011, 7:47:29 AM1/30/11
to capis...@googlegroups.com
On Fri, Jan 28, 2011 at 5:36 AM, Rafa García <cont...@rafagarcia.net> wrote:

>   I cann't reproduce your error, I hope it give you some clues.

Thanks for the response but perhaps I didn't explain well, as I see no
relationship between your example and the problem.

To put it another way:

$ cap deploy:check
# works fine
* executing `deploy:check'
* executing "test -d /webapps/example/releases"
.....
command finished
You appear to have all necessary dependencies installed
$ cap deploy:check -f config/deploy_alternate.rb # fails


the task `deploy:check' does not exist
$

Does that work for anyone?

Lee Hambley

unread,
Jan 30, 2011, 8:05:52 AM1/30/11
to capis...@googlegroups.com
-f is intended to specify a Capfile, the Capfile loads `deploy.rb` from the gem, which is where deploy:check is defined.

Hassan Schroeder

unread,
Jan 30, 2011, 8:42:07 AM1/30/11
to capis...@googlegroups.com
On Sun, Jan 30, 2011 at 5:05 AM, Lee Hambley <lee.h...@gmail.com> wrote:
> -f is intended to specify a Capfile, the Capfile loads `deploy.rb` from the
> gem, which is where deploy:check is defined.

Yikes. For quite a while I've been using e.g.

$ cap deploy -f config/deploy_alternate.rb

: to specify the deployment target, and that works fine. But you're
saying that's just a fluke, and the fact that deploy:check and other
variants fail is expected?

Having to create 2 files instead of 1 -- Capfile.alternate, referencing
config/deploy_alternate.rb -- doesn't seem very DRY...

But OK, thanks for the clarification!

Lee Hambley

unread,
Jan 30, 2011, 1:13:31 PM1/30/11
to capis...@googlegroups.com
Hassan,

If you know a better way, happy to take a patch - what are you doing, anyway - sounds like you should be using multistage?

- Lee

Hassan Schroeder

unread,
Jan 30, 2011, 1:47:26 PM1/30/11
to capis...@googlegroups.com
On Sun, Jan 30, 2011 at 10:13 AM, Lee Hambley <lee.h...@gmail.com> wrote:

> - sounds like you should be using multistage?

Not having been aware of it before -- yes, I believe you're right :-)

Sorry for the noise!

Reply all
Reply to author
Forward
0 new messages