specjour 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,24 +1,17 @@
1
1
  module Specjour
2
- require 'specjour/rspec'
3
- require 'specjour/cucumber'
4
2
 
5
3
  class Worker
6
4
  include Protocol
7
5
  include SocketHelper
8
6
  attr_accessor :printer_uri
9
- attr_reader :project_path, :number, :preload_spec, :preload_feature, :task
7
+ attr_reader :number
10
8
 
11
9
  def initialize(options = {})
12
10
  ARGV.replace []
13
11
  $stdout = StringIO.new if options[:quiet]
14
- @project_path = options[:project_path]
15
12
  @number = options[:number].to_i
16
- @preload_spec = options[:preload_spec]
17
- @preload_feature = options[:preload_feature]
18
- @task = options[:task]
19
13
  self.printer_uri = options[:printer_uri]
20
14
  set_env_variables
21
- Dir.chdir(project_path)
22
15
  Specjour.load_custom_hooks
23
16
  end
24
17
 
@@ -27,13 +20,10 @@ module Specjour
27
20
  end
28
21
 
29
22
  def prepare
30
- load_app
31
23
  Configuration.prepare.call
32
- Kernel.exit!
33
24
  end
34
25
 
35
26
  def run_tests
36
- load_app
37
27
  Configuration.after_fork.call
38
28
  run_times = Hash.new(0)
39
29
 
@@ -42,32 +32,20 @@ module Specjour
42
32
  time = Benchmark.realtime { run_test test }
43
33
  profile(test, time)
44
34
  run_times[test_type(test)] += time
35
+ connection.send_message(:done)
45
36
  end
46
37
 
47
38
  send_run_times(run_times)
48
- connection.send_message(:done)
39
+ ensure
49
40
  connection.disconnect
50
41
  end
51
42
 
52
- def start
53
- send task
54
- end
55
-
56
43
  protected
57
44
 
58
45
  def connection
59
46
  @connection ||= printer_connection
60
47
  end
61
48
 
62
- def load_app
63
- RSpec::Preloader.load(preload_spec) if preload_spec
64
- Cucumber::Preloader.load(preload_feature) if preload_feature
65
- rescue StandardError => exception
66
- $stderr.puts "Caught exception: #{exception.class} #{exception.message}"
67
- Specjour.logger.debug exception.backtrace.join("\n")
68
- $stderr.puts "Proceeding... you may need to re-run the dispatcher."
69
- end
70
-
71
49
  def printer_connection
72
50
  Connection.new printer_uri
73
51
  end
@@ -96,11 +74,11 @@ module Specjour
96
74
  end
97
75
 
98
76
  def run_feature(feature)
99
- Specjour::Cucumber::Runner.run(feature, connection)
77
+ Cucumber::Runner.run(feature, connection)
100
78
  end
101
79
 
102
80
  def run_spec(spec)
103
- Specjour::RSpec::Runner.run(spec, connection)
81
+ RSpec::Runner.run(spec, connection)
104
82
  end
105
83
 
106
84
  def send_run_times(run_times)
data/lib/specjour.rb CHANGED
@@ -17,10 +17,11 @@ module Specjour
17
17
  autoload :Connection, 'specjour/connection'
18
18
  autoload :DbScrub, 'specjour/db_scrub'
19
19
  autoload :Dispatcher, 'specjour/dispatcher'
20
+ autoload :Fork, 'specjour/fork'
21
+ autoload :Loader, 'specjour/loader'
20
22
  autoload :Manager, 'specjour/manager'
21
23
  autoload :Printer, 'specjour/printer'
22
24
  autoload :Protocol, 'specjour/protocol'
23
- autoload :QuietFork, 'specjour/quiet_fork'
24
25
  autoload :RsyncDaemon, 'specjour/rsync_daemon'
25
26
  autoload :SocketHelper, 'specjour/socket_helper'
26
27
  autoload :Worker, 'specjour/worker'
@@ -28,7 +29,7 @@ module Specjour
28
29
  autoload :Cucumber, 'specjour/cucumber'
29
30
  autoload :RSpec, 'specjour/rspec'
30
31
 
31
- VERSION = "0.4.1"
32
+ VERSION = "0.5.0"
32
33
  HOOKS_PATH = "./.specjour/hooks.rb"
33
34
 
34
35
  def self.interrupted?
@@ -36,9 +37,18 @@ module Specjour
36
37
  end
37
38
 
38
39
  def self.interrupted=(bool)
39
- Cucumber.wants_to_quit
40
- RSpec.wants_to_quit
41
40
  @interrupted = bool
41
+ if bool
42
+ will_quit(:RSpec)
43
+ will_quit(:Cucumber)
44
+ end
45
+ end
46
+
47
+ def self.will_quit(framework)
48
+ if Object.const_defined?(framework)
49
+ framework = Object.const_get(framework)
50
+ framework.wants_to_quit = true if framework.respond_to?(:wants_to_quit=)
51
+ end
42
52
  end
43
53
 
44
54
  def self.logger
@@ -62,7 +72,7 @@ module Specjour
62
72
  def self.trap_interrupt
63
73
  Signal.trap('INT') do
64
74
  self.interrupted = true
65
- exit 1
75
+ abort("\n")
66
76
  end
67
77
  end
68
78
 
metadata CHANGED
@@ -1,109 +1,106 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: specjour
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
4
5
  prerelease:
5
- version: 0.4.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Sandro Turriate
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-17 00:00:00 -07:00
14
- default_executable: specjour
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-20 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: dnssd
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2156993440 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - "="
23
- - !ruby/object:Gem::Version
24
- version: 1.3.4
18
+ requirements:
19
+ - - =
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.0
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: thor
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2156993440
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &2156992940 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
35
32
  version: 0.14.0
36
33
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: rspec
40
34
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *2156992940
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &2156992460 !ruby/object:Gem::Requirement
42
39
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 2.5.0
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 2.8.0
47
44
  type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: rr
51
45
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *2156992460
47
+ - !ruby/object:Gem::Dependency
48
+ name: rr
49
+ requirement: &2156991900 !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: 0.10.11
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.4
58
55
  type: :development
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: cucumber
62
56
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *2156991900
58
+ - !ruby/object:Gem::Dependency
59
+ name: cucumber
60
+ requirement: &2156991400 !ruby/object:Gem::Requirement
64
61
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: 0.9.0
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 1.1.4
69
66
  type: :development
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: yard
73
67
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *2156991400
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: &2156990920 !ruby/object:Gem::Requirement
75
72
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: 0.5.3
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 0.7.2
80
77
  type: :development
81
- version_requirements: *id006
82
- description: " Specjour splits your RSpec suite across multiple machines, and multiple\n cores per machine, to run super-parallel-fast! Also works with Cucumber.\n"
78
+ prerelease: false
79
+ version_requirements: *2156990920
80
+ description: ! " Specjour splits your RSpec suite across multiple machines, and
81
+ multiple\n cores per machine, to run super-parallel-fast! Also works with Cucumber.\n"
83
82
  email: sandro.turriate@gmail.com
84
- executables:
83
+ executables:
85
84
  - specjour
86
85
  extensions: []
87
-
88
86
  extra_rdoc_files: []
89
-
90
- files:
87
+ files:
91
88
  - lib/specjour/cli.rb
92
89
  - lib/specjour/configuration.rb
93
90
  - lib/specjour/connection.rb
94
91
  - lib/specjour/cpu.rb
95
92
  - lib/specjour/cucumber/distributed_formatter.rb
96
93
  - lib/specjour/cucumber/final_report.rb
97
- - lib/specjour/cucumber/main_ext.rb
98
94
  - lib/specjour/cucumber/preloader.rb
99
95
  - lib/specjour/cucumber/runner.rb
100
96
  - lib/specjour/cucumber.rb
101
97
  - lib/specjour/db_scrub.rb
102
98
  - lib/specjour/dispatcher.rb
99
+ - lib/specjour/fork.rb
100
+ - lib/specjour/loader.rb
103
101
  - lib/specjour/manager.rb
104
102
  - lib/specjour/printer.rb
105
103
  - lib/specjour/protocol.rb
106
- - lib/specjour/quiet_fork.rb
107
104
  - lib/specjour/rspec/distributed_formatter.rb
108
105
  - lib/specjour/rspec/final_report.rb
109
106
  - lib/specjour/rspec/marshalable_exception.rb
@@ -120,33 +117,28 @@ files:
120
117
  - History.markdown
121
118
  - Rakefile
122
119
  - bin/specjour
123
- has_rdoc: true
124
120
  homepage: https://github.com/sandro/specjour
125
121
  licenses: []
126
-
127
122
  post_install_message:
128
123
  rdoc_options: []
129
-
130
- require_paths:
124
+ require_paths:
131
125
  - lib
132
- required_ruby_version: !ruby/object:Gem::Requirement
126
+ required_ruby_version: !ruby/object:Gem::Requirement
133
127
  none: false
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- version: "0"
138
- required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
133
  none: false
140
- requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
134
+ requirements:
135
+ - - ! '>='
136
+ - !ruby/object:Gem::Version
143
137
  version: 1.3.6
144
138
  requirements: []
145
-
146
139
  rubyforge_project:
147
- rubygems_version: 1.6.2
140
+ rubygems_version: 1.8.6
148
141
  signing_key:
149
142
  specification_version: 3
150
143
  summary: Distribute your spec suite amongst your LAN via Bonjour.
151
144
  test_files: []
152
-
@@ -1,3 +0,0 @@
1
- Cucumber::Cli::Main.class_eval do
2
- def trap_interrupt; end
3
- end
@@ -1,11 +0,0 @@
1
- module Specjour::QuietFork
2
- extend self
3
- attr_reader :pid
4
-
5
- def self.fork(&block)
6
- @pid = Kernel.fork do
7
- $stdout = StringIO.new
8
- block.call
9
- end
10
- end
11
- end