gorp 0.18.1 → 0.18.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{gorp}
5
- s.version = "0.18.1"
5
+ s.version = "0.18.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"]
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
16
16
  assertions based on selections (typically CSS) against the generated HTML.
17
17
  }
18
18
  s.email = %q{rubys@intertwingly.net}
19
- s.extra_rdoc_files = ["README", "lib/gorp.rb", "lib/gorp/commands.rb", "lib/gorp/edit.rb", "lib/gorp/env.rb", "lib/gorp/net.rb", "lib/gorp/output.rb", "lib/gorp/rails.env", "lib/gorp/rails.rb", "lib/gorp/test.rb", "lib/gorp/xml.rb", "lib/version.rb"]
20
- s.files = ["Manifest", "README", "Rakefile", "gorp.gemspec", "lib/gorp.rb", "lib/gorp/commands.rb", "lib/gorp/edit.rb", "lib/gorp/env.rb", "lib/gorp/net.rb", "lib/gorp/output.rb", "lib/gorp/rails.env", "lib/gorp/rails.rb", "lib/gorp/test.rb", "lib/gorp/xml.rb", "lib/version.rb"]
19
+ s.extra_rdoc_files = ["README", "lib/gorp.rb", "lib/gorp/commands.rb", "lib/gorp/edit.rb", "lib/gorp/env.rb", "lib/gorp/net.rb", "lib/gorp/output.css", "lib/gorp/output.rb", "lib/gorp/rails.env", "lib/gorp/rails.rb", "lib/gorp/test.rb", "lib/gorp/xml.rb", "lib/version.rb"]
20
+ s.files = ["Manifest", "README", "Rakefile", "gorp.gemspec", "lib/gorp.rb", "lib/gorp/commands.rb", "lib/gorp/edit.rb", "lib/gorp/env.rb", "lib/gorp/net.rb", "lib/gorp/output.css", "lib/gorp/output.rb", "lib/gorp/rails.env", "lib/gorp/rails.rb", "lib/gorp/test.rb", "lib/gorp/xml.rb", "lib/version.rb"]
21
21
  s.homepage = %q{http://github.com/rubys/gorp}
22
22
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Gorp", "--main", "README"]
23
23
  s.require_paths = ["lib"]
@@ -0,0 +1,26 @@
1
+ body {background-color: #F5F5DC}
2
+ #banner {margin-top: 0}
3
+ pre {font-weight: bold; margin: 0; padding: 0}
4
+ pre.stdin {color: #800080; margin-top: 1em; padding: 0}
5
+ pre.irb {color: #800080; padding: 0}
6
+ pre.stdout {color: #000; padding: 0}
7
+ pre.logger {color: #088; padding: 0}
8
+ pre.hilight {color: #000; background-color: #FF0; padding: 0}
9
+ pre.stderr {color: #F00; padding: 0}
10
+ div.body {border-style: solid; border-color: #800080; padding: 0.5em}
11
+ .issue, .traceback {background:#FDD; border: 4px solid #F00;
12
+ font-weight: bold; margin-top: 1em; padding: 0.5em}
13
+ div.body, .issue, .traceback {
14
+ -webkit-border-radius: 0.7em; -moz-border-radius: 0.7em;}
15
+ ul.toc {list-style: none}
16
+ ul a {text-decoration: none}
17
+ ul a:hover {text-decoration: underline; color: #000;
18
+ background-color: #F5F5DC}
19
+ a.toc h2 {background-color: #981A21; color:#FFF; padding: 6px}
20
+ ul a:visited {color: #000}
21
+ h2 {clear: both}
22
+ p.desc {font-style: italic}
23
+ p.overview {border-width: 2px; border-color: #000;
24
+ border-style: solid; border-radius: 4em;
25
+ background-color: #CCF; margin: 1.5em 1.5em; padding: 1em 2em;
26
+ -webkit-border-radius: 4em; -moz-border-radius: 4em;}
@@ -13,34 +13,9 @@ at_exit do
13
13
  $x.title $title
14
14
  $x.meta 'http-equiv'=>'text/html; charset=UTF-8'
15
15
  $x.style :type => "text/css" do
16
- $x.text! <<-'EOF'.gsub(/^ /, '')
17
- body {background-color: #F5F5DC}
18
- #banner {margin-top: 0}
19
- pre {font-weight: bold; margin: 0; padding: 0}
20
- pre.stdin {color: #800080; margin-top: 1em; padding: 0}
21
- pre.irb {color: #800080; padding: 0}
22
- pre.stdout {color: #000; padding: 0}
23
- pre.logger {color: #088; padding: 0}
24
- pre.hilight {color: #000; background-color: #FF0; padding: 0}
25
- pre.stderr {color: #F00; padding: 0}
26
- div.body {border-style: solid; border-color: #800080; padding: 0.5em}
27
- .issue, .traceback {background:#FDD; border: 4px solid #F00;
28
- font-weight: bold; margin-top: 1em; padding: 0.5em}
29
- div.body, .issue, .traceback {
30
- -webkit-border-radius: 0.7em; -moz-border-radius: 0.7em;}
31
- ul.toc {list-style: none}
32
- ul a {text-decoration: none}
33
- ul a:hover {text-decoration: underline; color: #000;
34
- background-color: #F5F5DC}
35
- a.toc h2 {background-color: #981A21; color:#FFF; padding: 6px}
36
- ul a:visited {color: #000}
37
- h2 {clear: both}
38
- p.desc {font-style: italic}
39
- p.overview {border-width: 2px; border-color: #000;
40
- border-style: solid; border-radius: 4em;
41
- background-color: #CCF; margin: 1.5em 1.5em; padding: 1em 2em;
42
- -webkit-border-radius: 4em; -moz-border-radius: 4em;}
43
- EOF
16
+ open(File.join(File.dirname(__FILE__), 'output.css')) do |file|
17
+ $x.text! file.read.gsub(/^/, ' ')
18
+ end
44
19
  end
45
20
  end
46
21
 
@@ -147,7 +147,7 @@ class Gorp::TestCase < ActiveSupport::TestCase
147
147
  @@base.send method, *args
148
148
 
149
149
  if block
150
- @raw = $x.target!
150
+ @raw = $y.target!
151
151
  @selected = HTML::Document.new(@raw).root.children
152
152
  block.call
153
153
  end
@@ -238,11 +238,21 @@ class HTMLRunner < Test::Unit::UI::Console::TestRunner
238
238
  sections.keys.sort_by {|key| key.split('.').map {|n| n.to_i}}.each do |n|
239
239
  output.write(sections[n])
240
240
  end
241
- output.write('<a class="toc" id="env">')
242
- output.write(env)
243
- output.write('<a class="toc" id="todos">')
244
- todos.sub! /<ul.*\/ul>/m, '<h2>None!</h2>' unless todos.include? '<li>'
245
- output.write(todos)
241
+
242
+ if sections.empty?
243
+ output.write($x.target!)
244
+ end
245
+
246
+ if env
247
+ output.write('<a class="toc" id="env">')
248
+ output.write(env)
249
+ end
250
+
251
+ if todos
252
+ output.write('<a class="toc" id="todos">')
253
+ todos.sub! /<ul.*\/ul>/m, '<h2>None!</h2>' unless todos.include? '<li>'
254
+ output.write(todos)
255
+ end
246
256
  output.write("\n </body>")
247
257
  output.write(tail)
248
258
  end
@@ -254,3 +264,23 @@ class HTMLRunner < Test::Unit::UI::Console::TestRunner
254
264
  at_exit { raise SystemExit.new(1) } unless @result.passed?
255
265
  end
256
266
  end
267
+
268
+ # Produce output for standalone scripts
269
+ at_exit do
270
+ next if caller.empty? or $output
271
+ source = File.basename(caller.first.split(/:/).first)
272
+ name = source.sub(Regexp.new(Regexp.escape(File.extname(source))+'$'), '')
273
+ $output = name
274
+
275
+ suite = Test::Unit::TestSuite.new(name)
276
+ ObjectSpace.each_object(Class) do |c|
277
+ next unless c.superclass == Gorp::TestCase
278
+ suite << c.suite
279
+ end
280
+ def suite.sections
281
+ style = open(File.join(File.dirname(__FILE__), 'output.css')) {|fh| fh.read}
282
+ head = "<head><title>#{$output}</title><style>\n#{style}</style></head>"
283
+ {:head=>"<html>\n#{head}\n ", :tail=>"\n</html>"}
284
+ end
285
+ HTMLRunner.run(suite)
286
+ end
@@ -2,7 +2,7 @@ module Gorp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 18
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.18.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
@@ -135,6 +135,7 @@ extra_rdoc_files:
135
135
  - lib/gorp/edit.rb
136
136
  - lib/gorp/env.rb
137
137
  - lib/gorp/net.rb
138
+ - lib/gorp/output.css
138
139
  - lib/gorp/output.rb
139
140
  - lib/gorp/rails.env
140
141
  - lib/gorp/rails.rb
@@ -151,6 +152,7 @@ files:
151
152
  - lib/gorp/edit.rb
152
153
  - lib/gorp/env.rb
153
154
  - lib/gorp/net.rb
155
+ - lib/gorp/output.css
154
156
  - lib/gorp/output.rb
155
157
  - lib/gorp/rails.env
156
158
  - lib/gorp/rails.rb