trinidad_lifecycle_extension 0.2.1 → 0.2.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.
data/README CHANGED
@@ -28,8 +28,8 @@ How to write a lifecycle listener
28
28
  =================================
29
29
 
30
30
  If the listener is for the server the class must be into the module
31
- Trinidad::Lyfecycle::Server but if it's for the web application it must be into
32
- the module Trinidad::Lyfecycle::WebApp. The class must include the java class
31
+ Trinidad::Lifecycle::Server but if it's for the web application it must be into
32
+ the module Trinidad::Lifecycle::WebApp. The class must include the java class
33
33
  LifecycleListener and must contain the method `lifecycleEvent(event)`. For
34
34
  example:
35
35
 
data/Rakefile CHANGED
@@ -88,7 +88,7 @@ end
88
88
  #
89
89
  #############################################################################
90
90
 
91
- task :release do
91
+ task :release => :build do
92
92
  unless `git branch` =~ /^\* master$/
93
93
  puts "You must be on the master branch to release!"
94
94
  exit!
@@ -6,7 +6,7 @@ require 'java'
6
6
  module Trinidad
7
7
  module Extensions
8
8
  module Lifecycle
9
- VERSION = '0.2.1'
9
+ VERSION = '0.2.2'
10
10
 
11
11
  def init_listeners(context, path, mod_name)
12
12
  path ||= File.join('lib', 'lifecycle')
@@ -28,6 +28,11 @@ module Trinidad
28
28
  names = mod.split('::')
29
29
  names.inject(Object) {|constant, obj| constant.const_get(obj) } rescue nil
30
30
  end
31
+
32
+ def trap_signals(tomcat)
33
+ trap('INT') { tomcat.stop }
34
+ trap('TERM') { tomcat.stop }
35
+ end
31
36
  end
32
37
 
33
38
 
@@ -35,6 +40,7 @@ module Trinidad
35
40
  include Lifecycle
36
41
 
37
42
  def configure(tomcat)
43
+ trap_signals(tomcat)
38
44
  init_listeners(tomcat.server, @options[:path], 'Trinidad::Lifecycle::Server')
39
45
  end
40
46
  end
@@ -43,8 +49,16 @@ module Trinidad
43
49
  include Lifecycle
44
50
 
45
51
  def configure(tomcat, app_context)
52
+ trap_signals(tomcat)
46
53
  init_listeners(app_context, @options[:path], 'Trinidad::Lifecycle::WebApp')
47
54
  end
48
55
  end
56
+
57
+ class LifecycleOptionsExtension < OptionsExtension
58
+ def configure(parser, default_options)
59
+ default_options[:extensions] ||= {}
60
+ default_options[:extensions][:lifecycle] = {}
61
+ end
62
+ end
49
63
  end
50
64
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'trinidad_lifecycle_extension'
16
- s.version = '0.2.1'
17
- s.date = '2011-01-17'
16
+ s.version = '0.2.2'
17
+ s.date = '2011-03-30'
18
18
  s.rubyforge_project = 'trinidad_lifecycle_extension'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trinidad_lifecycle_extension
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
4
+ prerelease:
5
+ version: 0.2.2
10
6
  platform: ruby
11
7
  authors:
12
8
  - David Calavera
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-17 00:00:00 +01:00
13
+ date: 2011-03-30 00:00:00 -07:00
18
14
  default_executable:
19
15
  dependencies: []
20
16
 
@@ -49,23 +45,21 @@ rdoc_options:
49
45
  require_paths:
50
46
  - lib
51
47
  required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
52
49
  requirements:
53
50
  - - ">="
54
51
  - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
52
  version: "0"
58
53
  required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
59
55
  requirements:
60
56
  - - ">="
61
57
  - !ruby/object:Gem::Version
62
- segments:
63
- - 0
64
58
  version: "0"
65
59
  requirements: []
66
60
 
67
61
  rubyforge_project: trinidad_lifecycle_extension
68
- rubygems_version: 1.3.6
62
+ rubygems_version: 1.5.1
69
63
  signing_key:
70
64
  specification_version: 2
71
65
  summary: Add lifecycle listeners to the trinidad's server or applications