gorp 0.21.0 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- data/gorp.gemspec +1 -1
- data/lib/gorp/env.rb +0 -2
- data/lib/gorp/output.rb +1 -2
- data/lib/gorp/rails.rb +9 -2
- data/lib/gorp/test.rb +16 -4
- data/lib/version.rb +1 -1
- metadata +1 -1
data/gorp.gemspec
CHANGED
data/lib/gorp/env.rb
CHANGED
data/lib/gorp/output.rb
CHANGED
data/lib/gorp/rails.rb
CHANGED
@@ -157,13 +157,20 @@ module Gorp
|
|
157
157
|
$rails_app = name
|
158
158
|
end
|
159
159
|
|
160
|
+
# stop a server if it is currently running
|
161
|
+
def self.stop_server
|
162
|
+
return unless $server
|
163
|
+
Process.kill "INT", $server
|
164
|
+
Process.wait($server)
|
165
|
+
$server = nil
|
166
|
+
end
|
167
|
+
|
160
168
|
# start/restart a rails server in a separate process
|
161
169
|
def restart_server
|
162
170
|
log :server, 'restart'
|
163
171
|
if $server
|
164
172
|
$x.h3 'Restart the server.'
|
165
|
-
|
166
|
-
Process.wait($server)
|
173
|
+
Gorp::Commands.stop_server
|
167
174
|
else
|
168
175
|
$x.h3 'Start the server.'
|
169
176
|
end
|
data/lib/gorp/test.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'builder'
|
3
3
|
require 'gorp/env'
|
4
|
-
require 'gorp/edit'
|
5
4
|
require 'gorp/rails'
|
6
5
|
require 'gorp/commands'
|
7
6
|
|
@@ -13,8 +12,13 @@ module Gorp
|
|
13
12
|
end
|
14
13
|
|
15
14
|
def method_missing sym, *args, &block
|
16
|
-
|
17
|
-
|
15
|
+
if sym == :<<
|
16
|
+
@one << args.first
|
17
|
+
@two << args.first
|
18
|
+
else
|
19
|
+
@one.method_missing sym, *args, &block
|
20
|
+
@two.method_missing sym, *args, &block
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
def pre! *args
|
@@ -158,7 +162,7 @@ class Gorp::TestCase < Test::Unit::TestCase
|
|
158
162
|
@@base = Object.new.extend(Gorp::Commands)
|
159
163
|
include Gorp::Commands
|
160
164
|
|
161
|
-
%w(cmd
|
165
|
+
%w(cmd post rake ruby).each do |method|
|
162
166
|
define_method(method) do |*args, &block|
|
163
167
|
begin
|
164
168
|
$y = Builder::XmlMarkup.new(:indent => 2)
|
@@ -246,6 +250,9 @@ class HTMLRunner < Test::Unit::UI::Console::TestRunner
|
|
246
250
|
end
|
247
251
|
|
248
252
|
def html_summary elapsed
|
253
|
+
# terminate server
|
254
|
+
at_exit { Gorp::Commands.stop_server }
|
255
|
+
|
249
256
|
open(File.join($WORK, "#{$output}.html"),'w') do |output|
|
250
257
|
sections = @@sections
|
251
258
|
output.write(sections.delete(:head))
|
@@ -303,10 +310,15 @@ at_exit do
|
|
303
310
|
next unless c.superclass == Gorp::TestCase
|
304
311
|
suite << c.suite
|
305
312
|
end
|
313
|
+
|
306
314
|
def suite.sections
|
307
315
|
style = open(File.join(File.dirname(__FILE__), 'output.css')) {|fh| fh.read}
|
308
316
|
head = "<head><title>#{$output}</title><style>\n#{style}</style></head>"
|
309
317
|
{:head=>"<html>\n#{head}\n ", :tail=>"\n</html>"}
|
310
318
|
end
|
319
|
+
|
320
|
+
require 'gorp/xml'
|
321
|
+
require 'gorp/edit'
|
322
|
+
require 'gorp/net'
|
311
323
|
HTMLRunner.run(suite)
|
312
324
|
end
|
data/lib/version.rb
CHANGED