buffet 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f749e08d06d602c95a40b3d300700085f6e5337a
4
- data.tar.gz: c62257f134284331b7d5250862ec7b13be565f7b
3
+ metadata.gz: f02b2ed1bfb7014007bdd07bdac1f8442fe6a287
4
+ data.tar.gz: 7245321bb38868c5625850c07573741aed6b6cf0
5
5
  SHA512:
6
- metadata.gz: 44917fa9c57e03024ccaf0893c1d3ec834f64e894a0beb52043a7f25f001e97354f6b3a13e8803897812006f05468172d4e74082d1ceef6e495ef0e1509577d0
7
- data.tar.gz: f87ef20ffdcd0d6074b276d46863774f3a6c94b7e56d8d5aa0ae39e34c61e96ad6c47387898e866b5934edf3ad78cb61ad4c1f053baf75276c83aa38d6ab1bd7
6
+ metadata.gz: e7381b1e6165c38da088f04a9284ebbd54552c88b1d95c7e7a6b6dfce043c8298bcf1d1f801b0ac805f630658d9d57341fd389cc98555d37a1f5827e0205675d
7
+ data.tar.gz: 83b6b8ba29a18431fc180d753c2fa5e1d22ea45379369a28a236c1466f6dd57c4b5d879381e7c2d07ffd1298d45402162cdbd878eeb09b09fef884c909474468
data/lib/buffet.rb CHANGED
@@ -54,6 +54,10 @@ module Buffet
54
54
  specs.uniq
55
55
  end
56
56
 
57
+ def self.environment_to_shell_string(env)
58
+ env.map { |key, value| "#{key}=#{value}" }.join(' ')
59
+ end
60
+
57
61
  def self.workspace_dir
58
62
  ".buffet/workspaces/#{user}" # Relative to home directory
59
63
  end
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.has_prepare_script?
197
- slave.execute_in_project "#{Settings.prepare_script} #{Buffet.user} #{@project.name}"
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
- Settings.framework,
216
- ].join(' '))
219
+ ].join(' ')
217
220
  end.real
218
221
 
219
222
  @lock.synchronize { @slaves_stats[slave.name][:test_time] = time }
@@ -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
- DEFAULT_PREPARE_SCRIPT = 'bin/before-buffet-run'
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 framework
56
- self['framework'].upcase || 'RSPEC1'
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 has_prepare_script?
64
- self['prepare_script'] || File.exist?(DEFAULT_PREPARE_SCRIPT)
67
+ def prepare_command?
68
+ self['prepare_command'] || File.exist?(DEFAULT_PREPARE_COMMAND)
65
69
  end
66
70
 
67
71
  def exclude_filter_file
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module Buffet
3
- VERSION = '1.4.0'
3
+ VERSION = '2.0.0'
4
4
  end
@@ -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
- if framework == 'RSPEC1'
20
- require 'spec'
21
- require 'spec/runner/command_line'
22
- require File.expand_path('rspec1_formatter', File.dirname(__FILE__))
23
-
24
- Spec::Runner::Formatter::AugmentedTextFormatter.configure buffet_server, slave_name
25
-
26
- while file = buffet_server.next_file_for(slave_name)
27
- # RSpec1 closes stderr/out after each run, so we reopen them each time
28
- outlog = File.open('./tmp/buffet.out.log', 'a')
29
- errlog = File.open('./tmp/buffet.error.log', 'a')
30
-
31
- Spec::Runner::CommandLine.run(
32
- Spec::Runner::OptionParser.parse(
33
- ['--format', 'Spec::Runner::Formatter::AugmentedTextFormatter', file],
34
- errlog,
35
- outlog
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: 1.4.0
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-01-16 00:00:00.000000000 Z
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
@@ -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