I would like to support developing strategies outside of capistrano's source

This can be done if you override Capistrano::Deploy::Strategy by rescuing 
the LoadError; the other checks make sure you still have a valid strategy 
defined that is required somewhere in your deploy.rb

module Capistrano
  module Deploy
    module Strategy
      def self.new(strategy, config={})
        strategy_file = "capistrano/recipes/deploy/strategy/#{strategy}"
        begin 
          require(strategy_file)
        rescue LoadError
        end
        strategy_const = strategy.to_s.capitalize.gsub(/_(.)/) { $1.upcase }
        if const_defined?(strategy_const)
          const_get(strategy_const).new(config)
        else
          raise Capistrano::Error, "could not find 
`#{name}::#{strategy_const}' in `#{strategy_file}'"
        end
      rescue LoadError
        raise Capistrano::Error, "could not find any strategy named 
`#{strategy}'"
      end
    end
  end
end

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

Reply via email to