spe_cuke 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == master
2
+ * improve command invokation error message.
3
+ * workaround for hanging up during spork detection.
4
+
1
5
  == 0.3.0 / 2010-09-14
2
6
  * assume test file from product code name.
3
7
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spe_cuke (0.3.0)
4
+ spe_cuke (0.3.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/bin/sc CHANGED
@@ -12,9 +12,14 @@ opt.on('-l', '--line=N', Integer) {|l| $option[:line] = l }
12
12
  opt.on('-r', '--rake', TrueClass) {|b| $option[:prefer_rake] = b }
13
13
  opt.parse!(ARGV)
14
14
 
15
- SpeCuke::Target.for(ARGV.first).new(
16
- SpeCuke::Environment.new($option[:root], :prefer_rake => $option[:prefer_rake]),
17
- ARGV.first,
18
- $option[:line]
19
- ).execute!
15
+ if target = SpeCuke::Target.for(ARGV.first)
16
+ target.new(
17
+ SpeCuke::Environment.new($option[:root], :prefer_rake => $option[:prefer_rake]),
18
+ ARGV.first,
19
+ $option[:line]
20
+ ).execute!
21
+ else
22
+ $stderr.puts "can't build test commands from `#{ARGV.first}'."
23
+ exit 1
24
+ end
20
25
 
@@ -2,6 +2,7 @@ require 'rbconfig'
2
2
  require 'pathname'
3
3
  require 'yaml'
4
4
  require 'drb'
5
+ require 'timeout'
5
6
  require 'bundler'
6
7
 
7
8
  module SpeCuke
@@ -41,12 +42,16 @@ module SpeCuke
41
42
 
42
43
  def spork_running?
43
44
  begin
44
- DRbObject.new_with_uri("druby://127.0.0.1:8989").respond_to?(:run)
45
- rescue DRb::DRbConnError, Errno::ECONNREFUSED
45
+ timeout(1) { spork_server && spork_server.respond_to?(:run) }
46
+ rescue DRb::DRbConnError, Errno::ECONNREFUSED, Timeout::Error, SocketError, Errno::EADDRNOTAVAIL
46
47
  return false
47
48
  end
48
49
  end
49
50
 
51
+ def spork_server
52
+ @_spork_server ||= DRbObject.new_with_uri("druby://127.0.0.1:8989")
53
+ end
54
+
50
55
  private
51
56
  def gemfile_dot_lock
52
57
  (@root + 'Gemfile.lock').read
@@ -10,12 +10,30 @@ module SpeCuke::Target
10
10
  end
11
11
  self.default_options = ['--color']
12
12
 
13
+ def execute!
14
+ @env.spork_running? ? execute_direct! : super
15
+ end
16
+
13
17
  private
18
+ # XXX refactor
19
+ def execute_direct!
20
+ begin
21
+ DRb.start_service("druby://localhost:0")
22
+ rescue SocketError, Errno::EADDRNOTAVAIL
23
+ DRb.start_service("druby://:0")
24
+ end
25
+ puts "direct executing `spork_server.run(#{cmd_parameters.flatten.join(" ")})'"
26
+ @env.spork_server.run([fn_and_line], STDERR, STDOUT)
27
+ end
28
+
14
29
  def raw_commands
15
- cmds = [@env.command(spec_command_base)]
30
+ ([@env.command(spec_command_base)] + cmd_parameters).flatten
31
+ end
32
+
33
+ def cmd_parameters
34
+ cmds = []
16
35
  cmds << self.class.default_options
17
36
  cmds << '-fn' if @line # XXX
18
- cmds << '--drb' if @env.spork_running?
19
37
  cmds << fn_and_line
20
38
  end
21
39
 
@@ -1,3 +1,3 @@
1
1
  module SpeCuke
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spe_cuke
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 3
9
- - 0
10
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - MOROHASHI Kyosuke
@@ -15,16 +14,17 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-09-14 00:00:00 +09:00
17
+ date: 2010-11-05 00:00:00 +09:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ name: bundler
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
23
24
  none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
27
- hash: 15424063
28
28
  segments:
29
29
  - 1
30
30
  - 0
@@ -32,10 +32,8 @@ dependencies:
32
32
  - rc
33
33
  - 5
34
34
  version: 1.0.0.rc.5
35
- requirement: *id001
36
35
  type: :development
37
- name: bundler
38
- prerelease: false
36
+ version_requirements: *id001
39
37
  description: An abstraction command for testing frameworks and invokation methods of them.
40
38
  email:
41
39
  - moronatural@gmail.com
@@ -83,7 +81,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
81
  requirements:
84
82
  - - ">="
85
83
  - !ruby/object:Gem::Version
86
- hash: 3
87
84
  segments:
88
85
  - 0
89
86
  version: "0"
@@ -92,7 +89,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
89
  requirements:
93
90
  - - ">="
94
91
  - !ruby/object:Gem::Version
95
- hash: 23
96
92
  segments:
97
93
  - 1
98
94
  - 3