raystool 1.0.11 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -171,7 +171,7 @@ _rays_complete () {
171
171
 
172
172
  liferay)
173
173
  _rayscomp "
174
- start debug stop status log
174
+ start debug stop status log restart restart-debug
175
175
  --force $default_args
176
176
  "
177
177
  ;;
@@ -313,7 +313,7 @@ class RaysCommand < Clamp::Command
313
313
  # LIFERAY
314
314
  #
315
315
  subcommand 'liferay', 'manage liferay application server' do
316
- parameter 'action', 'start | debug | stop | status | log'
316
+ parameter 'action', 'start | debug | stop | status | log | restart | restart-debug'
317
317
  option '--force', :flag, 'use it only to [start | stop] remote servers. be careful!'
318
318
 
319
319
  def execute
@@ -322,6 +322,10 @@ class RaysCommand < Clamp::Command
322
322
  Rays::Controller.instance.liferay_start(force?)
323
323
  elsif action.eql? 'debug'
324
324
  Rays::Controller.instance.liferay_debug(force?)
325
+ elsif action.eql? 'restart'
326
+ Rays::Controller.instance.liferay_restart(force?)
327
+ elsif action.eql? 'restart-debug'
328
+ Rays::Controller.instance.liferay_restart_debug(force?)
325
329
  elsif action.eql? 'stop'
326
330
  Rays::Controller.instance.liferay_stop(force?)
327
331
  elsif action.eql? 'status'
@@ -227,6 +227,40 @@ module Rays
227
227
  end
228
228
  end
229
229
 
230
+ #
231
+ # Restart liferay's application server
232
+ #
233
+ def liferay_restart(force=false)
234
+ show_environment_info
235
+ task('restarting server', 'stop and start command has been sent', 'failed to start the server') do
236
+ service = $rays_config.environment.liferay.service
237
+ if service.remote? and !force
238
+ $log.warn("WARNING: you are trying to start a remote server.")
239
+ $log.warn("Your current environment is <!#{$rays_config.environment.name}!>.")
240
+ $log.warn("Use <!--force!> option if you really want to start remote liferay server.")
241
+ return
242
+ end
243
+ service.restart_normal
244
+ end
245
+ end
246
+
247
+ #
248
+ # Restart liferay's application server in debug mode
249
+ #
250
+ def liferay_restart_debug(force=false)
251
+ show_environment_info
252
+ task('restarting server in debug mode', 'stop and debug command has been sent', 'failed to start the server') do
253
+ service = $rays_config.environment.liferay.service
254
+ if service.remote? and !force
255
+ $log.warn("WARNING: you are trying to start a remote server.")
256
+ $log.warn("Your current environment is <!#{$rays_config.environment.name}!>.")
257
+ $log.warn("Use <!--force!> option if you really want to start remote liferay server.")
258
+ return
259
+ end
260
+ service.restart_debug
261
+ end
262
+ end
263
+
230
264
  #
231
265
  # Start liferay's application server in debug mode
232
266
  #
@@ -50,6 +50,7 @@ module Rays
50
50
  def start
51
51
  unless alive?
52
52
  execute @start_script
53
+ log
53
54
  else
54
55
  raise RaysException.new('service is already running')
55
56
  end
@@ -63,6 +64,7 @@ module Rays
63
64
  end
64
65
  unless alive?
65
66
  execute @debug_script
67
+ log
66
68
  else
67
69
  raise RaysException.new('service is already running')
68
70
  end
@@ -77,6 +79,20 @@ module Rays
77
79
  end
78
80
  end
79
81
 
82
+ # normal restart
83
+ def restart_normal
84
+ restart do
85
+ start
86
+ end
87
+ end
88
+
89
+ # restart in debug mode
90
+ def restart_debug
91
+ restart do
92
+ debug
93
+ end
94
+ end
95
+
80
96
  # Show logs (live)
81
97
  def log
82
98
  if remote?
@@ -111,6 +127,29 @@ module Rays
111
127
  rays_exec(command)
112
128
  end
113
129
  end
130
+
131
+ # restart service
132
+ def restart
133
+ if alive?
134
+ stop
135
+ end
136
+ started = false
137
+ tries_limit = 30
138
+ try = 0
139
+ while try < tries_limit do
140
+ unless alive?
141
+ yield
142
+ started = true
143
+ break
144
+ end
145
+ try += 1
146
+ sleep(1)
147
+ end
148
+
149
+ unless started
150
+ raise RaysException.new('service is stopping too long.')
151
+ end
152
+ end
114
153
  end
115
154
  end
116
155
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raystool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-11 00:00:00.000000000 Z
12
+ date: 2012-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
16
- requirement: &80850390 !ruby/object:Gem::Requirement
16
+ requirement: &75293680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *80850390
24
+ version_requirements: *75293680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rsolr
27
- requirement: &80850170 !ruby/object:Gem::Requirement
27
+ requirement: &75292650 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *80850170
35
+ version_requirements: *75292650
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: colorize
38
- requirement: &80849960 !ruby/object:Gem::Requirement
38
+ requirement: &75290990 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *80849960
46
+ version_requirements: *75290990
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: net-ssh
49
- requirement: &80849750 !ruby/object:Gem::Requirement
49
+ requirement: &75290380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *80849750
57
+ version_requirements: *75290380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: highline
60
- requirement: &80849540 !ruby/object:Gem::Requirement
60
+ requirement: &75274850 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *80849540
68
+ version_requirements: *75274850
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: safe_shell
71
- requirement: &80849330 !ruby/object:Gem::Requirement
71
+ requirement: &75273970 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *80849330
79
+ version_requirements: *75273970
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: nokogiri
82
- requirement: &80849120 !ruby/object:Gem::Requirement
82
+ requirement: &75272840 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *80849120
90
+ version_requirements: *75272840
91
91
  description: Command line tool to create and manage liferay projects
92
92
  email: dmitri.carpov@gmail.com
93
93
  executables: