gorp 0.20.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/gorp.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{gorp}
5
- s.version = "0.20.1"
5
+ s.version = "0.21.0"
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-05}
9
+ s.date = %q{2010-01-06}
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
data/lib/gorp/commands.rb CHANGED
@@ -28,8 +28,10 @@ module Gorp
28
28
  $style = Builder::XmlMarkup.new(:indent => 2)
29
29
 
30
30
  $semaphore = Mutex.new
31
- def $x.pre! *args
32
- $semaphore.synchronize { $x.pre *args }
31
+ class Builder::XmlMarkup
32
+ def pre! *args
33
+ $semaphore.synchronize { $x.pre *args }
34
+ end
33
35
  end
34
36
 
35
37
  def secsplit section
@@ -54,7 +56,7 @@ module Gorp
54
56
 
55
57
  def log type, message
56
58
  type = type.to_s.ljust(5).upcase
57
- STDOUT.puts Time.now.strftime("[%Y-%m-%d %H:%M:%S] #{type} #{message}")
59
+ $stdout.puts Time.now.strftime("[%Y-%m-%d %H:%M:%S] #{type} #{message}")
58
60
  end
59
61
 
60
62
  def head number, title
data/lib/gorp/env.rb CHANGED
@@ -24,3 +24,43 @@ require 'rbconfig'
24
24
  $ruby = File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"])
25
25
 
26
26
  FileUtils.mkdir_p $WORK
27
+
28
+ module Gorp
29
+ def self.dump_env
30
+ extend Commands
31
+ $x.pre Time.now.httpdate, :class=>'stdout'
32
+
33
+ cmd "#{$ruby} -v"
34
+ cmd 'gem -v'
35
+ Dir.chdir(File.join($WORK, $rails_app.to_s)) do
36
+ system 'pwd'
37
+ system 'ls vendor/gems/ruby/*/cache'
38
+ caches = Dir['vendor/gems/ruby/*/cache']
39
+ if caches.empty?
40
+ cmd 'gem list'
41
+ cmd 'echo $RUBYLIB | sed "s/:/\n/g"'
42
+ else
43
+ cmd 'gem list | grep "^bundler "'
44
+ caches.each {|cache| cmd "ls #{cache}"}
45
+ end
46
+ end
47
+
48
+ cmd Gorp.which_rails($rails) + ' -v'
49
+
50
+ if $rails != 'rails'
51
+ Dir.chdir($rails) do
52
+ log :cmd, 'git log -1'
53
+ $x.pre 'git log -1', :class=>'stdin'
54
+ `git log -1`.strip.split(/\n/).each do |line|
55
+ line.sub! /commit (\w{40})/,
56
+ 'commit <a href="http://github.com/rails/rails/commit/\1">\1</a>'
57
+ if $1
58
+ $x.pre(:class=>'stdout') {$x << line.chomp}
59
+ else
60
+ $x.pre line.chomp, :class=>'stdout'
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
data/lib/gorp/output.rb CHANGED
@@ -84,30 +84,7 @@ at_exit do
84
84
  end
85
85
 
86
86
  $x.a(:class => 'toc', :id => 'env') {$x.h2 'Environment'}
87
- $x.pre Time.now.httpdate, :class=>'stdout'
88
-
89
- cmd "#{$ruby} -v"
90
- cmd 'gem -v'
91
- cmd 'gem list'
92
- cmd 'echo $RUBYLIB | sed "s/:/\n/g"'
93
-
94
- cmd Gorp.which_rails($rails) + ' -v'
95
-
96
- if $rails != 'rails'
97
- Dir.chdir($rails) do
98
- log :cmd, 'git log -1'
99
- $x.pre 'git log -1', :class=>'stdin'
100
- `git log -1`.strip.split(/\n/).each do |line|
101
- line.sub! /commit (\w{40})/,
102
- 'commit <a href="http://github.com/rails/rails/commit/\1">\1</a>'
103
- if $1
104
- $x.pre(:class=>'stdout') {$x << line.chomp}
105
- else
106
- $x.pre line.chomp, :class=>'stdout'
107
- end
108
- end
109
- end
110
- end
87
+ Gorp.dump_env
111
88
 
112
89
  $x.a(:class => 'toc', :id => 'todos') {$x.h2 'Todos'}
113
90
  $x.ul :class => 'todos'
data/lib/gorp/rails.rb CHANGED
@@ -153,6 +153,8 @@ module Gorp
153
153
  system "ln -s #{$rails} vendor/rails"
154
154
  end
155
155
  end
156
+
157
+ $rails_app = name
156
158
  end
157
159
 
158
160
  # start/restart a rails server in a separate process
data/lib/gorp/test.rb CHANGED
@@ -265,6 +265,13 @@ class HTMLRunner < Test::Unit::UI::Console::TestRunner
265
265
  if env
266
266
  output.write('<a class="toc" id="env">')
267
267
  output.write(env)
268
+ else
269
+ $x = Builder::XmlMarkup.new(:indent => 2)
270
+ $x.a(:class => 'toc', :id => 'env') {$x.h2 'Environment'}
271
+ $stdout = StringIO.open('','w')
272
+ Gorp.dump_env
273
+ $stdout = STDOUT
274
+ output.write($x.target!)
268
275
  end
269
276
 
270
277
  if todos
data/lib/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Gorp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 20
5
- TINY = 1
4
+ MINOR = 21
5
+ TINY = 0
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.20.1
4
+ version: 0.21.0
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-05 00:00:00 -05:00
12
+ date: 2010-01-06 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency