gorp 0.22.1 → 0.22.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{gorp}
5
- s.version = "0.22.1"
5
+ s.version = "0.22.2"
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"]
9
- s.date = %q{2010-01-09}
9
+ s.date = %q{2010-01-17}
10
10
  s.description = %q{ Enables the creation of scenarios that involve creating a rails project,
11
11
  starting and stoppping of servers, generating projects, editing files,
12
12
  issuing http requests, running of commands, etc. Output is captured as
@@ -35,3 +35,7 @@ if File.exist? vendor_rails
35
35
  end
36
36
  end
37
37
  end
38
+
39
+ module Gem
40
+ @loaded_stacks = Hash.new { |h,k| h[k] = [] }
41
+ end
@@ -141,7 +141,7 @@ module Gorp
141
141
  open('Gemfile','w') {|file| file.write gem}
142
142
  end
143
143
 
144
- cmd 'gem bundle'
144
+ cmd 'gem bundle --only default'
145
145
  else
146
146
  system 'mkdir -p vendor/gems'
147
147
  cmd "ln -s #{$rails} vendor/rails"
@@ -167,11 +167,17 @@ module Gorp
167
167
  end
168
168
 
169
169
  # stop a server if it is currently running
170
- def self.stop_server
171
- return unless $server
172
- Process.kill "INT", $server
173
- Process.wait($server)
174
- $server = nil
170
+ def self.stop_server(restart=false)
171
+ if !restart and $cleanup
172
+ $cleanup.call
173
+ $cleanup = nil
174
+ end
175
+
176
+ if $server
177
+ Process.kill "INT", $server
178
+ Process.wait($server)
179
+ $server = nil
180
+ end
175
181
  end
176
182
 
177
183
  # start/restart a rails server in a separate process
@@ -179,7 +185,7 @@ module Gorp
179
185
  if $server
180
186
  log :server, 'restart'
181
187
  $x.h3 'Restart the server.'
182
- Gorp::Commands.stop_server
188
+ Gorp::Commands.stop_server(true)
183
189
  else
184
190
  log :CMD, 'ruby script/server'
185
191
  $x.h3 'Start the server.'
@@ -177,6 +177,33 @@ class HTMLRunner < Test::Unit::UI::Console::TestRunner
177
177
  end
178
178
 
179
179
  def html_fault fault
180
+ if $standalone
181
+ puts fault
182
+ x = $x
183
+ else
184
+ x = Builder::XmlMarkup.new(:indent => 2)
185
+ end
186
+
187
+ tickets = {
188
+ 'rails' => 'https://rails.lighthouseapp.com/projects/8994/tickets/',
189
+ 'ruby' => 'http://redmine.ruby-lang.org/issues/show/'
190
+ }
191
+
192
+ if fault.respond_to? :location
193
+ x.pre fault.message.sub(".\n<false> is not true",'') +
194
+ "\n\nTraceback:\n " + fault.location.join("\n "),
195
+ :class=>'traceback'
196
+ else
197
+ if fault.message =~ /RuntimeError: Ticket (\w+):(\d+): (.*)/
198
+ x.p :class => 'traceback' do
199
+ x.a "Ticket #{$2}", :href => tickets[$1]+$2
200
+ x.text! ': ' + $3
201
+ end
202
+ else
203
+ x.pre fault.message, :class=>'traceback'
204
+ end
205
+ end
206
+
180
207
  if fault.test_name =~ /^test_([\d.]+)_.*\(\w+\)$/
181
208
  name = $1
182
209
  sections = @@sections
@@ -186,27 +213,7 @@ class HTMLRunner < Test::Unit::UI::Console::TestRunner
186
213
  sections[:contents][/<a href="#section-#{name}"()>/,1] =
187
214
  ' style="color:red; font-weight:bold"'
188
215
 
189
- tickets = {
190
- 'rails' => 'https://rails.lighthouseapp.com/projects/8994/tickets/',
191
- 'ruby' => 'http://redmine.ruby-lang.org/issues/show/'
192
- }
193
-
194
216
  # provide details in the section itself
195
- x = Builder::XmlMarkup.new(:indent => 2)
196
- if fault.respond_to? :location
197
- x.pre fault.message.sub(".\n<false> is not true",'') +
198
- "\n\nTraceback:\n " + fault.location.join("\n "),
199
- :class=>'traceback'
200
- else
201
- if fault.message =~ /RuntimeError: Ticket (\w+):(\d+): (.*)/
202
- x.p :class => 'traceback' do
203
- x.a "Ticket #{$2}", :href => tickets[$1]+$2
204
- x.text! ': ' + $3
205
- end
206
- else
207
- x.pre fault.message, :class=>'traceback'
208
- end
209
- end
210
217
  sections[name][/<\/a>()/,1] = x.target!
211
218
 
212
219
  # add to the todos
@@ -233,7 +240,6 @@ class HTMLRunner < Test::Unit::UI::Console::TestRunner
233
240
  def html_summary elapsed
234
241
  # terminate server
235
242
  Gorp::Commands.stop_server
236
- $cleanup.call if $cleanup
237
243
 
238
244
  open(File.join($WORK, "#{$output}.html"),'w') do |output|
239
245
  sections = @@sections
@@ -283,11 +289,14 @@ end
283
289
  # Produce output for standalone scripts
284
290
  at_exit do
285
291
  next if $output
292
+ $standalone = true
293
+
286
294
  if caller and !caller.empty?
287
295
  source = File.basename(caller.first.split(':').first)
288
296
  else
289
297
  source = File.basename($0).split('.').first
290
298
  end
299
+
291
300
  name = source.sub(Regexp.new(Regexp.escape(File.extname(source))+'$'), '')
292
301
  $output = name
293
302
 
@@ -2,7 +2,7 @@ module Gorp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 22
5
- TINY = 1
5
+ TINY = 2
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.22.1
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-09 00:00:00 -05:00
12
+ date: 2010-01-17 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency