I hacked around it in a semi-gross fashion. In "hive/config/
environment.rb", I added the following code:
-----
# Bootstrap the Rails environment, frameworks, and default
configuration
require File.join(File.dirname(__FILE__), 'boot')
### Capistrano2 HACK
unless RAILS_ENV == "test"
module Kernel
alias_method :__require__, :require
def require(file)
# As described in http://dev.rubyonrails.org/ticket/6889, as
well as
# changeset 5740: http://dev.rubyonrails.org/changeset/5740
file = "test/unit/error" if file == "test/unit"
__require__(file)
end
end
end
### END HACK
-----
It looks like Stefan Kaes reported this bug 6 months ago, and it was
fixed (http://dev.rubyonrails.org/ticket/6889). However, my hive app
is running Rails 1.1.6, so it never got the patch. This should hold me
for now, until I have time to convert my app to Rails 1.2.3.
Thanks,
David
On Jun 27, 12:42 pm, "Jamis Buck" <[EMAIL PROTECTED]> wrote:
> Yeah...I'm really suspicious of this line:
>
> require File.dirname(__FILE__) + "/../../hive/config/environment"
>
> What is in the environment? Something, somewhere, is doing a "require
> 'test/unit'", which is messing things up.
>
> - Jamis
>
> On 6/27/07, dbalatero <[EMAIL PROTECTED]> wrote:
>
>
>
> > Ok, after what you said about 3rd-party extensions -- I was loading up
> > my Rails environment into deploy.rb, so I could access my list of
> > clients and dynamically build up the roles as needed.
>
> > deploy.rb (top)
> > --------------------
> > require 'highline'
>
> > puts "== Loading Hive Rails..."
> > require File.dirname(__FILE__) + "/../../hive/config/environment"
>
> > $_highline = HighLine.new
>
> > set :application, "admin"
> > set :codename, "redclay"
> > set :repository, "svn+ssh://[EMAIL PROTECTED]/home/
> > #{codename}/repos/trunk"
>
> > # If you aren't deploying to /u/apps/#{application} on the target
> > # servers (which is the default), you can specify the actual location
> > # via the :deploy_to variable:
> > set :deploy_to, "~/#{application}"
>
> > set :scm, :subversion
> > set :rails_env, 'production'
> > set :use_sudo, false
> > set :sudo_user, "david"
>
> > #########################################
> > # Setup the roles via the database
> > #########################################
>
> > role :master, "[EMAIL PROTECTED]"
>
> > clients = Client.find(:all, :conditions => "managed_deploy = 1")
> > clients.each do |client|
> > # TODO move off port 10000
> > domain_string = "[EMAIL PROTECTED]:10000"
> > role :app, domain_string
> > role :db, domain_string, :primary => true
> > role :web, domain_string
> > end
>
> > When I commented out the Rails-specific lines (the require statement,
> > and anything using my Client model), everything worked again. Maybe
> > there isn't a way to get cap2 and my Rails models to play nice
> > together...
>
> > - David
>
> > On Jun 27, 12:33 pm, dbalatero <[EMAIL PROTECTED]> wrote:
> > > Jamis,
>
> > > I don't know what happened, but I logged in again, and now everything
> > > runs as expected. Creepy. I'll let you know if this happens again, but
> > > I guess consider this issue magically solved ;)
>
> > > - David
>
> > > On Jun 27, 12:22 pm, dbalatero <[EMAIL PROTECTED]> wrote:
>
> > > > I modified my task:
>
> > > > task :test_cap, :roles => [:master] do
> > > > puts "You passed in #{arg1}"
> > > > exit
> > > > end
>
> > > > With that exit statement, it doesn't produce the Test::Unit error.
> > > > Whatever is happening, happens after the method runs and Capistrano
> > > > does whatever final teardown it needs.
>
> > > > - David
>
> > > > On Jun 27, 12:10 pm, "Jamis Buck" <[EMAIL PROTECTED]> wrote:
>
> > > > > That's...really wierd. It's like test/unit is getting loaded somehow,
> > > > > because those command-line options are the options for Ruby's
> > > > > test/unit lib.
>
> > > > > It all works as advertised for me. Anyone else?
>
> > > > > - Jamis
>
> > > > > On 6/27/07, dbalatero <[EMAIL PROTECTED]> wrote:
>
> > > > > > I just upgraded to the new cap2 beta gem (posted here on June 25,
> > > > > > 2007), and I'm noticing something very weird when passing in
> > > > > > command-
> > > > > > line variables to /usr/bin/cap.
>
> > > > > > Relevant portions of deploy.rb:
> > > > > > -------------------
> > > > > > role :master, "[EMAIL PROTECTED]"
>
> > > > > > namespace :master do
> > > > > > task :test_cap, :roles => [:master] do
> > > > > > puts "You passed in #{arg1}"
> > > > > > end
> > > > > > end
>
> > > > > > When I run cap master:test_cap -s arg1="hello", the method executes
> > > > > > just fine. However, after the test_cap task finishes, it spits an
> > > > > > error out:
>
> > > > > > * executing `master:test_cap'
> > > > > > You passed in hello
> > > > > > invalid option: -s
> > > > > > Test::Unit automatic runner.
> > > > > > Usage: /usr/bin/cap [options] [-- untouched arguments]
>
> > > > > > -r, --runner=RUNNER Use the given RUNNER.
> > > > > > (c[onsole], f[ox], g[tk],
> > > > > > g[tk]2,
> > > > > > t[k])
> > > > > > -n, --name=NAME Runs tests matching NAME.
> > > > > > (patterns may be used).
> > > > > > -t, --testcase=TESTCASE Runs tests in TestCases
> > > > > > matching
> > > > > > TESTCASE.
> > > > > > (patterns may be used).
> > > > > > -v, --verbose=[LEVEL] Set the output level (default
> > > > > > is
> > > > > > verbose).
> > > > > > (s[ilent], p[rogress],
> > > > > > n[ormal],
> > > > > > v[erbose])
> > > > > > -- Stop processing options so that
> > > > > > the
> > > > > > remaining options will be
> > > > > > passed
> > > > > > to the
> > > > > > test.
> > > > > > -h, --help Display this help.
>
> > > > > > Deprecated options:
> > > > > > --console Console runner (use --runner).
> > > > > > --gtk GTK runner (use --runner).
> > > > > > --fox Fox runner (use --runner).
>
> > > > > > Something in the options parsing to /usr/bin/cap must have changed.
> > > > > > The other option is that my /usr/bin/cap got symlinked to something
> > > > > > weird when I installed the latest gem. Does this output look correct
> > > > > > for /usr/bin/cap?:
>
> > > > > > [EMAIL PROTECTED] ~/redclay $ cat `which cap`
> > > > > > #!/usr/bin/env ruby
> > > > > > #
> > > > > > # This file was generated by RubyGems.
> > > > > > #
> > > > > > # The application 'capistrano' is installed as part of a gem, and
> > > > > > # this file is here to facilitate running it.
> > > > > > #
>
> > > > > > require 'rubygems'
> > > > > > version = "> 0"
> > > > > > if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
> > > > > > version = $1
> > > > > > ARGV.shift
> > > > > > end
> > > > > > gem 'capistrano', version
> > > > > > load 'cap'
>
> > > > > > Anyways, can someone see if they can reproduce the error I'm getting
> > > > > > with the latest Cap2 beta gem?
>
> > > > > > Thanks,
> > > > > > David Balatero
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---