What is "show current"? Is it a task? If so, that's the problem.
The "capture" helper executes a raw shell command, and returns the
output, like so:
result = capture("ls -l /usr/lib")
There is not a single helper method for capturing all of the output of
a task that is run.
- Jamis
On 9/6/07, Tim <[EMAIL PROTECTED]> wrote:
>
> I changed the call to this, and the task is executed, but i get a new
> error
> config.capture(config.show_current)
>
>
> /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/capistrano/
> configuration/actions/invocation.rb:46:in `run': undefined method
> `strip' for #<Capistrano::Command:0xb7e8d368> (NoMethodError)
> from /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/
> capistrano/configuration/actions/invocation.rb:35:in `invoke_command'
> from /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/
> capistrano/configuration/actions/inspect.rb:34:in `capture'
> from test.rb:14
>
>
> On Sep 6, 4:33 pm, Tim <[EMAIL PROTECTED]> wrote:
> > Ok i found that little helper method, however the task that runs just
> > fine normally, bails when called with capture
> >
> > Here's my test script
> >
> > require 'rubygems'
> > require 'capistrano'
> > require 'capistrano/cli'
> >
> > config = Capistrano::Configuration.new
> > config.load "foo" # I removed the real call to load the capfile
> >
> > config.logger.level = Capistrano::Logger::TRACE
> >
> > output = config.capture("show_current")
> >
> > and here's what happens when i run it
> >
> > executing "show_current"
> > servers: ["tims.foo.local"]
> > [tims.foo.local] executing command
> > command finished
> > /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/capistrano/command.rb:
> > 58:in `process!': command "show_current" failed on tims.foo.local
> > (Capistrano::CommandError)
> > from /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/
> > capistrano/command.rb:11:in `process'
> > from /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/
> > capistrano/configuration/actions/invocation.rb:52:in `run'
> > from /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/
> > capistrano/configuration/connections.rb:135:in `execute_on_servers'
> > from /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/
> > capistrano/configuration/actions/invocation.rb:50:in `run'
> > from /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/
> > capistrano/configuration/actions/invocation.rb:35:in `invoke_command'
> > from /usr/lib/ruby/gems/1.8/gems/capistrano-2.0.0/lib/
> > capistrano/configuration/actions/inspect.rb:34:in `capture'
> > from test.rb:13
> >
> > On Sep 6, 3:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
> >
> > > # note this is only run for the first host
> > > result = capture "command goes here"
> >
> > > On Sep 7, 8:20 am, Tim <[EMAIL PROTECTED]> wrote:
> >
> > > > Say i have a custom task that executes an 'svn info' on the current
> > > > app dir. I want to be able to capture the result, then parse it for
> > > > specific info. Anyone have a handy way to capture the command line
> > > > into a variable so that it can be evaluated. I see the webistrano
> > > > scheme, but that writes to a db object for every line of output. Do I
> > > > have to collect the output line by line, or is there some way to just
> > > > capture all of it?
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---