testbot 0.3.8 → 0.3.9.pre

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.
@@ -1,7 +1,11 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "/helpers/ruby_env"))
2
+
1
3
  class CucumberAdapter
2
4
 
3
- def self.command(ruby_interpreter, files)
4
- "export AUTOTEST=1; #{ruby_interpreter} script/cucumber -f progress --backtrace -r features/support -r features/step_definitions #{files} -t ~@disabled_in_cruise"
5
+ def self.command(project_path, ruby_interpreter, files)
6
+ cucumber_command = RubyEnv.ruby_command(project_path, :script => "script/cucumber", :bin => "cucumber",
7
+ :ruby_interpreter => ruby_interpreter)
8
+ "export AUTOTEST=1; #{ruby_interpreter} #{cucumber_command} -f progress --backtrace -r features/support -r features/step_definitions #{files} -t ~@disabled"
5
9
  end
6
10
 
7
11
  def self.test_files(dir)
@@ -0,0 +1,25 @@
1
+ class RubyEnv
2
+
3
+ def self.bundler?(project_path)
4
+ Gem.available?("bundler") && File.exists?("#{project_path}/Gemfile")
5
+ end
6
+
7
+ def self.ruby_command(project_path, opts = {})
8
+ ruby_interpeter = opts[:ruby_interpeter] || "ruby"
9
+
10
+ if File.exists?("#{project_path}/#{opts[:script]}")
11
+ command = opts[:script]
12
+ elsif opts[:bin]
13
+ command = opts[:bin]
14
+ else
15
+ command = ruby_interpeter
16
+ end
17
+
18
+ if bundler?(project_path)
19
+ "#{ruby_interpeter} -S bundle exec #{command}"
20
+ else
21
+ "#{ruby_interpeter} -S #{command}"
22
+ end
23
+ end
24
+
25
+ end
@@ -1,7 +1,11 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "/helpers/ruby_env"))
2
+
1
3
  class RSpecAdapter
2
4
 
3
- def self.command(ruby_interpreter, files)
4
- "export RSPEC_COLOR=true; #{ruby_interpreter} script/spec -O spec/spec.opts #{files}"
5
+ def self.command(project_path, ruby_interpreter, files)
6
+ spec_command = RubyEnv.ruby_command(project_path, :script => "script/spec", :bin => "rspec",
7
+ :ruby_interpreter => ruby_interpreter)
8
+ "export RSPEC_COLOR=true; #{spec_command} -O spec/spec.opts #{files}"
5
9
  end
6
10
 
7
11
  def self.test_files(dir)
@@ -1,7 +1,10 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "/helpers/ruby_env"))
2
+
1
3
  class TestUnitAdapter
2
4
 
3
- def self.command(ruby_interpreter, files)
4
- "#{ruby_interpreter} -Itest -e '%w(#{files}).each { |file| require(file) }'"
5
+ def self.command(project_path, ruby_interpreter, files)
6
+ ruby_command = RubyEnv.ruby_command(project_path, :ruby_interpreter => ruby_interpreter)
7
+ "#{ruby_command} -Itest -e '%w(#{files}).each { |file| require(file) }'"
5
8
  end
6
9
 
7
10
  def self.test_files(dir)
data/lib/runner.rb CHANGED
@@ -49,7 +49,7 @@ class Job
49
49
  base_environment = "export RAILS_ENV=test; export TEST_ENV_NUMBER=#{test_env_number}; cd #{@project};"
50
50
 
51
51
  adapter = Adapter.find(@type)
52
- result += `#{base_environment} #{adapter.command(ruby_cmd, @files)} 2>&1`
52
+ result += `#{base_environment} #{adapter.command(@project, ruby_cmd, @files)} 2>&1`
53
53
 
54
54
  Server.put("/jobs/#{@id}", :body => { :result => result, :success => ($?.exitstatus == 0) })
55
55
  puts "Job #{@id} finished."
@@ -169,8 +169,7 @@ class Runner
169
169
  end
170
170
 
171
171
  def before_run(job)
172
- use_bundler = File.exists?("#{job.project}/Gemfile") && system("which bundle > /dev/null")
173
- bundler_cmd = use_bundler ? "bundle; " : ""
172
+ bundler_cmd = RubyEnv.bundler?(job.project) ? "bundle; " : ""
174
173
  system "export RAILS_ENV=test; export TEST_INSTANCES=#{@config.max_instances}; cd #{job.project}; #{bundler_cmd} rake testbot:before_run"
175
174
  end
176
175
 
data/lib/testbot.rb CHANGED
@@ -8,7 +8,7 @@ unless defined?(Testbot)
8
8
  require 'railtie' if defined?(Rails)
9
9
 
10
10
  # Don't forget to update readme and changelog
11
- VERSION = "0.3.8"
11
+ VERSION = "0.3.9.pre"
12
12
 
13
13
  SERVER_PID = "/tmp/testbot_server.pid"
14
14
  RUNNER_PID = "/tmp/testbot_runner.pid"
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testbot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
5
- prerelease: false
4
+ hash: 961916024
5
+ prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 8
10
- version: 0.3.8
9
+ - 9
10
+ - pre
11
+ version: 0.3.9.pre
11
12
  platform: ruby
12
13
  authors:
13
14
  - "Joakim Kolsj\xC3\xB6"
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-12-01 00:00:00 +01:00
19
+ date: 2010-12-02 00:00:00 +01:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -173,6 +174,7 @@ extra_rdoc_files: []
173
174
  files:
174
175
  - lib/adapters/adapter.rb
175
176
  - lib/adapters/cucumber_adapter.rb
177
+ - lib/adapters/helpers/ruby_env.rb
176
178
  - lib/adapters/rspec_adapter.rb
177
179
  - lib/adapters/test_unit_adapter.rb
178
180
  - lib/generators/testbot/templates/testbot.rake.erb
@@ -218,12 +220,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
220
  required_rubygems_version: !ruby/object:Gem::Requirement
219
221
  none: false
220
222
  requirements:
221
- - - ">="
223
+ - - ">"
222
224
  - !ruby/object:Gem::Version
223
- hash: 3
225
+ hash: 25
224
226
  segments:
225
- - 0
226
- version: "0"
227
+ - 1
228
+ - 3
229
+ - 1
230
+ version: 1.3.1
227
231
  requirements: []
228
232
 
229
233
  rubyforge_project: