rtomcat 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/manager.rb +9 -0
- data/rtomcat.gemspec +1 -1
- data/test/manager_test.rb +17 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/manager.rb
CHANGED
@@ -15,6 +15,15 @@ class Tomcat::Manager
|
|
15
15
|
check_response(resource('deploy', appname).put(file))
|
16
16
|
end
|
17
17
|
|
18
|
+
def redeploy(appname, file)
|
19
|
+
begin
|
20
|
+
undeploy(appname)
|
21
|
+
rescue
|
22
|
+
end
|
23
|
+
|
24
|
+
deploy(appname, file)
|
25
|
+
end
|
26
|
+
|
18
27
|
private
|
19
28
|
|
20
29
|
def check_response(response)
|
data/rtomcat.gemspec
CHANGED
data/test/manager_test.rb
CHANGED
@@ -21,7 +21,7 @@ class ManagerTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_deploy
|
24
|
-
FakeWeb.register_uri(:put, deploy_url, :body => "OK -
|
24
|
+
FakeWeb.register_uri(:put, deploy_url, :body => "OK - Deployed application at context path /appname")
|
25
25
|
assert_nothing_raised { deploy }
|
26
26
|
end
|
27
27
|
|
@@ -35,6 +35,18 @@ class ManagerTest < Test::Unit::TestCase
|
|
35
35
|
assert_raises_with("http status code: 200, message: FAIL - some error") { deploy }
|
36
36
|
end
|
37
37
|
|
38
|
+
def test_redeploy
|
39
|
+
FakeWeb.register_uri(:get, undeploy_url, :body => "OK - Undeployed application at context path /appname")
|
40
|
+
FakeWeb.register_uri(:put, deploy_url, :body => "OK - Deployed application at context path /appname")
|
41
|
+
assert_nothing_raised { redeploy }
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_redeploy_ignores_undeploy_errors
|
45
|
+
FakeWeb.register_uri(:get, undeploy_url, :body => "FAIL - some error")
|
46
|
+
FakeWeb.register_uri(:put, deploy_url, :body => "OK - Deployed application at context path /appname")
|
47
|
+
assert_nothing_raised { redeploy }
|
48
|
+
end
|
49
|
+
|
38
50
|
private
|
39
51
|
|
40
52
|
def undeploy_url
|
@@ -53,6 +65,10 @@ class ManagerTest < Test::Unit::TestCase
|
|
53
65
|
@manager.deploy('appname', "FakeWeb doesn't allow for put body interrogation right now, so this parameter doesn't matter")
|
54
66
|
end
|
55
67
|
|
68
|
+
def redeploy
|
69
|
+
@manager.redeploy('appname', "Some bogus file content")
|
70
|
+
end
|
71
|
+
|
56
72
|
def assert_raises_with(message)
|
57
73
|
begin
|
58
74
|
yield
|