torquespec 0.1.4 → 0.1.5

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.
Binary file
@@ -20,26 +20,25 @@ module TorqueSpec
20
20
  end
21
21
 
22
22
  def _deploy(path)
23
- url = urlify(path)
24
- response = JSON.parse( domain_api( :operation => "add",
25
- :address => [ "deployment", url ],
26
- :url => url ) )
27
- if response['outcome']=='success'
28
- deployments[path] = response['compensating-operation']
29
- domain_api( :operation => "deploy",
30
- :address => [ "deployment", url ] )
31
- else
32
- response.to_json
23
+ once = true
24
+ begin
25
+ domain_api( :operation => "add",
26
+ :address => [ "deployment", addressify(path) ],
27
+ :url => urlify(path) )
28
+ rescue Exception
29
+ _undeploy(path)
30
+ if once
31
+ once = false
32
+ retry
33
+ end
33
34
  end
35
+ domain_api( :operation => "deploy",
36
+ :address => [ "deployment", addressify(path) ] )
34
37
  end
35
38
 
36
39
  def _undeploy(path)
37
- if deployments.has_key?(path)
38
- domain_api( deployments.delete(path) )
39
- else
40
- domain_api( :operation => "remove",
41
- :address => [ "deployment", urlify(path) ] )
42
- end
40
+ domain_api( :operation => "remove",
41
+ :address => [ "deployment", addressify(path) ] )
43
42
  end
44
43
 
45
44
  def ready?
@@ -50,10 +49,6 @@ module TorqueSpec
50
49
  false
51
50
  end
52
51
 
53
- def cleanup
54
- deployments.keys.each { |k| domain_api( deployments.delete(k) ) }
55
- end
56
-
57
52
  private
58
53
 
59
54
  def domain_api(params)
@@ -63,9 +58,9 @@ module TorqueSpec
63
58
  def urlify(path)
64
59
  URI.parse(path).scheme.nil? ? "file:#{path}" : path
65
60
  end
66
-
67
- def deployments
68
- @deployments ||= {}
61
+
62
+ def addressify(path)
63
+ File.basename(path)
69
64
  end
70
65
  end
71
66
  end
@@ -26,7 +26,6 @@ module TorqueSpec
26
26
  end
27
27
 
28
28
  def stop
29
- cleanup
30
29
  return if stopped
31
30
  self.stopped = true
32
31
  if TorqueSpec.lazy
@@ -62,10 +61,6 @@ module TorqueSpec
62
61
  raise "JBoss failed to start"
63
62
  end
64
63
 
65
- def cleanup
66
- # modules may mixin if needed
67
- end
68
-
69
64
  protected
70
65
 
71
66
  def startup(opts)
@@ -1,3 +1,3 @@
1
1
  module TorqueSpec
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -25,3 +25,14 @@ describe "simple directory deployment" do
25
25
  response.strip.should == "Hello World!"
26
26
  end
27
27
  end
28
+
29
+ describe "war deployment" do
30
+
31
+ deploy File.join( File.dirname(__FILE__), "../apps/node-info.war" )
32
+
33
+ it "should greet the world" do
34
+ response = open("http://localhost:8080/node-info") {|f| f.read}
35
+ response.should include( 'JBoss-Cloud node info' )
36
+ end
37
+ end
38
+
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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Crossley
@@ -60,6 +60,7 @@ files:
60
60
  - Gemfile
61
61
  - README.md
62
62
  - Rakefile
63
+ - apps/node-info.war
63
64
  - apps/simple.knob
64
65
  - apps/simple/config.ru
65
66
  - lib/torquespec.rb