trinidad_valve_extension 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile +2 -0
- data/History.txt +6 -0
- data/README.md +61 -0
- data/Rakefile +9 -151
- data/lib/trinidad_valve_extension.rb +56 -29
- data/lib/trinidad_valve_extension/version.rb +7 -0
- data/lib/trinidad_valves_extension.rb +18 -0
- data/test/app/config.ru +2 -0
- data/test/app/trinidad-alt.yml +12 -0
- data/test/app/trinidad.yml +15 -0
- data/test/test_helper.rb +8 -0
- data/test/trinidad_valve_extension_test.rb +78 -0
- data/trinidad_valve_extension.gemspec +20 -60
- metadata +85 -47
- data/README +0 -33
data/.gitignore
ADDED
data/Gemfile
ADDED
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.5.0 (2012-07-31)
|
2
|
+
|
3
|
+
* support for alternate (more intuitive) configuration
|
4
|
+
* Trinidad 1.4.0 compatibility (use symbols as configuration Hash keys)
|
5
|
+
* bundlify gem development & release process
|
6
|
+
|
1
7
|
== 0.4.0 (2011-09-22)
|
2
8
|
|
3
9
|
* Better error messaging when incorrect types or properties are configured
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Trinidad Valve Extension
|
2
|
+
|
3
|
+
This is an extension to allow Tomcat valves to be configured and attached to web
|
4
|
+
applications running under [Trinidad](https://github.com/trinidad/trinidad/).
|
5
|
+
Built-in Tomcat valves or any valve implementation accessible within the
|
6
|
+
application's class-path can be used.
|
7
|
+
|
8
|
+
A list of built-in valves can be found at: http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
jruby -S gem install trinidad_valve_extension
|
13
|
+
|
14
|
+
## Configuration
|
15
|
+
|
16
|
+
This extension will configure valves from a list of hashes that contain the
|
17
|
+
properties that configure each valve. The **'className'** key might be used to
|
18
|
+
define what valve class is being configured, just as when configuring tomcat
|
19
|
+
using the traditional *context.xml* file.
|
20
|
+
Tomcat valves (from the org.apache.catalina.valves package) might be specified
|
21
|
+
simply as class name keys followed by a configuration for it's properties.
|
22
|
+
Substitutions for values referenced within **${}** will be performed with Java's
|
23
|
+
system properties.
|
24
|
+
|
25
|
+
To enable the extension, specify at least one valve configuration with *valves*
|
26
|
+
under the *extensions* key e.g. :
|
27
|
+
|
28
|
+
```
|
29
|
+
---
|
30
|
+
# ...
|
31
|
+
extensions:
|
32
|
+
valves:
|
33
|
+
AccessLogValve: # class-name under org.apache.catalina.valves
|
34
|
+
directory: log
|
35
|
+
crawler_session_manager_valve: # underscored class-name
|
36
|
+
# leave defaults
|
37
|
+
remote_address_filter: # not a class-name since className specified
|
38
|
+
className: org.apache.catalina.valves.RemoteAddrValve
|
39
|
+
allow: "127\.0\.0\.1"
|
40
|
+
```
|
41
|
+
|
42
|
+
Alternatively, you can still use the traditional (old) syntax using the *valve*
|
43
|
+
extension element with *valves* specified as an array e.g. :
|
44
|
+
|
45
|
+
---
|
46
|
+
extensions:
|
47
|
+
valve:
|
48
|
+
valves:
|
49
|
+
- className: org.apache.catalina.valves.AccessLogValve
|
50
|
+
pattern: "%h %l %u %t \"%r\" %s %b %T %S"
|
51
|
+
directory: "log"
|
52
|
+
prefix: "access_log"
|
53
|
+
suffix: ".log"
|
54
|
+
fileDateFormat: ".yyyy-MM-dd"
|
55
|
+
- className: org.apache.catalina.valves.CrawlerSessionManagerValve
|
56
|
+
sessionInactiveInterval: 42
|
57
|
+
```
|
58
|
+
|
59
|
+
# Copyright
|
60
|
+
|
61
|
+
Copyright (c) 2011 Michael Leinartas. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,156 +1,14 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require 'date'
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler::GemHelper.install_tasks
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
#############################################################################
|
8
|
-
#
|
9
|
-
# Helper functions
|
10
|
-
#
|
11
|
-
#############################################################################
|
12
|
-
|
13
|
-
def name
|
14
|
-
@name ||= Dir['*.gemspec'].first.split('.').first
|
15
|
-
end
|
16
|
-
|
17
|
-
def version
|
18
|
-
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
|
19
|
-
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
20
|
-
end
|
21
|
-
|
22
|
-
def date
|
23
|
-
Date.today.to_s
|
24
|
-
end
|
25
|
-
|
26
|
-
def rubyforge_project
|
27
|
-
name
|
28
|
-
end
|
29
|
-
|
30
|
-
def gemspec_file
|
31
|
-
"#{name}.gemspec"
|
32
|
-
end
|
33
|
-
|
34
|
-
def gem_file
|
35
|
-
"#{name}-#{version}.gem"
|
36
|
-
end
|
37
|
-
|
38
|
-
def replace_header(head, header_name)
|
39
|
-
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
40
|
-
end
|
41
|
-
|
42
|
-
#############################################################################
|
43
|
-
#
|
44
|
-
# Standard tasks
|
45
|
-
#
|
46
|
-
#############################################################################
|
4
|
+
desc "Clean pkg directory"
|
5
|
+
task(:clean) { sh "rm -rf pkg/" }
|
47
6
|
|
48
7
|
task :default => :test
|
49
8
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
test
|
55
|
-
end
|
56
|
-
|
57
|
-
desc "Generate RCov test coverage and open in your browser"
|
58
|
-
task :coverage do
|
59
|
-
require 'rcov'
|
60
|
-
sh "rm -fr coverage"
|
61
|
-
sh "rcov test/test_*.rb"
|
62
|
-
sh "open coverage/index.html"
|
63
|
-
end
|
64
|
-
|
65
|
-
require 'rake/rdoctask'
|
66
|
-
Rake::RDocTask.new do |rdoc|
|
67
|
-
rdoc.rdoc_dir = 'rdoc'
|
68
|
-
rdoc.title = "#{name} #{version}"
|
69
|
-
rdoc.rdoc_files.include('README*')
|
70
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
71
|
-
end
|
72
|
-
|
73
|
-
desc "Open an irb session preloaded with this library"
|
74
|
-
task :console do
|
75
|
-
sh "irb -rubygems -r ./lib/#{name}.rb"
|
76
|
-
end
|
77
|
-
|
78
|
-
#############################################################################
|
79
|
-
#
|
80
|
-
# Custom tasks (add your own tasks here)
|
81
|
-
#
|
82
|
-
#############################################################################
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
#############################################################################
|
87
|
-
#
|
88
|
-
# Packaging tasks
|
89
|
-
#
|
90
|
-
#############################################################################
|
91
|
-
|
92
|
-
desc 'Release gem'
|
93
|
-
task :release => :build do
|
94
|
-
unless `git branch` =~ /^\* master$/
|
95
|
-
puts "You must be on the master branch to release!"
|
96
|
-
exit!
|
97
|
-
end
|
98
|
-
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
99
|
-
sh "git tag v#{version}"
|
100
|
-
sh "git push origin master"
|
101
|
-
sh "git push --tags"
|
102
|
-
sh "gem push pkg/#{gem_file}"
|
103
|
-
end
|
104
|
-
|
105
|
-
desc 'Build gem'
|
106
|
-
task :build => :gemspec do
|
107
|
-
sh "mkdir -p pkg"
|
108
|
-
sh "gem build #{gemspec_file}"
|
109
|
-
sh "mv #{gem_file} pkg"
|
110
|
-
end
|
111
|
-
|
112
|
-
desc 'Install gem'
|
113
|
-
task :install => :build do
|
114
|
-
sh "gem install pkg/#{gem_file}"
|
115
|
-
end
|
116
|
-
|
117
|
-
desc 'Create gemspec'
|
118
|
-
task :gemspec => :validate do
|
119
|
-
# read spec file and split out manifest section
|
120
|
-
spec = File.read(gemspec_file)
|
121
|
-
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
122
|
-
|
123
|
-
# replace name version and date
|
124
|
-
replace_header(head, :name)
|
125
|
-
replace_header(head, :version)
|
126
|
-
replace_header(head, :date)
|
127
|
-
#comment this out if your rubyforge_project has a different name
|
128
|
-
replace_header(head, :rubyforge_project)
|
129
|
-
|
130
|
-
# determine file list from git ls-files
|
131
|
-
files = `git ls-files`.
|
132
|
-
split("\n").
|
133
|
-
sort.
|
134
|
-
reject { |file| file =~ /^\./ }.
|
135
|
-
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
136
|
-
map { |file| " #{file}" }.
|
137
|
-
join("\n")
|
138
|
-
|
139
|
-
# piece file back together and write
|
140
|
-
manifest = " s.files = %w[\n#{files}\n ]\n"
|
141
|
-
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
142
|
-
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
143
|
-
puts "Updated #{gemspec_file}"
|
144
|
-
end
|
145
|
-
|
146
|
-
task :validate do
|
147
|
-
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
|
148
|
-
unless libfiles.empty?
|
149
|
-
puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
|
150
|
-
exit!
|
151
|
-
end
|
152
|
-
unless Dir['VERSION*'].empty?
|
153
|
-
puts "A `VERSION` file at root level violates Gem best practices."
|
154
|
-
exit!
|
155
|
-
end
|
9
|
+
task(:test) do
|
10
|
+
test = ENV['TEST'] || File.join(Dir.getwd, "test/**/*_test.rb")
|
11
|
+
test_opts = (ENV['TESTOPTS'] || '').split(' ')
|
12
|
+
test_opts = test_opts.push *FileList[test].to_a
|
13
|
+
ruby "-Isrc/main/ruby:src/test/ruby", "-S", "testrb", *test_opts
|
156
14
|
end
|
@@ -1,65 +1,92 @@
|
|
1
1
|
module Trinidad
|
2
2
|
module Extensions
|
3
|
-
module Valve
|
4
|
-
VERSION = '0.4'
|
5
|
-
end
|
6
|
-
|
7
3
|
class ValveWebAppExtension < WebAppExtension
|
8
|
-
def configure(tomcat, app_context)
|
9
|
-
@logger = app_context.logger
|
10
4
|
|
11
|
-
|
5
|
+
def configure(tomcat, context)
|
6
|
+
@logger = context.logger
|
7
|
+
|
8
|
+
if @options.has_key?(:valves) # 'old' syntax
|
9
|
+
valves = (@options[:valves] ||= Array.new)
|
10
|
+
else
|
11
|
+
valves = @options
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
unless valves.empty?
|
15
|
+
valves.each do |name, properties| # Hash or Array
|
16
|
+
if properties.nil? && name.is_a?(Hash)
|
17
|
+
properties, name = name, nil
|
18
|
+
end
|
19
|
+
properties = properties ? properties.dup : {}
|
20
|
+
class_name = properties.delete(:className) || name
|
17
21
|
|
18
|
-
|
19
|
-
|
22
|
+
unless class_name
|
23
|
+
logger.warn "Valve defined without a 'className' attribute, " +
|
24
|
+
"skipping valve definition: #{properties.inspect}"
|
20
25
|
next
|
21
26
|
end
|
22
27
|
|
23
28
|
begin
|
24
|
-
valve = get_valve(class_name)
|
29
|
+
valve = get_valve(class_name.to_s)
|
25
30
|
rescue NameError => e
|
26
|
-
@logger.warn
|
31
|
+
@logger.warn "Valve '#{class_name}' not found (#{e.message}), " +
|
32
|
+
"ensure valve class is in your class-path"
|
27
33
|
next
|
28
34
|
end
|
29
35
|
|
30
|
-
set_valve_properties(valve,
|
36
|
+
set_valve_properties(valve, properties)
|
31
37
|
|
32
38
|
# Add the valve to the context using the suggested getPipeline()
|
33
|
-
|
39
|
+
context.pipeline.add_valve(valve)
|
34
40
|
end
|
35
41
|
end
|
36
42
|
end
|
37
43
|
|
44
|
+
protected
|
45
|
+
|
38
46
|
def get_valve(valve_name)
|
39
|
-
|
40
|
-
|
47
|
+
class_name = valve_name.index('.') ? valve_name : camelize(valve_name)
|
48
|
+
begin
|
49
|
+
valve_class = Java::JavaClass.for_name(class_name)
|
50
|
+
rescue NameError => e
|
51
|
+
if class_name.index('.').nil?
|
52
|
+
class_name = "org.apache.catalina.valves.#{class_name}"
|
53
|
+
valve_class = Java::JavaClass.for_name(class_name)
|
54
|
+
else
|
55
|
+
raise e
|
56
|
+
end
|
57
|
+
end
|
58
|
+
valve_class.constructor.new_instance.to_java
|
41
59
|
end
|
42
60
|
|
43
61
|
def set_valve_properties(valve_instance, properties)
|
44
|
-
properties.each do |option,value|
|
62
|
+
properties.each do |option, value|
|
63
|
+
value = replace_properties(value) if value.is_a?(String)
|
45
64
|
begin
|
46
|
-
|
47
|
-
value = replace_properties(value)
|
48
|
-
end
|
49
|
-
valve_instance.send("#{option}=", value)
|
50
|
-
|
65
|
+
valve_instance.send("#{option}=", value)
|
51
66
|
rescue TypeError => e
|
52
|
-
@logger.warn
|
67
|
+
@logger.warn "Incorrect type passed for property '#{option}' on valve " +
|
68
|
+
"'#{valve_instance.java_class}' (#{e.message}), skipping property"
|
53
69
|
rescue NoMethodError => e
|
54
|
-
@logger.warn
|
70
|
+
@logger.warn "Not settable property '#{option}' found on valve " +
|
71
|
+
"'#{valve_instance.java_class}', skipping property"
|
55
72
|
end
|
56
73
|
end
|
57
74
|
end
|
58
75
|
|
76
|
+
private
|
77
|
+
|
78
|
+
def camelize(string)
|
79
|
+
string = string.sub(/^[a-z\d]*/) { $&.capitalize }
|
80
|
+
string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
|
81
|
+
string
|
82
|
+
end
|
83
|
+
|
84
|
+
java_import 'org.apache.tomcat.util.IntrospectionUtils'
|
85
|
+
|
59
86
|
def replace_properties(text)
|
60
|
-
|
61
|
-
IntrospectionUtils.replace_properties(text, java.lang.System.getProperties(), nil)
|
87
|
+
IntrospectionUtils.replace_properties(text, java.lang.System.getProperties, nil)
|
62
88
|
end
|
89
|
+
|
63
90
|
end
|
64
91
|
end
|
65
92
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'trinidad_valve_extension'
|
2
|
+
|
3
|
+
# alternative extension name so we can configure as:
|
4
|
+
# ---
|
5
|
+
# trap: false
|
6
|
+
# extensions:
|
7
|
+
# valves:
|
8
|
+
# AccessLogValve:
|
9
|
+
# directory: logs
|
10
|
+
# suffix: .log
|
11
|
+
# crawler_session_manager_valve:
|
12
|
+
# sessionInactiveInterval: 42
|
13
|
+
#
|
14
|
+
module Trinidad
|
15
|
+
module Extensions
|
16
|
+
ValvesWebAppExtension = ValveWebAppExtension
|
17
|
+
end
|
18
|
+
end
|
data/test/app/config.ru
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
environment: production
|
3
|
+
port: 4444
|
4
|
+
trap: false
|
5
|
+
extensions:
|
6
|
+
valve:
|
7
|
+
valves:
|
8
|
+
- className: "org.apache.catalina.valves.AccessLogValve"
|
9
|
+
pattern: "%h %l %u %t \"%r\" %s %b %T %S"
|
10
|
+
directory: "log"
|
11
|
+
prefix: "xxx_access"
|
12
|
+
suffix: ".xxx"
|
13
|
+
fileDateFormat: ".yyyy-MM-dd"
|
14
|
+
- className: org.apache.catalina.valves.CrawlerSessionManagerValve
|
15
|
+
sessionInactiveInterval: 42
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Trinidad
|
5
|
+
module Extensions
|
6
|
+
class ValveWebAppExtensionTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
APP_DIR = File.expand_path('app', File.dirname(__FILE__))
|
9
|
+
|
10
|
+
test "configures specified valves" do
|
11
|
+
options = YAML.load( File.read(File.join(APP_DIR, 'trinidad.yml')) )
|
12
|
+
Trinidad.configure!(options)
|
13
|
+
web_app = create_web_app; context = create_web_app_context(web_app)
|
14
|
+
|
15
|
+
Trinidad::Extensions.configure_webapp_extensions(web_app.extensions, tomcat, context)
|
16
|
+
|
17
|
+
assert_not_nil context.pipeline
|
18
|
+
assert_not_nil context.pipeline.valves
|
19
|
+
valves = context.pipeline.valves.to_a
|
20
|
+
|
21
|
+
assert_equal 3, valves.size, valves.map { |v| v.toString }.inspect
|
22
|
+
assert_instance_of org.apache.catalina.valves.AccessLogValve, valves[0], valves[0].class.name
|
23
|
+
assert_equal '.xxx', valves[0].getSuffix
|
24
|
+
assert_equal 'xxx_access', valves[0].getPrefix
|
25
|
+
assert_equal 'log', valves[0].getDirectory
|
26
|
+
assert_instance_of org.apache.catalina.valves.CrawlerSessionManagerValve, valves[1], valves[1].class.name
|
27
|
+
assert_equal 42, valves[1].getSessionInactiveInterval
|
28
|
+
end
|
29
|
+
|
30
|
+
test "configures alternatively with className resolved from keys" do
|
31
|
+
options = YAML.load( File.read(File.join(APP_DIR, 'trinidad-alt.yml')) )
|
32
|
+
Trinidad.configure!(options)
|
33
|
+
web_app = create_web_app; context = create_web_app_context(web_app)
|
34
|
+
|
35
|
+
Trinidad::Extensions.configure_webapp_extensions(web_app.extensions, tomcat, context)
|
36
|
+
|
37
|
+
assert_not_nil context.pipeline
|
38
|
+
assert_not_nil context.pipeline.valves
|
39
|
+
valves = context.pipeline.valves.to_a
|
40
|
+
|
41
|
+
assert_equal 4, valves.size, valves.map { |v| v.toString }.inspect
|
42
|
+
assert_instance_of org.apache.catalina.valves.AccessLogValve, valves[0], valves[0].class.name
|
43
|
+
assert_equal '.log', valves[0].getSuffix
|
44
|
+
assert_equal 'logs', valves[0].getDirectory
|
45
|
+
assert_instance_of org.apache.catalina.valves.CrawlerSessionManagerValve, valves[1], valves[1].class.name
|
46
|
+
assert_instance_of org.apache.catalina.valves.RemoteAddrValve, valves[2], valves[2].class.name
|
47
|
+
assert_equal "127\\.0\\.0\\.1", valves[2].getAllow
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def tomcat
|
53
|
+
@tomcat ||= org.apache.catalina.startup.Tomcat.new
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_web_app(config = {})
|
57
|
+
Trinidad::WebApp.create({
|
58
|
+
:context_path => '/', :web_app_dir => APP_DIR
|
59
|
+
}.merge(config)
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_web_app_context(context_dir = APP_DIR, web_app_or_context_path = '/')
|
64
|
+
context_path, lifecycle = web_app_or_context_path, nil
|
65
|
+
if web_app_or_context_path.is_a?(Trinidad::WebApp)
|
66
|
+
context_path = web_app_or_context_path.context_path
|
67
|
+
lifecycle = web_app_or_context_path.define_lifecycle
|
68
|
+
end
|
69
|
+
context = tomcat.addWebapp(context_path, context_dir.to_s)
|
70
|
+
context_config = org.apache.catalina.startup.ContextConfig.new
|
71
|
+
context.addLifecycleListener context_config
|
72
|
+
context.addLifecycleListener lifecycle if lifecycle
|
73
|
+
context
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -1,69 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
## this file, feel free to delete any comments that begin with two hash marks.
|
5
|
-
## You can find comprehensive Gem::Specification documentation, at
|
6
|
-
## http://docs.rubygems.org/read/chapter/20
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.specification_version = 2 if s.respond_to? :specification_version=
|
9
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
|
-
s.rubygems_version = '1.3.5'
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "trinidad_valve_extension/version"
|
11
4
|
|
12
|
-
|
13
|
-
## If your rubyforge_project name is different, then edit it and comment out
|
14
|
-
## the sub! line in the Rakefile
|
5
|
+
Gem::Specification.new do |s|
|
15
6
|
s.name = 'trinidad_valve_extension'
|
16
|
-
s.version =
|
17
|
-
s.date = '2011-08-22'
|
7
|
+
s.version = Trinidad::Extensions::Valve::VERSION
|
18
8
|
s.rubyforge_project = 'trinidad_valve_extension'
|
19
|
-
|
20
|
-
## Make sure your summary is short. The description may be as long
|
21
|
-
## as you like.
|
9
|
+
|
22
10
|
s.summary = "Trinidad extension to add and configure Tomcat valves"
|
23
|
-
s.description = "Trinidad extension to add and configure Tomcat valves.
|
24
|
-
|
25
|
-
|
26
|
-
## better to set the email to an email list or something. If you don't have
|
27
|
-
## a custom homepage, consider using your GitHub URL or the like.
|
11
|
+
s.description = "Trinidad extension to add and configure Tomcat valves. " +
|
12
|
+
"Built-in Tomcat valves are always available but any valve present in the class-path can be used."
|
13
|
+
|
28
14
|
s.authors = ["Michael Leinartas"]
|
29
15
|
s.email = 'mleinartas@gmail.com'
|
30
|
-
s.homepage = 'http://github.com/
|
31
|
-
|
32
|
-
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
33
|
-
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
16
|
+
s.homepage = 'http://github.com/trinidad/trinidad_valve_extension'
|
17
|
+
|
34
18
|
s.require_paths = %w[lib]
|
35
|
-
|
36
|
-
|
37
|
-
s.executables = []
|
38
|
-
#s.default_executable = ''
|
39
|
-
|
40
|
-
## Specify any RDoc options here. You'll want to add your README and
|
41
|
-
## LICENSE files to the extra_rdoc_files list.
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
|
42
21
|
s.rdoc_options = ["--charset=UTF-8"]
|
43
|
-
s.extra_rdoc_files = %w[README LICENSE]
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
s.
|
48
|
-
|
49
|
-
|
50
|
-
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
51
|
-
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
52
|
-
# = MANIFEST =
|
53
|
-
s.files = %w[
|
54
|
-
History.txt
|
55
|
-
LICENSE
|
56
|
-
README
|
57
|
-
Rakefile
|
58
|
-
lib/trinidad_valve_extension.rb
|
59
|
-
trinidad_valve_extension.gemspec
|
60
|
-
]
|
61
|
-
# = MANIFEST =
|
62
|
-
|
63
|
-
## Test files will be grabbed from the file list. Make sure the path glob
|
64
|
-
## matches what you actually use.
|
65
|
-
## s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
66
|
-
|
67
|
-
#s.post_install_message = <<TEXT
|
68
|
-
#TEXT
|
22
|
+
s.extra_rdoc_files = %w[ README.md LICENSE ]
|
23
|
+
|
24
|
+
s.add_dependency('trinidad', '>= 1.3.5')
|
25
|
+
|
26
|
+
s.add_development_dependency('rake')
|
27
|
+
s.add_development_dependency('test-unit')
|
28
|
+
s.add_development_dependency('mocha')
|
69
29
|
end
|
metadata
CHANGED
@@ -1,80 +1,118 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinidad_valve_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
version: "0.4"
|
4
|
+
prerelease:
|
5
|
+
version: "0.5"
|
9
6
|
platform: ruby
|
10
7
|
authors:
|
11
|
-
- Michael Leinartas
|
8
|
+
- Michael Leinartas
|
12
9
|
autorequire:
|
13
10
|
bindir: bin
|
14
11
|
cert_chain: []
|
15
12
|
|
16
|
-
date:
|
17
|
-
default_executable:
|
13
|
+
date: 2012-07-31 00:00:00 Z
|
18
14
|
dependencies:
|
19
|
-
- !ruby/object:Gem::Dependency
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: trinidad
|
17
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.3.5
|
23
|
+
requirement: *id001
|
24
|
+
prerelease: false
|
25
|
+
type: :runtime
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
requirement: *id002
|
35
|
+
prerelease: false
|
36
|
+
type: :development
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: test-unit
|
39
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
requirement: *id003
|
46
|
+
prerelease: false
|
47
|
+
type: :development
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: mocha
|
50
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
requirement: *id004
|
57
|
+
prerelease: false
|
58
|
+
type: :development
|
59
|
+
description: Trinidad extension to add and configure Tomcat valves. Built-in Tomcat valves are always available but any valve present in the class-path can be used.
|
34
60
|
email: mleinartas@gmail.com
|
35
61
|
executables: []
|
36
62
|
|
37
63
|
extensions: []
|
38
64
|
|
39
65
|
extra_rdoc_files:
|
40
|
-
- README
|
41
|
-
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- LICENSE
|
42
68
|
files:
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
-
|
49
|
-
|
50
|
-
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- History.txt
|
72
|
+
- LICENSE
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- lib/trinidad_valve_extension.rb
|
76
|
+
- lib/trinidad_valve_extension/version.rb
|
77
|
+
- lib/trinidad_valves_extension.rb
|
78
|
+
- test/app/config.ru
|
79
|
+
- test/app/trinidad-alt.yml
|
80
|
+
- test/app/trinidad.yml
|
81
|
+
- test/test_helper.rb
|
82
|
+
- test/trinidad_valve_extension_test.rb
|
83
|
+
- trinidad_valve_extension.gemspec
|
84
|
+
homepage: http://github.com/trinidad/trinidad_valve_extension
|
51
85
|
licenses: []
|
52
86
|
|
53
87
|
post_install_message:
|
54
88
|
rdoc_options:
|
55
|
-
- --charset=UTF-8
|
89
|
+
- --charset=UTF-8
|
56
90
|
require_paths:
|
57
|
-
- lib
|
91
|
+
- lib
|
58
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
59
94
|
requirements:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 2
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
65
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
66
103
|
requirements:
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 2
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
72
110
|
requirements: []
|
73
111
|
|
74
112
|
rubyforge_project: trinidad_valve_extension
|
75
|
-
rubygems_version: 1.
|
113
|
+
rubygems_version: 1.8.15
|
76
114
|
signing_key:
|
77
|
-
specification_version:
|
115
|
+
specification_version: 3
|
78
116
|
summary: Trinidad extension to add and configure Tomcat valves
|
79
117
|
test_files: []
|
80
118
|
|
data/README
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
Trinidad Valve Extension
|
2
|
-
========================
|
3
|
-
|
4
|
-
# DESCRIPTION
|
5
|
-
|
6
|
-
This is an extension to allow Tomcat valves to be configured and attached to webapps running under Trinidad. Any valve accessible within the classpath can be used. Built-in Tomcat valves are available without extra dependencies. A list of available built-in valves can be found at: http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
|
7
|
-
|
8
|
-
# INSTALLATION
|
9
|
-
|
10
|
-
jruby -S gem install trinidad_valve_extension
|
11
|
-
|
12
|
-
# CONFIGURATION
|
13
|
-
|
14
|
-
This extension will configure valves from a list of hashes that contain the properties that configure each valve. 'className' is used to define what valve class is being configured, just as when configuring tomcat using the traditional context.xml. Substitutions are done with system properties for values referenced within ${}.
|
15
|
-
|
16
|
-
To enable the extension, add the 'valve' element to the 'extensions' key and define at least one valve. An example of an AccessLogValve:
|
17
|
-
|
18
|
-
---
|
19
|
-
extensions:
|
20
|
-
valve:
|
21
|
-
valves:
|
22
|
-
- className: "org.apache.catalina.valves.AccessLogValve"
|
23
|
-
directory: "log"
|
24
|
-
prefix: "access_log"
|
25
|
-
fileDateFormat: ".yyyy-MM-dd"
|
26
|
-
suffix: ".log"
|
27
|
-
pattern: "%h %l %u %t \"%r\" %s %b %T %S"
|
28
|
-
|
29
|
-
|
30
|
-
You can find further information on how to write your own extension in the wiki: http://wiki.github.com/calavera/trinidad/extensions
|
31
|
-
|
32
|
-
# Copyright
|
33
|
-
Copyright (c) 2011 Michael Leinartas. See LICENSE for details.
|