Charles Quinn
2006-Jul-26 21:55 UTC
[Rails] capistrano CLI automation - using capistrano as a library
Hi all, I''m trying to integrate Capistrano (thanks Jamis and DHH for such a lovely piece of software) into an application I''m writing. I can''t figure out, though, how to get output from capistrano when it''s used through the CLI or configuration class, however. I see that it implements a logger (Logger) and I see that starting on line 12 of the included logger.rbit has options to change the device to something that responds to put: --- start snip capistrano-1.1.0/lib/capistrano/logger.rb --- def initialize(options={}) output = options[:output] || STDERR case when output.respond_to?(:puts) @device = output else @device = File.open(output.to_str, "a") @needs_close = true end @options = options @level = 0 end --- end snip capistrano-1.1.0/lib/capistrano/logger.rb --- But, I cannot figure out how to set that options[:output] anywhere. Here''s where I''m at: script/console>> require ''capistrano'' >> require ''capistrano/cli'' >> config = Capistrano::Configuration.new#<Capistrano::Configuration:0x235b0a8 @actor=#<Capistrano::Actor:0x235b058 @task_call_frames=[], @tasks={}, @factory=#<Capistrano::Actor::DefaultConnectionFactory:0x235aff4 @config=#<Capistrano::Configuration:0x235b0a8 ...>>, @configuration=#<Capistrano::Configuration:0x235b0a8 ...>, @sessions={}>, @now=Wed Jul 26 21:26:18 UTC 2006, @variables={:current_dir=>"current", :repository=>nil, :shared_dir=>"shared", :gateway=>nil, :scm=>:subversion, :ssh_options=>{}, :user=>nil, :deploy_to=>#<Proc:0x023e2698@/usr/local/lib/ruby/gems/1.8/gems/capistrano- 1.1.0/lib/capistrano/configuration.rb:55>, :revision=>#<Proc:0x023e22b0@/usr/local/lib/ruby/gems/1.8/gems/capistrano- 1.1.0/lib/capistrano/configuration.rb:62>, :original_value=>{}, :version_dir=>"releases", :password=>nil, :application=>nil}, @roles={}, @load_paths=[".", "/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes"], @logger=#<Capistrano::Logger:0x235b044 @level=0, @device=#<IO:0x1e9854>, @options={}>> There it is, accessible, now as: config.logger but only as a read attribute. I see in the configuration.rb on about line 12: @logger = Logger.new Which makes me think it can''t be done. Any thoughts, anyone? Should I patch it, or am I missing something? Thanks, -- Charles Brian Quinn www.seebq.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060726/eff81640/attachment.html