public
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/halorgium/mephisto.git
Search Repo:
ran script/generate rspec [aotearoa]

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@3054 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Fri Nov 23 19:52:26 -0800 2007
commit  dd9dab0acec75dcdbaad92a5340b435f7c96464f
tree    f0d92023bd0407c1757e823e08fb23c7e166332f
parent  3f0212ed4514a89bd3b4178cc308f488432254d9
...
 
 
 
 
...
1
2
3
4
0
@@ -1 +1,5 @@
0
+#!/usr/bin/env ruby
0
+$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
0
+require 'spec'
0
+exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
0
@@ -1 +1,100 @@
0
+#!/usr/bin/env ruby
0
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../rspec/lib' # For svn
0
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
0
+require 'rubygems'
0
+require 'drb/drb'
0
+require 'rbconfig'
0
+require 'spec'
0
+require 'optparse'
0
+
0
+# This is based on Florian Weber's TDDMate
0
+module Spec
0
+ module Runner
0
+ class RailsSpecServer
0
+ def run(argv, stderr, stdout)
0
+ $stdout = stdout
0
+ $stderr = stderr
0
+
0
+ base = ActiveRecord::Base
0
+ def base.clear_reloadable_connections!
0
+ active_connections.each do |name, conn|
0
+ if conn.requires_reloading?
0
+ conn.disconnect!
0
+ active_connections.delete(name)
0
+ end
0
+ end
0
+ end
0
+
0
+ if ::Dispatcher.respond_to?(:cleanup_application)
0
+ ::Dispatcher.cleanup_application
0
+ elsif ::Dispatcher.respond_to?(:reset_application!)
0
+ ::Dispatcher.reset_application!
0
+ end
0
+ ::Dependencies.mechanism = :load
0
+ require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
0
+ load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
0
+
0
+ ::Spec::Runner::CommandLine.run(
0
+ ::Spec::Runner::OptionParser.parse(
0
+ argv,
0
+ $stderr,
0
+ $stdout
0
+ )
0
+ )
0
+ end
0
+ end
0
+ end
0
+end
0
+puts "Loading Rails environment"
0
+
0
+ENV["RAILS_ENV"] = "test"
0
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
0
+require 'dispatcher'
0
+
0
+def restart_test_server
0
+ puts "restarting"
0
+ config = ::Config::CONFIG
0
+ ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
0
+ command_line = [ruby, $0, ARGV].flatten.join(' ')
0
+ exec(command_line)
0
+end
0
+
0
+def daemonize(pid_file = nil)
0
+ return yield if $DEBUG
0
+ pid = Process.fork{
0
+ Process.setsid
0
+ Dir.chdir(RAILS_ROOT)
0
+ trap("SIGINT"){ exit! 0 }
0
+ trap("SIGTERM"){ exit! 0 }
0
+ trap("SIGHUP"){ restart_test_server }
0
+ File.open("/dev/null"){|f|
0
+ STDERR.reopen f
0
+ STDIN.reopen f
0
+ STDOUT.reopen f
0
+ }
0
+ yield
0
+ }
0
+ puts "spec_server launched. (PID: %d)" % pid
0
+ File.open(pid_file,"w"){|f| f.puts pid } if pid_file
0
+ exit! 0
0
+end
0
+
0
+options = Hash.new
0
+opts = OptionParser.new
0
+opts.on("-d", "--daemon"){|v| options[:daemon] = true }
0
+opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
0
+opts.parse!(ARGV)
0
+
0
+puts "Ready"
0
+exec_server = lambda {
0
+ trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
0
+ DRb.start_service("druby://localhost:8989", Spec::Runner::RailsSpecServer.new)
0
+ DRb.thread.join
0
+}
0
+
0
+if options[:daemon]
0
+ daemonize(options[:pid], &exec_server)
0
+else
0
+ exec_server.call
0
+end
...
 
 
...
1
2
0
@@ -1 +1,3 @@
0
+--exclude "spec/*,gems/*"
0
+--rails
...
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
0
@@ -1 +1,8 @@
0
+--colour
0
+--format
0
+progress
0
+--loadby
0
+mtime
0
+--reverse
0
+--backtrace
...
 
 
 
 
...
1
2
3
4
0
@@ -1 +1,5 @@
0
+dir = File.dirname(__FILE__)
0
+Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
0
+ require file
0
+end
...
 
 
 
...
1
2
3
0
@@ -1 +1,4 @@
0
+ENV["RAILS_ENV"] = "test"
0
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
0
+require 'spec/rails/story_adapter'

Comments

    No one has commented yet.