borg 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/TODO ADDED
@@ -0,0 +1,5 @@
1
+ Features to implement
2
+ 1. Ensure that same SHA is checked out everywhere.
3
+ 2. Two builds of the same project, should not be running parallely.
4
+ 3. Number of processes in a worker, should be decided dynamically.
5
+ 4. Track build times and ensure that failed builds run first.
data/VERSION CHANGED
@@ -1 +1,2 @@
1
- 0.0.6
1
+ 0.0.7
2
+
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{borg}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Hemant Kumar", "Karunakar"]
@@ -14,7 +14,8 @@ Gem::Specification.new do |s|
14
14
  s.email = %q{hkumar@crri.co.in}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.rdoc",
18
+ "TODO"
18
19
  ]
19
20
  s.files = [
20
21
  ".document",
@@ -23,6 +24,7 @@ Gem::Specification.new do |s|
23
24
  "LICENSE.txt",
24
25
  "README.rdoc",
25
26
  "Rakefile",
27
+ "TODO",
26
28
  "VERSION",
27
29
  "borg.gemspec",
28
30
  "lib/borg.rb",
@@ -1,5 +1,4 @@
1
1
  module Borg
2
- VERSION = "0.0.1"
3
2
  require 'borg/railtie'
4
3
  end
5
4
 
@@ -109,14 +109,14 @@ module Borg
109
109
  files.each { |x| redis.rpush(key, x.join(",")) }
110
110
  end
111
111
 
112
- def remove_file_groups_from_redis(key,&block)
112
+ def remove_file_groups_from_redis(key,process_count,&block)
113
113
  redis_has_files = true
114
114
  @redis_connection = redis
115
115
  all_status = []
116
116
 
117
117
  loop do
118
118
  local_pids = []
119
- n.times do |index|
119
+ process_count.times do |index|
120
120
  test_files = @redis_connection.rpop(key)
121
121
  if(test_files)
122
122
  local_pids << Process.fork { block.call(index,test_files) }
@@ -6,7 +6,7 @@ module Borg
6
6
  redirect_stdout()
7
7
  load_environment('cucumber')
8
8
 
9
- remove_file_groups_from_redis('cucumber') do |index,feature_files|
9
+ remove_file_groups_from_redis('cucumber',n) do |index,feature_files|
10
10
  prepare_databse(index) unless try_migration_first(index)
11
11
  full_feature_path = feature_files.split(',').map do |fl|
12
12
  Rails.root.to_s + fl
@@ -12,17 +12,8 @@ module Borg
12
12
 
13
13
  def update(worker)
14
14
  FileUtils.cd(Rails.root) do
15
- #update_command = "git reset --hard HEAD && git fetch && git rebase origin/#{current_branch} && git submodule init && git submodule update && bundle install --local"
16
-
17
- update_command = "bundle install --local"
18
- puts "Update command is #{update_command}"
19
- EM.popen(update_command,TestRunner) do |process|
20
- process.worker = worker
21
- process.runner_type = 'git'
22
- end
23
-
15
+ @status = system("git reset --hard HEAD && git fetch && git rebase origin/#{current_branch} && git submodule init && git submodule update && bundle install --local")
24
16
  end
25
-
26
17
  end
27
18
 
28
19
  end
@@ -5,7 +5,7 @@ module Borg
5
5
  def run(n = 3)
6
6
  redirect_stdout()
7
7
  load_environment('test')
8
- remove_file_groups_from_redis('tests') do |index,test_files|
8
+ remove_file_groups_from_redis('tests',n) do |index,test_files|
9
9
  prepare_databse(index) unless try_migration_first(index)
10
10
  test_files.split(',').each do |fl|
11
11
  load(Rails.root.to_s + fl)
@@ -24,25 +24,21 @@ module Borg
24
24
 
25
25
  def update_code
26
26
  source_control = Borg::Git.new()
27
- source_control.update(self)
28
- end
29
-
30
- def redis
31
- Redis.new(:host => Borg::Config.redis_ip,:port => Borg::Config.redis_port)
32
- end
33
-
34
- def code_updated(last_status)
35
- if(last_status.exit_status == 0)
27
+ source_control.update()
28
+ if(source_control.status)
36
29
  start_test
37
30
  else
38
- puts "sending error report"
39
31
  send_object(BuildStatus.new(1))
40
32
  end
41
33
  end
34
+
35
+ def redis
36
+ Redis.new(:host => Borg::Config.redis_ip,:port => Borg::Config.redis_port)
37
+ end
42
38
 
43
39
  def start_test
44
40
  if(redis.llen("tests") > 0)
45
- EM.popen("rake tickle:test RAILS_ENV=test", TestRunner) do |process|
41
+ EM.popen("rake borg:test RAILS_ENV=test", TestRunner) do |process|
46
42
  process.worker = self
47
43
  process.runner_type = 'unit'
48
44
  end
@@ -54,7 +50,7 @@ module Borg
54
50
  def start_cucumber(last_status)
55
51
  @@status_reports << last_status
56
52
  if(redis.llen("cucumber") > 0)
57
- EM.popen("rake tickle:cucumber RAILS_ENV=cucumber",TestRunner) do |process|
53
+ EM.popen("rake borg:cucumber RAILS_ENV=cucumber",TestRunner) do |process|
58
54
  process.worker = self
59
55
  process.runner_type = 'cucumber'
60
56
  end
@@ -88,11 +84,8 @@ module Borg
88
84
 
89
85
  def unbind
90
86
  puts "Sending the status thingy"
91
- case runner_type
92
- when 'unit'
87
+ if(runner_type == 'unit')
93
88
  worker.start_cucumber(BuildStatus.new(get_status.exitstatus))
94
- when 'git'
95
- worker.code_updated(BuildStatus.new(get_status.exitstatus))
96
89
  else
97
90
  worker.send_final_report(BuildStatus.new(get_status.exitstatus))
98
91
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: borg
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Hemant Kumar
@@ -102,6 +102,7 @@ extensions: []
102
102
  extra_rdoc_files:
103
103
  - LICENSE.txt
104
104
  - README.rdoc
105
+ - TODO
105
106
  files:
106
107
  - .document
107
108
  - Gemfile
@@ -109,6 +110,7 @@ files:
109
110
  - LICENSE.txt
110
111
  - README.rdoc
111
112
  - Rakefile
113
+ - TODO
112
114
  - VERSION
113
115
  - borg.gemspec
114
116
  - lib/borg.rb