Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 381
- Log:
Radiant is now packaged as a Gem - see Changeset #373, Changeset #374,
Changeset #375, Changeset #376, Changeset #377, Changeset #378,
Changeset #379 and Changeset #380. The application part of Radiant is
now mostly empty; it exists to provide a structure which hooks into the
gem and which provides a framework for extensions. Included in this big
changeset are all the deletions, additions and changes needed to go from
the old ROOL customised Radiant to a new ROOL customised Radiant, which
includes several custom extensions adapted from the old Radiant
modifications and requires Radiant 0.9.1 to be installed as a gem.
- Author:
- rool
- Date:
- Mon Mar 21 14:01:18 +0000 2011
- Size:
- 3367 Bytes
- Properties:
- Property svn:executable is set to *
1 | #!/usr/bin/env ruby |
2 | $LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin |
3 | require 'rubygems' |
4 | require 'drb/drb' |
5 | require 'rbconfig' |
6 | require 'spec' |
7 | require 'optparse' |
8 | |
9 | # This is based on Florian Weber's TDDMate |
10 | module Spec |
11 | module Runner |
12 | class RailsSpecServer |
13 | def run(argv, stderr, stdout) |
14 | $stdout = stdout |
15 | $stderr = stderr |
16 | |
17 | base = ActiveRecord::Base |
18 | def base.clear_reloadable_connections! |
19 | active_connections.each do |name, conn| |
20 | if conn.requires_reloading? |
21 | conn.disconnect! |
22 | active_connections.delete(name) |
23 | end |
24 | end |
25 | end |
26 | |
27 | if ActionController.const_defined?(:Dispatcher) |
28 | dispatcher = ::ActionController::Dispatcher.new($stdout) |
29 | dispatcher.cleanup_application |
30 | elsif ::Dispatcher.respond_to?(:reset_application!) |
31 | ::Dispatcher.reset_application! |
32 | else |
33 | raise "Application reloading failed" |
34 | end |
35 | if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache) |
36 | Fixtures.reset_cache |
37 | end |
38 | |
39 | ::Dependencies.mechanism = :load |
40 | require_dependency('application.rb') unless Object.const_defined?(:ApplicationController) |
41 | load File.dirname(__FILE__) + '/../spec/spec_helper.rb' |
42 | |
43 | if in_memory_database? |
44 | load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default |
45 | ActiveRecord::Migrator.up('db/migrate') # use migrations |
46 | end |
47 | |
48 | ::Spec::Runner::CommandLine.run( |
49 | ::Spec::Runner::OptionParser.parse( |
50 | argv, |
51 | $stderr, |
52 | $stdout |
53 | ) |
54 | ) |
55 | end |
56 | |
57 | def in_memory_database? |
58 | ENV["RAILS_ENV"] == "test" and |
59 | ::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and |
60 | ::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:' |
61 | end |
62 | end |
63 | end |
64 | end |
65 | puts "Loading Rails environment" |
66 | |
67 | ENV["RAILS_ENV"] = "test" |
68 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") |
69 | require 'dispatcher' |
70 | |
71 | def restart_test_server |
72 | puts "restarting" |
73 | config = ::Config::CONFIG |
74 | ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT'] |
75 | command_line = [ruby, $0, ARGV].flatten.join(' ') |
76 | exec(command_line) |
77 | end |
78 | |
79 | def daemonize(pid_file = nil) |
80 | return yield if $DEBUG |
81 | pid = Process.fork{ |
82 | Process.setsid |
83 | Dir.chdir(RAILS_ROOT) |
84 | trap("SIGINT"){ exit! 0 } |
85 | trap("SIGTERM"){ exit! 0 } |
86 | trap("SIGHUP"){ restart_test_server } |
87 | File.open("/dev/null"){|f| |
88 | STDERR.reopen f |
89 | STDIN.reopen f |
90 | STDOUT.reopen f |
91 | } |
92 | yield |
93 | } |
94 | puts "spec_server launched. (PID: %d)" % pid |
95 | File.open(pid_file,"w"){|f| f.puts pid } if pid_file |
96 | exit! 0 |
97 | end |
98 | |
99 | options = Hash.new |
100 | opts = OptionParser.new |
101 | opts.on("-d", "--daemon"){|v| options[:daemon] = true } |
102 | opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v } |
103 | opts.parse!(ARGV) |
104 | |
105 | puts "Ready" |
106 | exec_server = lambda { |
107 | trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2") |
108 | DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new) |
109 | DRb.thread.join |
110 | } |
111 | |
112 | if options[:daemon] |
113 | daemonize(options[:pid], &exec_server) |
114 | else |
115 | exec_server.call |
116 | end |