specjour 0.5.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.markdown CHANGED
@@ -1,6 +1,14 @@
1
1
  History
2
2
  =======
3
3
 
4
+ 0.6.0 / 2012-07-19
5
+ ---------------------------
6
+ * [fixed] First RSpec test to load would run twice
7
+ * [added] Rsync options are now customizable via `Specjour::Configuration.rsync\_options=`
8
+ Useful when running on machines that use a combination of vendored gems and gemsets, i.e.
9
+ `-aL --delete --ignore-errors --exclude=vendor/ruby --exclude=.bundle`
10
+ * [added] Benchmark times for various system status messages
11
+
4
12
  0.5.6 / 2012-06-22
5
13
  ---------------------------
6
14
  * [fixed] Specjour hang when attempting to resolve a bonjour reply
@@ -2,7 +2,7 @@ module Specjour
2
2
  module Configuration
3
3
  extend self
4
4
 
5
- attr_writer :before_fork, :after_fork, :after_load, :prepare
5
+ attr_writer :before_fork, :after_fork, :after_load, :prepare, :rsync_options
6
6
 
7
7
  # This block is run by each worker before they begin running tests.
8
8
  # The default action is to migrate the database, and clear it of any old
@@ -37,6 +37,11 @@ module Specjour
37
37
  @after_fork = nil
38
38
  @after_load = nil
39
39
  @prepare = nil
40
+ @rsync_options = nil
41
+ end
42
+
43
+ def rsync_options
44
+ @rsync_options ||= default_rsync_options
40
45
  end
41
46
 
42
47
  def bundle_install
@@ -72,6 +77,10 @@ module Specjour
72
77
  end
73
78
  end
74
79
 
80
+ def default_rsync_options
81
+ "-aL --delete --ignore-errors"
82
+ end
83
+
75
84
  protected
76
85
 
77
86
  def rails_with_ar?
@@ -47,7 +47,7 @@ module Specjour
47
47
  end
48
48
 
49
49
  def dispatcher_uri
50
- @dispatcher_uri ||= URI::Generic.build :scheme => "specjour", :host => hostname, :port => printer.port
50
+ @dispatcher_uri ||= URI::Generic.build :scheme => "specjour", :host => local_ip, :port => printer.port
51
51
  end
52
52
 
53
53
  def dispatch_work
@@ -111,7 +111,7 @@ module Specjour
111
111
  end
112
112
 
113
113
  def no_local_managers?
114
- managers.none? {|m| m.hostname == hostname}
114
+ managers.none? {|m| m.local_ip == local_ip}
115
115
  end
116
116
 
117
117
  def printer
@@ -107,6 +107,8 @@ module Specjour
107
107
  "#{e.file_path}:#{e.metadata[:line_number]}"
108
108
  end
109
109
  end.flatten.uniq
110
+ ensure
111
+ ::RSpec.reset
110
112
  end
111
113
 
112
114
  def kill_worker_processes
@@ -22,6 +22,7 @@ module Specjour
22
22
  @worker_task = options[:worker_task]
23
23
  @registered_projects = options[:registered_projects]
24
24
  @rsync_port = options[:rsync_port]
25
+ Specjour.load_custom_hooks
25
26
  end
26
27
 
27
28
  def available_for?(project_name)
@@ -109,8 +110,7 @@ module Specjour
109
110
  end
110
111
 
111
112
  def sync
112
- cmd "rsync -aL --delete --ignore-errors --port=#{rsync_port} #{dispatcher_uri.host}::#{project_name} #{project_path}"
113
- puts "rsync complete"
113
+ cmd "rsync #{Specjour::Configuration.rsync_options} --port=#{rsync_port} #{dispatcher_uri.host}::#{project_name} #{project_path}"
114
114
  end
115
115
 
116
116
  protected
@@ -131,14 +131,17 @@ module Specjour
131
131
  end
132
132
 
133
133
  def cmd(command)
134
- puts command
135
- system command
134
+ Specjour.benchmark(command) do
135
+ system *command.split
136
+ end
136
137
  end
137
138
 
138
139
  def execute_before_fork
139
- in_project do
140
- Specjour.load_custom_hooks
141
- Configuration.before_fork.call
140
+ Specjour.benchmark("before_fork") do
141
+ in_project do
142
+ Specjour.load_custom_hooks
143
+ Configuration.before_fork.call
144
+ end
142
145
  end
143
146
  end
144
147
 
@@ -166,5 +169,6 @@ module Specjour
166
169
  yield
167
170
  end
168
171
  end
172
+
169
173
  end
170
174
  end
@@ -1,8 +1,9 @@
1
1
  class Specjour::RSpec::Preloader
2
2
  def self.load(paths=[])
3
- $stdout.puts "Loading RSpec Environment"
4
- require './spec/spec_helper'
5
- load_spec_files paths
3
+ Specjour.benchmark("Loading RSpec environment") do
4
+ require './spec/spec_helper'
5
+ load_spec_files paths
6
+ end
6
7
  end
7
8
 
8
9
  def self.load_spec_files(paths)
@@ -1,5 +1,6 @@
1
1
  module Specjour::RSpec::Runner
2
- ::RSpec::Core::Runner::AT_EXIT_HOOK_BACKTRACE_LINE.replace "#{__FILE__}:#{__LINE__ + 3}:in `run'"
2
+ ::RSpec.configuration.backtrace_clean_patterns << %r(lib/specjour/)
3
+
3
4
  def self.run(spec, output)
4
5
  args = ['--format=Specjour::RSpec::DistributedFormatter', spec]
5
6
  ::RSpec::Core::Runner.run args, $stderr, output
@@ -12,6 +12,10 @@ module Specjour
12
12
  @hostname ||= Socket.gethostname
13
13
  end
14
14
 
15
+ def local_ip
16
+ @local_ip ||= UDPSocket.open {|s| s.connect('74.125.224.103', 1); s.addr.last }
17
+ end
18
+
15
19
  def current_uri
16
20
  @current_uri ||= new_uri
17
21
  end
data/lib/specjour.rb CHANGED
@@ -29,7 +29,7 @@ module Specjour
29
29
  autoload :Cucumber, 'specjour/cucumber'
30
30
  autoload :RSpec, 'specjour/rspec'
31
31
 
32
- VERSION ||= "0.5.6"
32
+ VERSION ||= "0.6.0"
33
33
  HOOKS_PATH ||= "./.specjour/hooks.rb"
34
34
  PROGRAM_NAME ||= $PROGRAM_NAME # keep a reference of the original program name
35
35
 
@@ -71,7 +71,7 @@ module Specjour
71
71
  end
72
72
 
73
73
  def self.load_custom_hooks
74
- require HOOKS_PATH if File.exists?(HOOKS_PATH)
74
+ load HOOKS_PATH if File.exists?(HOOKS_PATH)
75
75
  end
76
76
 
77
77
  def self.trap_interrupt
@@ -80,4 +80,10 @@ module Specjour
80
80
  abort("\n")
81
81
  end
82
82
  end
83
+
84
+ def self.benchmark(msg, &block)
85
+ print "#{msg}... "
86
+ time = Benchmark.realtime &block
87
+ puts "completed in #{time}s"
88
+ end
83
89
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specjour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-22 00:00:00.000000000 Z
12
+ date: 2012-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dnssd
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
- version: 1.0.4
69
+ version: '0'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
- version: 1.0.4
77
+ version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: cucumber
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
- version: 0.7.2
101
+ version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,23 @@ dependencies:
106
106
  requirements:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
- version: 0.7.2
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: debugger
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
110
126
  description: ! " Specjour splits your RSpec suite across multiple machines, and
111
127
  multiple\n cores per machine, to run super-parallel-fast! Also works with Cucumber.\n"
112
128
  email: sandro.turriate@gmail.com
@@ -161,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
177
  version: '0'
162
178
  segments:
163
179
  - 0
164
- hash: -1360517515995431807
180
+ hash: -4214372861778010771
165
181
  required_rubygems_version: !ruby/object:Gem::Requirement
166
182
  none: false
167
183
  requirements: