capitomcat 1.1.1 → 1.1.2
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.
- checksums.yaml +8 -8
- data/CHANGES.md +9 -0
- data/capitomcat.gemspec +1 -1
- data/lib/capitomcat/tasks/deploy.cap +41 -22
- data/lib/capitomcat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
NTliMWU5ZmEzOTFlN2M4YmRmMzc1OTJiYTlkNWY2MDkzZTg5MGY5Ng==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
Nzg4MjlmYTQwNWZjM2Y4YzExNjlkODMyM2JjODhkMDA2NzEyNWU5Mg==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
N2Q1MmQwNjlkOGY3MzI0MzQxMmJiNmJiNTVmNGNkZWM4ZmJkNjUyNzYwMzhk
|
|
10
|
+
MTVmNWFlYjY0NjgzZjkxNmYyMGNiYjgxODczNTA2MmYxYTBhZGU0NDRhNjE1
|
|
11
|
+
MDhjNDAzNDNiNjQ0OWZkOThlMTQxYmI5NjA4OWMxN2RjNmVhOGI=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
NWQwN2M4Y2I5OWMyNjBhNTE0MTA2ZDNlNGI0NTcwN2IwN2QwNjJiZmQ1NzJk
|
|
14
|
+
OWFjZTU2OGVlZjYxNWRkMDI4M2M1N2Y3Y2EyMzUxOWE1ZWE1ZDI1YjQ0Nzc0
|
|
15
|
+
NzA3MTEyZTRhNTNhZTE2MGQ5MmFlNzA3NDg3ZDUxYWI3ZmE5MDk=
|
data/CHANGES.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
# Changes
|
|
2
|
+
[1.1.2]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.1.2
|
|
2
3
|
[1.1.1]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.1.1
|
|
3
4
|
[1.1.0]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.1.0
|
|
4
5
|
[1.0.1]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.0.1
|
|
5
6
|
[1.0.0]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.0.0
|
|
6
7
|
[0.0.3]: https://github.com/sunggun-yu/capitomcat/releases/tag/v0.0.3
|
|
7
8
|
|
|
9
|
+
## [v1.1.2][1.1.2]
|
|
10
|
+
* Bug Fix : Some Tomcat startup script need to be executed in background #6 (https://github.com/sunggun-yu/capitomcat/issues/6)
|
|
11
|
+
* Start/stop command has modified to be executed in the background.
|
|
12
|
+
* Adding sleep time after command is executed.
|
|
13
|
+
* Bug Fix : SSHKIT test and within not properly working at CentOS5.x #7 (https://github.com/sunggun-yu/capitomcat/issues/7)
|
|
14
|
+
* Removing within method
|
|
15
|
+
* Adding checking method for remote directory and file existing.
|
|
16
|
+
|
|
8
17
|
## [v1.1.1][1.1.1]
|
|
9
18
|
* File uploading strategy changing.
|
|
10
19
|
* Modifying tomcat starting check script.
|
data/capitomcat.gemspec
CHANGED
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.authors = ['Sunggun Yu']
|
|
14
14
|
s.email = ['sunggun.dev@gmail.com']
|
|
15
15
|
s.licenses = ['Apache 2.0']
|
|
16
|
-
s.date = %q{2014-01-
|
|
16
|
+
s.date = %q{2014-01-30}
|
|
17
17
|
s.homepage = 'http://sunggun-yu.github.io/capitomcat/'
|
|
18
18
|
s.summary = %q{Capistrano 3 recipe for Tomcat web application deployment}
|
|
19
19
|
s.description = %q{Capitomcat is the Capistrano 3 recipe for Tomcat web application deployment.}
|
|
@@ -70,8 +70,7 @@ namespace :capitomcat do
|
|
|
70
70
|
# Start Tomcat server
|
|
71
71
|
def start_tomcat
|
|
72
72
|
# local variables
|
|
73
|
-
|
|
74
|
-
execute(:sudo, get_sudo_user_tomcat_cmd, "#{tomcat_cmd} start")
|
|
73
|
+
execute_tomcat_cmd('start', 1)
|
|
75
74
|
end
|
|
76
75
|
|
|
77
76
|
# Check status whether Tomcat started
|
|
@@ -109,9 +108,7 @@ namespace :capitomcat do
|
|
|
109
108
|
|
|
110
109
|
# Stop Tomcat server
|
|
111
110
|
def stop_tomcat
|
|
112
|
-
|
|
113
|
-
tomcat_cmd = fetch(:tomcat_cmd)
|
|
114
|
-
execute(:sudo, get_sudo_user_tomcat_cmd, "#{tomcat_cmd} stop")
|
|
111
|
+
execute_tomcat_cmd('stop', 1)
|
|
115
112
|
end
|
|
116
113
|
|
|
117
114
|
# Upload the WAR file
|
|
@@ -180,12 +177,10 @@ namespace :capitomcat do
|
|
|
180
177
|
tomcat_work_dir = fetch(:tomcat_work_dir)
|
|
181
178
|
tomcat_user = fetch(:tomcat_user)
|
|
182
179
|
|
|
183
|
-
if
|
|
184
|
-
|
|
185
|
-
execute :sudo, '- u', tomcat_user, 'rm -rf', tomcat_work_dir
|
|
186
|
-
end
|
|
180
|
+
if dir_exist?(tomcat_work_dir)
|
|
181
|
+
execute :sudo, '- u', tomcat_user, 'rm -rf', tomcat_work_dir
|
|
187
182
|
else
|
|
188
|
-
warn('Tomcat work directory does not
|
|
183
|
+
warn('Tomcat work directory does not exist.')
|
|
189
184
|
end
|
|
190
185
|
end
|
|
191
186
|
|
|
@@ -216,21 +211,17 @@ namespace :capitomcat do
|
|
|
216
211
|
|
|
217
212
|
# Copy file to destination
|
|
218
213
|
target_dir = File.dirname(destination)
|
|
219
|
-
if
|
|
220
|
-
|
|
221
|
-
execute :sudo, '-u', sudo_user, :cp, file, destination
|
|
222
|
-
end
|
|
214
|
+
if dir_exist?(target_dir)
|
|
215
|
+
execute :sudo, '-u', sudo_user, :cp, file, destination
|
|
223
216
|
else
|
|
224
|
-
warn("Target directory
|
|
217
|
+
warn("Target directory does not exist. Capitomcat will try to mkdir for target directory. : #{target_dir}")
|
|
225
218
|
execute :sudo, '-u', sudo_user, :mkdir, '-p', target_dir
|
|
226
|
-
|
|
227
|
-
execute :sudo, '-u', sudo_user, :cp, file, destination
|
|
228
|
-
end
|
|
219
|
+
execute :sudo, '-u', sudo_user, :cp, file, destination
|
|
229
220
|
end
|
|
230
|
-
if
|
|
221
|
+
if file_exist?(file)
|
|
231
222
|
execute :rm, '-f', file
|
|
232
223
|
else
|
|
233
|
-
warn(
|
|
224
|
+
warn("The target file to remove does not exist : #{file}")
|
|
234
225
|
end
|
|
235
226
|
end
|
|
236
227
|
|
|
@@ -238,11 +229,11 @@ namespace :capitomcat do
|
|
|
238
229
|
# @param [String] user
|
|
239
230
|
# @param [String] file
|
|
240
231
|
def remove_file_if_exist (user, file)
|
|
241
|
-
if
|
|
232
|
+
if file_exist?(file)
|
|
242
233
|
execute :sudo, :chown, user, file
|
|
243
234
|
execute :rm, '-f', file
|
|
244
235
|
else
|
|
245
|
-
warn(
|
|
236
|
+
warn("The target file to remove does not exist : #{file}")
|
|
246
237
|
end
|
|
247
238
|
end
|
|
248
239
|
|
|
@@ -254,4 +245,32 @@ namespace :capitomcat do
|
|
|
254
245
|
ext = File.extname(file)
|
|
255
246
|
File.join(dir, "#{base}-#{time}#{ext}")
|
|
256
247
|
end
|
|
248
|
+
|
|
249
|
+
# Execute the Tomcat command
|
|
250
|
+
# it executes the Tomcat command in background. and sleeps for several sec after executing.
|
|
251
|
+
def execute_tomcat_cmd(arg, sleep)
|
|
252
|
+
# local variables
|
|
253
|
+
tomcat_cmd = fetch(:tomcat_cmd)
|
|
254
|
+
execute("echo `nohup sudo #{get_sudo_user_tomcat_cmd} #{tomcat_cmd} #{arg}& > /dev/null 2>&1` && sleep #{sleep}")
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Test if dir is existing
|
|
258
|
+
def dir_exist?(dir)
|
|
259
|
+
_test = capture("echo `if [ -d '#{dir}' ] ; then echo 'true' ; else echo 'false' ; fi`").to_s
|
|
260
|
+
if _test.eql?('true')
|
|
261
|
+
return true
|
|
262
|
+
else
|
|
263
|
+
return false
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Test if file is existing
|
|
268
|
+
def file_exist?(file)
|
|
269
|
+
_test = capture("echo `if [ -e '#{file}' ] ; then echo 'true' ; else echo 'false' ; fi`").to_s
|
|
270
|
+
if _test.eql?('true')
|
|
271
|
+
return true
|
|
272
|
+
else
|
|
273
|
+
return false
|
|
274
|
+
end
|
|
275
|
+
end
|
|
257
276
|
end
|
data/lib/capitomcat/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capitomcat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sunggun Yu
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-01-
|
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: capistrano
|