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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{gorp}
5
- s.version = "0.21.0"
5
+ s.version = "0.21.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sam Ruby"]
data/lib/gorp/env.rb CHANGED
@@ -33,8 +33,6 @@ module Gorp
33
33
  cmd "#{$ruby} -v"
34
34
  cmd 'gem -v'
35
35
  Dir.chdir(File.join($WORK, $rails_app.to_s)) do
36
- system 'pwd'
37
- system 'ls vendor/gems/ruby/*/cache'
38
36
  caches = Dir['vendor/gems/ruby/*/cache']
39
37
  if caches.empty?
40
38
  cmd 'gem list'
data/lib/gorp/output.rb CHANGED
@@ -70,8 +70,7 @@ at_exit do
70
70
  $cleanup.call if $cleanup
71
71
 
72
72
  # terminate server
73
- Process.kill "INT", $server if $server
74
- Process.wait($server) if $server
73
+ Gorp::Commands.stop_server
75
74
 
76
75
  # optionally save a snapshot
77
76
  if ARGV.include? 'save'
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
- Process.kill "INT", $server
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
- @one.method_missing sym, *args, &block
17
- @two.method_missing sym, *args, &block
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 get post rake ruby).each do |method|
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
@@ -2,7 +2,7 @@ module Gorp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 21
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby