torquespec 0.3.0 → 0.3.1
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.
- data/lib/torquespec/daemon.rb +10 -16
- data/lib/torquespec/deployment_descriptor.rb +14 -7
- data/lib/torquespec/version.rb +1 -1
- metadata +3 -3
data/lib/torquespec/daemon.rb
CHANGED
@@ -27,6 +27,13 @@ module TorqueSpec
|
|
27
27
|
def start
|
28
28
|
puts "JC: start daemon"
|
29
29
|
DRb.start_service("druby://127.0.0.1:#{TorqueSpec.drb_port}", self)
|
30
|
+
10.times do
|
31
|
+
if DRb.current_server
|
32
|
+
break
|
33
|
+
else
|
34
|
+
sleep(0.1)
|
35
|
+
end
|
36
|
+
end
|
30
37
|
end
|
31
38
|
|
32
39
|
def stop
|
@@ -47,6 +54,8 @@ module TorqueSpec
|
|
47
54
|
begin
|
48
55
|
eval_before_alls(new)
|
49
56
|
run_remotely(reporter)
|
57
|
+
rescue Exception => ex
|
58
|
+
fail_filtered_examples(ex, reporter)
|
50
59
|
ensure
|
51
60
|
eval_after_alls(new)
|
52
61
|
end
|
@@ -56,30 +65,15 @@ module TorqueSpec
|
|
56
65
|
def run_remotely(reporter)
|
57
66
|
DRb.start_service("druby://127.0.0.1:0")
|
58
67
|
daemon = DRbObject.new_with_uri("druby://127.0.0.1:#{TorqueSpec.drb_port}")
|
59
|
-
# TODO: maybe fall back to local if can't run?
|
60
68
|
begin
|
61
69
|
daemon.run( name, reporter )
|
62
|
-
rescue Exception
|
63
|
-
puts $!, $@
|
64
70
|
ensure
|
65
71
|
DRb.stop_service
|
66
72
|
end
|
67
73
|
end
|
68
74
|
|
69
75
|
def deploy_paths
|
70
|
-
|
71
|
-
application:
|
72
|
-
root: #{TorqueSpec.app_root}
|
73
|
-
ruby:
|
74
|
-
version: #{RUBY_VERSION[0,3]}
|
75
|
-
services:
|
76
|
-
TorqueSpec::Daemon:
|
77
|
-
argv: #{TorqueSpec.argv}
|
78
|
-
pwd: #{Dir.pwd}
|
79
|
-
environment:
|
80
|
-
RUBYLIB: #{TorqueSpec.rubylib}
|
81
|
-
END
|
82
|
-
[ DeploymentDescriptor.new(descriptor, display_name).path ]
|
76
|
+
[ DeploymentDescriptor.new({}, display_name, true).path ]
|
83
77
|
end
|
84
78
|
|
85
79
|
end
|
@@ -12,7 +12,7 @@ module TorqueSpec
|
|
12
12
|
FileUtils.mkdir_p(TorqueSpec.knob_root) unless File.exist?(TorqueSpec.knob_root)
|
13
13
|
end
|
14
14
|
def path
|
15
|
-
|
15
|
+
verify( hash || filename || heredoc )
|
16
16
|
end
|
17
17
|
def hash
|
18
18
|
if @descriptor.is_a? Hash
|
@@ -38,21 +38,28 @@ module TorqueSpec
|
|
38
38
|
x.is_a?(Hash) ? x.inject({}) {|h,(k,v)| h[k.to_s] = stringify_keys(v); h} : x
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
def verify( path )
|
42
|
+
original = YAML.load_file( path )
|
43
|
+
if original.is_a? Hash
|
44
|
+
yaml = original.dup
|
45
|
+
if @daemonify
|
46
|
+
yaml['application'] ||= {}
|
47
|
+
yaml['application']['root'] ||= TorqueSpec.app_root
|
45
48
|
yaml['services'] ||= {}
|
46
49
|
yaml['services'].update( 'TorqueSpec::Daemon' => { 'argv' => TorqueSpec.argv, 'pwd' => Dir.pwd } )
|
47
50
|
yaml['environment'] ||= {}
|
48
51
|
env = { 'RUBYLIB' => TorqueSpec.rubylib }
|
49
52
|
yaml['environment'].update(env) {|k,oldval,newval| "#{oldval}:#{newval}"}
|
53
|
+
end
|
54
|
+
yaml['ruby'] ||= {}
|
55
|
+
yaml['ruby']['version'] ||= RUBY_VERSION[0,3]
|
56
|
+
if original != yaml
|
50
57
|
File.open( path, 'w' ) do |file|
|
51
58
|
YAML.dump( yaml, file )
|
52
59
|
end
|
53
|
-
else
|
54
|
-
$stderr.puts "WARN: Unable to decorate your deployment descriptor with TorqueSpec::Daemon"
|
55
60
|
end
|
61
|
+
else
|
62
|
+
$stderr.puts "WARN: Unable to decorate your deployment descriptor with TorqueSpec::Daemon"
|
56
63
|
end
|
57
64
|
path
|
58
65
|
end
|
data/lib/torquespec/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torquespec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jim Crossley
|