testbot 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.6
2
+
3
+ Fixed a bug that caused auto_update not to check for an update after a job had been run.
4
+
1
5
  0.4.5
2
6
 
3
7
  Made auto_update a bit more reliable.
@@ -68,7 +68,7 @@ Using testbot with Rails 3:
68
68
 
69
69
  Using testbot with Rails 2:
70
70
 
71
- ruby script/plugin install git://github.com/joakimk/testbot.git -r 'refs/tags/v0.4.5'
71
+ ruby script/plugin install git://github.com/joakimk/testbot.git -r 'refs/tags/v0.4.6'
72
72
  script/generate testbot --connect 192.168.0.100
73
73
 
74
74
  rake testbot:spec (or :test, :features)
@@ -4,6 +4,7 @@ require 'macaddr'
4
4
  require 'ostruct'
5
5
  require File.dirname(__FILE__) + '/shared/ssh_tunnel'
6
6
  require File.dirname(__FILE__) + '/adapters/adapter'
7
+ require File.dirname(__FILE__) + '/runner/job'
7
8
 
8
9
  TIME_BETWEEN_NORMAL_POLLS = 1
9
10
  TIME_BETWEEN_QUICK_POLLS = 0.1
@@ -30,42 +31,6 @@ class CPU
30
31
 
31
32
  end
32
33
 
33
- class Job
34
- attr_reader :root, :project, :requester_mac
35
-
36
- def initialize(runner, id, requester_mac, project, root, type, ruby_interpreter, files)
37
- @runner, @id, @requester_mac, @project, @root, @type, @ruby_interpreter, @files =
38
- runner, id, requester_mac, project, root, type, ruby_interpreter, files
39
- end
40
-
41
- def jruby?
42
- @ruby_interpreter == 'jruby'
43
- end
44
-
45
- def run(instance)
46
- puts "Running job #{@id} from #{@requester_mac}... "
47
- test_env_number = (instance == 0) ? '' : instance + 1
48
- result = "\n#{`hostname`.chomp}:#{Dir.pwd}\n"
49
- base_environment = "export RAILS_ENV=test; export TEST_ENV_NUMBER=#{test_env_number}; cd #{@project};"
50
-
51
- adapter = Adapter.find(@type)
52
- result += `#{base_environment} #{adapter.command(@project, ruby_cmd, @files)} 2>&1`
53
-
54
- Server.put("/jobs/#{@id}", :body => { :result => result, :success => ($?.exitstatus == 0) })
55
- puts "Job #{@id} finished."
56
- end
57
-
58
- private
59
-
60
- def ruby_cmd
61
- if @ruby_interpreter == 'jruby' && @runner.config.jruby_opts
62
- 'jruby ' + @runner.config.jruby_opts
63
- else
64
- @ruby_interpreter
65
- end
66
- end
67
- end
68
-
69
34
  class Server
70
35
  include HTTParty
71
36
  end
@@ -140,8 +105,8 @@ class Runner
140
105
  next unless cpu_available?
141
106
 
142
107
  next_job = Server.get("/jobs/next", :query => next_params) rescue nil
143
- next if next_job == nil
144
- last_check_found_a_job = true
108
+ last_check_found_a_job = (next_job != nil)
109
+ next unless last_check_found_a_job
145
110
 
146
111
  job = Job.new(*([ self, next_job.split(',') ].flatten))
147
112
  if first_job_from_requester?
@@ -0,0 +1,36 @@
1
+ class Job
2
+ attr_reader :root, :project, :requester_mac
3
+
4
+ def initialize(runner, id, requester_mac, project, root, type, ruby_interpreter, files)
5
+ @runner, @id, @requester_mac, @project, @root, @type, @ruby_interpreter, @files =
6
+ runner, id, requester_mac, project, root, type, ruby_interpreter, files
7
+ end
8
+
9
+ def jruby?
10
+ @ruby_interpreter == 'jruby'
11
+ end
12
+
13
+ def run(instance)
14
+ puts "Running job #{@id} from #{@requester_mac}... "
15
+ test_env_number = (instance == 0) ? '' : instance + 1
16
+ result = "\n#{`hostname`.chomp}:#{Dir.pwd}\n"
17
+ base_environment = "export RAILS_ENV=test; export TEST_ENV_NUMBER=#{test_env_number}; cd #{@project};"
18
+
19
+ adapter = Adapter.find(@type)
20
+ result += `#{base_environment} #{adapter.command(@project, ruby_cmd, @files)} 2>&1`
21
+
22
+ Server.put("/jobs/#{@id}", :body => { :result => result, :success => ($?.exitstatus == 0) })
23
+ puts "Job #{@id} finished."
24
+ end
25
+
26
+ private
27
+
28
+ def ruby_cmd
29
+ if @ruby_interpreter == 'jruby' && @runner.config.jruby_opts
30
+ 'jruby ' + @runner.config.jruby_opts
31
+ else
32
+ @ruby_interpreter
33
+ end
34
+ end
35
+ end
36
+
@@ -9,7 +9,7 @@ unless defined?(Testbot)
9
9
 
10
10
  # Don't forget to update readme and changelog
11
11
  def self.version
12
- version = "0.4.5"
12
+ version = "0.4.6"
13
13
  dev_version_file = File.join(File.dirname(__FILE__), '..', 'DEV_VERSION')
14
14
  if File.exists?(dev_version_file)
15
15
  version += File.read(dev_version_file)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testbot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 5
10
- version: 0.4.5
9
+ - 6
10
+ version: 0.4.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Joakim Kolsj\xC3\xB6"
@@ -198,6 +198,7 @@ files:
198
198
  - lib/new_runner.rb
199
199
  - lib/railtie.rb
200
200
  - lib/requester.rb
201
+ - lib/runner/job.rb
201
202
  - lib/runner.rb
202
203
  - lib/server/build.rb
203
204
  - lib/server/db.rb