gorp 0.18.4 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -20,6 +20,7 @@ Echoe.new('gorp', Gorp::VERSION::STRING) do |p|
20
20
  p.email = "rubys@intertwingly.net"
21
21
  p.dependencies = %w(
22
22
  builder
23
+ bundler
23
24
  erubis
24
25
  i18n
25
26
  mail
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.18.4"
5
+ s.version = "0.19.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-02}
9
+ s.date = %q{2010-01-05}
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
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
 
32
32
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
33
33
  s.add_runtime_dependency(%q<builder>, [">= 0"])
34
+ s.add_runtime_dependency(%q<bundler>, [">= 0"])
34
35
  s.add_runtime_dependency(%q<erubis>, [">= 0"])
35
36
  s.add_runtime_dependency(%q<i18n>, [">= 0"])
36
37
  s.add_runtime_dependency(%q<mail>, [">= 0"])
@@ -43,6 +44,7 @@ Gem::Specification.new do |s|
43
44
  s.add_runtime_dependency(%q<tzinfo>, [">= 0"])
44
45
  else
45
46
  s.add_dependency(%q<builder>, [">= 0"])
47
+ s.add_dependency(%q<bundler>, [">= 0"])
46
48
  s.add_dependency(%q<erubis>, [">= 0"])
47
49
  s.add_dependency(%q<i18n>, [">= 0"])
48
50
  s.add_dependency(%q<mail>, [">= 0"])
@@ -56,6 +58,7 @@ Gem::Specification.new do |s|
56
58
  end
57
59
  else
58
60
  s.add_dependency(%q<builder>, [">= 0"])
61
+ s.add_dependency(%q<bundler>, [">= 0"])
59
62
  s.add_dependency(%q<erubis>, [">= 0"])
60
63
  s.add_dependency(%q<i18n>, [">= 0"])
61
64
  s.add_dependency(%q<mail>, [">= 0"])
data/lib/gorp/commands.rb CHANGED
@@ -27,6 +27,11 @@ module Gorp
27
27
  $issue = 0
28
28
  $style = Builder::XmlMarkup.new(:indent => 2)
29
29
 
30
+ $semaphore = Mutex.new
31
+ def $x.pre! *args
32
+ $semaphore.synchronize { $x.pre *args }
33
+ end
34
+
30
35
  def secsplit section
31
36
  section.to_s.split('.').map {|n| n.to_i}
32
37
  end
@@ -122,7 +127,7 @@ module Gorp
122
127
  def popen3 args, hilight=[]
123
128
  Open3.popen3(args) do |pin, pout, perr|
124
129
  terr = Thread.new do
125
- $x.pre perr.readline.chomp, :class=>'stderr' until perr.eof?
130
+ $x.pre! perr.readline.chomp, :class=>'stderr' until perr.eof?
126
131
  end
127
132
  pin.close
128
133
  until pout.eof?
@@ -137,9 +142,9 @@ module Gorp
137
142
  end
138
143
 
139
144
  if line.strip.size == 0
140
- $x.pre ' ', :class=>outclass
145
+ $x.pre! ' ', :class=>outclass
141
146
  else
142
- $x.pre line.chomp, :class=>outclass
147
+ $x.pre! line.chomp, :class=>outclass
143
148
  end
144
149
  end
145
150
  terr.join
@@ -158,7 +163,7 @@ module Gorp
158
163
  line.gsub! /\x1b\[4(;\d+)*m(.*?)\x1b\[0m/, '\2'
159
164
  line.gsub! /\x1b\[0(;\d+)*m(.*?)\x1b\[0m/, '\2'
160
165
  line.gsub! /\x1b\[0(;\d+)*m/, ''
161
- $x.pre line, :class=>'stderr'
166
+ $x.pre! line, :class=>'stderr'
162
167
  end
163
168
  end
164
169
  pin.close
@@ -168,18 +173,18 @@ module Gorp
168
173
  if line =~ /^([?>]>)\s*#\s*(START|END):/
169
174
  prompt = $1
170
175
  elsif line =~ /^([?>]>)\s+$/
171
- $x.pre ' ', :class=>'irb'
176
+ $x.pre! ' ', :class=>'irb'
172
177
  prompt ||= $1
173
178
  elsif line =~ /^([?>]>)(.*)\n/
174
179
  prompt ||= $1
175
180
  $x.pre prompt + $2, :class=>'irb'
176
181
  prompt = nil
177
182
  elsif line =~ /^\w+(::\w+)*: /
178
- $x.pre line.chomp, :class=>'stderr'
183
+ $x.pre! line.chomp, :class=>'stderr'
179
184
  elsif line =~ /^\s+from [\/.:].*:\d+:in `\w.*'\s*$/
180
- $x.pre line.chomp, :class=>'stderr'
185
+ $x.pre! line.chomp, :class=>'stderr'
181
186
  else
182
- $x.pre line.chomp, :class=>'stdout'
187
+ $x.pre! line.chomp, :class=>'stdout'
183
188
  end
184
189
  end
185
190
  terr.join
data/lib/gorp/edit.rb CHANGED
@@ -60,7 +60,7 @@ module Gorp
60
60
  end
61
61
 
62
62
  def dcl(name, *options)
63
- re = Regexp.new '\n(\s*)(class|def|test)\s+"?' + name +
63
+ re = Regexp.new '^(\s*)(class|def|test)\s+"?' + name +
64
64
  '"?.*?\n\1end\n', Regexp::MULTILINE
65
65
  raise IndexError.new('regexp not matched') unless match(re)
66
66
 
data/lib/gorp/rails.rb CHANGED
@@ -13,10 +13,31 @@ end
13
13
  # select a version of Rails
14
14
  if ARGV.first =~ /^_\d[.\d]*_$/
15
15
  $rails = "rails #{ARGV.first}"
16
- elsif File.directory?(ARGV.first.to_s)
17
- $rails = ARGV.first
18
- $rails = File.join($rails,'rails') if
19
- File.directory?(File.join($rails,'rails'))
16
+ elsif File.directory?(ARGV.first.split(File::PATH_SEPARATOR).first)
17
+ if ARGV.first.include?(File::PATH_SEPARATOR)
18
+ # first path is Rails, additional paths are added to the RUBYLIBS
19
+ libs = ENV['RUBYLIBS'].to_s.split(File::PATH_SEPARATOR)
20
+ ARGV.first.split(File::PATH_SEPARATOR).reverse.each do |lib|
21
+ lib = File.expand_path(lib)
22
+ if !File.directory?(lib)
23
+ STDERR.puts "No such library: #{lib.inspect}"
24
+ exit
25
+ elsif File.directory?(File.join(lib,'lib'))
26
+ libs.unshift File.join(lib,'lib')
27
+ else
28
+ libs.unshift lib
29
+ end
30
+ end
31
+ $rails = libs.shift
32
+ ENV['RUBYLIBS'] = libs.join(File::PATH_SEPARATOR)
33
+ else
34
+ $rails = ARGV.first
35
+ end
36
+
37
+ if File.directory?(File.join($rails,'rails'))
38
+ $rails = File.join($rails,'rails')
39
+ end
40
+
20
41
  $rails = File.expand_path($rails)
21
42
  else
22
43
  $rails = 'rails'
@@ -91,7 +112,7 @@ module Gorp
91
112
  if $rails != 'rails' and File.directory?($rails)
92
113
  if File.exist? 'Gemfile'
93
114
  if $bundle
94
- if ENV['RUBYLIB']
115
+ if ENV['RUBYLIB'] or ARGV.include?('system')
95
116
  gem=open('Gemfile') {|file| file.read}
96
117
 
97
118
  gem.sub! /gem "rails", :path => "(.*)"/ do
@@ -101,9 +122,19 @@ module Gorp
101
122
  eval(file.read.gsub(/\s*(module|end).*\n/, '').downcase)
102
123
  end
103
124
 
104
- ENV['RUBYLIB'].split(File::PATH_SEPARATOR).each do |lib|
105
- rails << "directory #{lib.sub(/\/lib$/,'').inspect}\n"
125
+ if ARGV.include?('system')
126
+ rails = <<-EOF.gsub(/^\s+/,'') + rails
127
+ @environment.clear_sources
128
+ @environment.add_source SystemGemSource.instance
129
+ EOF
106
130
  end
131
+
132
+ if ENV['RUBYLIB']
133
+ ENV['RUBYLIB'].split(File::PATH_SEPARATOR).each do |lib|
134
+ rails << "directory #{lib.sub(/\/lib$/,'').inspect}\n"
135
+ end
136
+ end
137
+
107
138
  rails + "gem \"rails\", #{version.inspect}"
108
139
  end
109
140
 
data/lib/gorp/test.rb CHANGED
@@ -39,6 +39,13 @@ module Gorp
39
39
  @one.method_missing sym, *args, &block
40
40
  @two.method_missing sym, *args, &block
41
41
  end
42
+
43
+ def pre! *args
44
+ $semaphore.synchronize do
45
+ @one.pre *args
46
+ @two.pre *args
47
+ end
48
+ end
42
49
  end
43
50
  end
44
51
 
data/lib/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Gorp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 18
5
- TINY = 4
4
+ MINOR = 19
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.18.4
4
+ version: 0.19.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-02 00:00:00 -05:00
12
+ date: 2010-01-05 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,16 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: erubis
27
37
  type: :runtime