buffet 1.4.0 → 2.0.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.
- checksums.yaml +4 -4
- data/lib/buffet.rb +4 -0
- data/lib/buffet/master.rb +8 -5
- data/lib/buffet/settings.rb +13 -9
- data/lib/buffet/version.rb +1 -1
- data/support/buffet-worker +26 -41
- metadata +2 -3
- data/support/rspec1_formatter.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f02b2ed1bfb7014007bdd07bdac1f8442fe6a287
|
4
|
+
data.tar.gz: 7245321bb38868c5625850c07573741aed6b6cf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7381b1e6165c38da088f04a9284ebbd54552c88b1d95c7e7a6b6dfce043c8298bcf1d1f801b0ac805f630658d9d57341fd389cc98555d37a1f5827e0205675d
|
7
|
+
data.tar.gz: 83b6b8ba29a18431fc180d753c2fa5e1d22ea45379369a28a236c1466f6dd57c4b5d879381e7c2d07ffd1298d45402162cdbd878eeb09b09fef884c909474468
|
data/lib/buffet.rb
CHANGED
data/lib/buffet/master.rb
CHANGED
@@ -193,8 +193,11 @@ module Buffet
|
|
193
193
|
time = Benchmark.measure do
|
194
194
|
@project.sync_to slave
|
195
195
|
|
196
|
-
if Settings.
|
197
|
-
slave.execute_in_project
|
196
|
+
if Settings.prepare_command?
|
197
|
+
slave.execute_in_project [
|
198
|
+
Buffet.environment_to_shell_string(Settings.execution_environment),
|
199
|
+
Settings.prepare_command,
|
200
|
+
].join(' ')
|
198
201
|
end
|
199
202
|
|
200
203
|
# Copy support files so they can be run on the remote machine
|
@@ -208,12 +211,12 @@ module Buffet
|
|
208
211
|
|
209
212
|
def run_slave slave
|
210
213
|
time = Benchmark.measure do
|
211
|
-
slave.execute_in_project
|
214
|
+
slave.execute_in_project [
|
215
|
+
Buffet.environment_to_shell_string(Settings.execution_environment),
|
212
216
|
Settings.worker_command,
|
213
217
|
server_uri,
|
214
218
|
slave.user_at_host,
|
215
|
-
|
216
|
-
].join(' '))
|
219
|
+
].join(' ')
|
217
220
|
end.real
|
218
221
|
|
219
222
|
@lock.synchronize { @slaves_stats[slave.name][:test_time] = time }
|
data/lib/buffet/settings.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
3
|
module Buffet
|
4
|
+
# Stores configuration settings for Buffet.
|
4
5
|
class Settings
|
5
6
|
DEFAULT_LOG_FILE = 'buffet.log'
|
6
7
|
DEFAULT_SETTINGS_FILE = 'buffet.yml'
|
7
|
-
|
8
|
+
DEFAULT_PREPARE_COMMAND = 'bin/before-buffet-run'
|
8
9
|
DEFAULT_EXCLUDE_FILTER_FILE = '.buffet-exclude-filter'
|
9
10
|
|
10
11
|
class << self
|
@@ -36,6 +37,13 @@ module Buffet
|
|
36
37
|
self['worker_command'] || '.buffet/buffet-worker'
|
37
38
|
end
|
38
39
|
|
40
|
+
def execution_environment
|
41
|
+
{
|
42
|
+
'BUFFET_MASTER' => Buffet.user,
|
43
|
+
'BUFFET_PROJECT' => project.name,
|
44
|
+
}.merge(self['execution_environment'] || {})
|
45
|
+
end
|
46
|
+
|
39
47
|
def log_file=(log)
|
40
48
|
@log_file = log
|
41
49
|
end
|
@@ -52,16 +60,12 @@ module Buffet
|
|
52
60
|
@project ||= Project.new Dir.pwd
|
53
61
|
end
|
54
62
|
|
55
|
-
def
|
56
|
-
self['
|
57
|
-
end
|
58
|
-
|
59
|
-
def prepare_script
|
60
|
-
self['prepare_script'] || DEFAULT_PREPARE_SCRIPT
|
63
|
+
def prepare_command
|
64
|
+
self['prepare_command'] || DEFAULT_PREPARE_COMMAND
|
61
65
|
end
|
62
66
|
|
63
|
-
def
|
64
|
-
self['
|
67
|
+
def prepare_command?
|
68
|
+
self['prepare_command'] || File.exist?(DEFAULT_PREPARE_COMMAND)
|
65
69
|
end
|
66
70
|
|
67
71
|
def exclude_filter_file
|
data/lib/buffet/version.rb
CHANGED
data/support/buffet-worker
CHANGED
@@ -8,52 +8,37 @@ if File.exist? 'Gemfile'
|
|
8
8
|
require 'bundler/setup'
|
9
9
|
end
|
10
10
|
|
11
|
+
if ENV['BUFFET_MASTER'].to_s.strip.empty?
|
12
|
+
puts 'BUFFET_MASTER environment variable not defined'
|
13
|
+
exit 1
|
14
|
+
elsif ENV['BUFFET_PROJECT'].to_s.strip.empty?
|
15
|
+
puts 'BUFFET_MASTER environment variable not defined'
|
16
|
+
exit 1
|
17
|
+
end
|
18
|
+
|
11
19
|
# NOTE: ARGV is used by the spec runner. If I leave the drb server address
|
12
20
|
# in ARGV, rspec will think it's an argument to the test runner.
|
13
21
|
buffet_server = DRbObject.new_with_uri(ARGV.shift)
|
14
22
|
slave_name = ARGV.shift
|
15
|
-
framework = ARGV.shift
|
16
23
|
|
17
24
|
FileUtils.mkdir_p('./tmp')
|
18
25
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
)
|
38
|
-
end
|
39
|
-
else
|
40
|
-
require 'rspec'
|
41
|
-
require File.expand_path('rspec2_formatter', File.dirname(__FILE__))
|
42
|
-
|
43
|
-
begin
|
44
|
-
require 'ci/reporter/rspec'
|
45
|
-
use_ci_reporter = true
|
46
|
-
rescue LoadError
|
47
|
-
end
|
48
|
-
|
49
|
-
RSpec::Core::Formatters::AugmentedTextFormatter.configure buffet_server, slave_name
|
50
|
-
RSpec::Core::Runner.disable_autorun!
|
51
|
-
rspec_opts = ['--format', 'RSpec::Core::Formatters::AugmentedTextFormatter']
|
52
|
-
rspec_opts += ['--format', 'CI::Reporter::RSpec'] if use_ci_reporter
|
53
|
-
|
54
|
-
while file = buffet_server.next_file_for(slave_name, file)
|
55
|
-
RSpec::Core::CommandLine.new(rspec_opts.dup << file).
|
56
|
-
run($stderr, $stdout)
|
57
|
-
RSpec.world.example_groups.clear
|
58
|
-
end
|
26
|
+
require 'rspec'
|
27
|
+
require File.expand_path('rspec2_formatter', File.dirname(__FILE__))
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'ci/reporter/rspec'
|
31
|
+
use_ci_reporter = true
|
32
|
+
rescue LoadError
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::Formatters::AugmentedTextFormatter.configure buffet_server, slave_name
|
36
|
+
RSpec::Core::Runner.disable_autorun!
|
37
|
+
rspec_opts = ['--format', 'RSpec::Core::Formatters::AugmentedTextFormatter']
|
38
|
+
rspec_opts += ['--format', 'CI::Reporter::RSpec'] if use_ci_reporter
|
39
|
+
|
40
|
+
while file = buffet_server.next_file_for(slave_name, file)
|
41
|
+
RSpec::Core::CommandLine.new(rspec_opts.dup << file).
|
42
|
+
run($stderr, $stdout)
|
43
|
+
RSpec.world.example_groups.clear
|
59
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buffet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Causes Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -86,7 +86,6 @@ files:
|
|
86
86
|
- lib/buffet/slave.rb
|
87
87
|
- lib/buffet/version.rb
|
88
88
|
- support/buffet-worker
|
89
|
-
- support/rspec1_formatter.rb
|
90
89
|
- support/rspec2_formatter.rb
|
91
90
|
- bin/buffet
|
92
91
|
homepage: http://github.com/causes/buffet
|
data/support/rspec1_formatter.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec/runner/formatter/base_text_formatter'
|
2
|
-
|
3
|
-
module Spec
|
4
|
-
module Runner
|
5
|
-
module Formatter
|
6
|
-
class AugmentedTextFormatter < BaseTextFormatter
|
7
|
-
def self.configure buffet_server, slave_name
|
8
|
-
@@buffet_server = buffet_server
|
9
|
-
@@slave_name = slave_name
|
10
|
-
end
|
11
|
-
|
12
|
-
def example_passed example_proxy
|
13
|
-
super
|
14
|
-
@@buffet_server.example_passed(@@slave_name, {
|
15
|
-
:description => example_proxy.description,
|
16
|
-
:location => example_proxy.location,
|
17
|
-
:slave_name => @@slave_name,
|
18
|
-
})
|
19
|
-
end
|
20
|
-
|
21
|
-
def example_failed example_proxy, counter, failure
|
22
|
-
super
|
23
|
-
@@buffet_server.example_failed(@@slave_name, {
|
24
|
-
:backtrace => failure.exception.backtrace.join("\n"),
|
25
|
-
:description => failure.header,
|
26
|
-
:location => example_proxy.location,
|
27
|
-
:message => failure.exception.message,
|
28
|
-
:slave_name => @@slave_name,
|
29
|
-
})
|
30
|
-
end
|
31
|
-
|
32
|
-
def example_pending example, message, deprecated_pending_location=nil
|
33
|
-
super
|
34
|
-
@@buffet_server.example_pending(@@slave_name, {
|
35
|
-
:description => example.description,
|
36
|
-
:location => example.location,
|
37
|
-
:message => message,
|
38
|
-
:slave_name => @@slave_name,
|
39
|
-
})
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|