tccbuilder 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/tc6confbldr +5 -0
- data/lib/tccbuilder.rb +50 -0
- data/lib/tccbuilder/cmdlet.rb +69 -0
- data/lib/tccbuilder/errors.rb +8 -0
- data/lib/tccbuilder/options.rb +111 -0
- data/lib/tccbuilder/tomcat6.rb +6 -0
- data/lib/tccbuilder/tomcat6/server_xml.rb +84 -0
- data/lib/tccbuilder/tomcat6/virtual_host.rb +111 -0
- data/tccbuilder.gemspec +60 -0
- data/test/helper.rb +9 -0
- data/test/test_tccbuilder.rb +4 -0
- metadata +85 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Jamie Winsor
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= TCCBuilder
|
2
|
+
|
3
|
+
== Synopsis
|
4
|
+
Manipulates an existing Tomcat server.xml file to assist in automated
|
5
|
+
deployments and configurations.
|
6
|
+
|
7
|
+
== Note on Patches/Pull Requests
|
8
|
+
|
9
|
+
* Fork the project.
|
10
|
+
* Make your feature addition or bug fix.
|
11
|
+
* Add tests for it. This is important so I don't break it in a
|
12
|
+
future version unintentionally.
|
13
|
+
* Commit, do not mess with rakefile, version, or history.
|
14
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
15
|
+
* Send me a pull request. Bonus points for topic branches.
|
16
|
+
|
17
|
+
== Copyright
|
18
|
+
|
19
|
+
Copyright (c) 2010 Jamie Winsor. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "tccbuilder"
|
8
|
+
gem.summary = %Q{Utilities to assist in configuring Tomcat via Ruby or the command line}
|
9
|
+
gem.description = %Q{Utilities to assist in configuring Tomcat via Ruby or the command line}
|
10
|
+
gem.email = "resetexistence@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/resetexistence/tccbuilder"
|
12
|
+
gem.authors = ["Jamie Winsor"]
|
13
|
+
end
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/test_*.rb'
|
23
|
+
test.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |test|
|
29
|
+
test.libs << 'test'
|
30
|
+
test.pattern = 'test/**/test_*.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :rcov do
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
task :test => :check_dependencies
|
40
|
+
|
41
|
+
task :default => :test
|
42
|
+
|
43
|
+
require 'rake/rdoctask'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "tccbuilder #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.1
|
data/bin/tc6confbldr
ADDED
data/lib/tccbuilder.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
class TCCBuilder
|
2
|
+
require 'ostruct'
|
3
|
+
require 'rexml/document'
|
4
|
+
require 'tccbuilder/errors'
|
5
|
+
require 'tccbuilder/cmdlet'
|
6
|
+
|
7
|
+
attr_reader :options
|
8
|
+
attr_reader :version
|
9
|
+
attr_reader :server_xml
|
10
|
+
FORMATTER = REXML::Formatters::Pretty.new
|
11
|
+
|
12
|
+
def initialize(version, options)
|
13
|
+
@options = options
|
14
|
+
@version = version
|
15
|
+
klass = case @version
|
16
|
+
when 6
|
17
|
+
require 'tccbuilder/tomcat6'
|
18
|
+
Tomcat6::ServerXML
|
19
|
+
else
|
20
|
+
raise UnsupportedTomcatVersion, "Unsupported Tomcat version: #{@version}"
|
21
|
+
end
|
22
|
+
@server_xml = klass.new(@options.config_file)
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_virtual_host
|
26
|
+
raise VirtualHostAlreadyExists if self.server_xml.virtual_host_exists?(self.options.name, self.options.service)
|
27
|
+
self.server_xml.add_virtual_host(self.options.name, self.options.service, self.options)
|
28
|
+
self.save
|
29
|
+
end
|
30
|
+
|
31
|
+
def rm_virtual_host
|
32
|
+
raise VirtualHostNotFound unless self.server_xml.virtual_host_exists?(self.options.name, self.options.service)
|
33
|
+
self.server_xml.remove_virtual_host(self.options.name, self.options.service)
|
34
|
+
self.save
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_virtual_host
|
38
|
+
# Stub
|
39
|
+
# self.server_xml.update_virtual_host(self.options.name, self.options.service)
|
40
|
+
# self.save
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
def save
|
46
|
+
File.open(self.server_xml.file, "w+") do |f|
|
47
|
+
FORMATTER.write(self.server_xml.xml, f)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
class TCCBuilder
|
2
|
+
class Cmdlet
|
3
|
+
require 'tccbuilder/options'
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def run!(bin_name, version, *arguments)
|
7
|
+
@options = Options.new(bin_name, arguments)
|
8
|
+
|
9
|
+
if @options.invalid_command
|
10
|
+
em_puts "Invalid command: #{@options.invalid_command}"
|
11
|
+
@options.show_help = true
|
12
|
+
end
|
13
|
+
|
14
|
+
if @options.missing_options && !@options.invalid_command
|
15
|
+
em_puts "Missing options: #{@options.missing_options.join(', ')}"
|
16
|
+
@options.show_help = true
|
17
|
+
end
|
18
|
+
|
19
|
+
if @options.invalid_option
|
20
|
+
em_puts @options.invalid_option
|
21
|
+
@options.show_help = true
|
22
|
+
end
|
23
|
+
|
24
|
+
if @options.show_help
|
25
|
+
puts @options.opts
|
26
|
+
Kernel.abort
|
27
|
+
end
|
28
|
+
|
29
|
+
tccbuilder = TCCBuilder.new(version, @options)
|
30
|
+
|
31
|
+
begin
|
32
|
+
case @options.command
|
33
|
+
when "add_vhost"
|
34
|
+
tccbuilder.add_virtual_host
|
35
|
+
em_puts "VirtualHost successfully added! [#{@options.name}]"
|
36
|
+
when "rm_vhost"
|
37
|
+
tccbuilder.rm_virtual_host
|
38
|
+
em_puts "VirtualHost successfully deleted! [#{@options.name}]"
|
39
|
+
end
|
40
|
+
return 0
|
41
|
+
rescue VirtualHostAlreadyExists
|
42
|
+
em_puts "Virtual Host already exists."
|
43
|
+
exit 0
|
44
|
+
rescue VirtualHostNotFound
|
45
|
+
em_puts "Virtual Host not found."
|
46
|
+
exit 0
|
47
|
+
rescue ElementNotFound, Errno::ENOENT => err
|
48
|
+
em_abort err
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
protected
|
53
|
+
|
54
|
+
def em_abort(str)
|
55
|
+
Kernel.abort console_format(str)
|
56
|
+
end
|
57
|
+
|
58
|
+
def em_puts(str)
|
59
|
+
puts console_format(str)
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def console_format(str)
|
65
|
+
"[Tomcat Config Helper] #{str}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class TCCBuilder
|
2
|
+
class TCCBuilderError < StandardError; end
|
3
|
+
class UnsupportedTomcatVersion < TCCBuilderError; end
|
4
|
+
class VirtualHostNotFound < TCCBuilderError; end
|
5
|
+
class VirtualHostAlreadyExists < TCCBuilderError; end
|
6
|
+
class XMLError < TCCBuilderError; end
|
7
|
+
class ElementNotFound < XMLError; end
|
8
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
class TCCBuilder
|
4
|
+
class Options < OpenStruct
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
attr_reader :opts
|
8
|
+
attr_reader :command
|
9
|
+
attr_reader :orig_args
|
10
|
+
|
11
|
+
HELP_FLAG = "-h"
|
12
|
+
VALID_COMMANDS = ['add_vhost', 'rm_vhost']
|
13
|
+
|
14
|
+
def initialize(bin_name, args)
|
15
|
+
super()
|
16
|
+
|
17
|
+
# First argument should be a valid command or help_flag
|
18
|
+
self.command = args.slice!(0)
|
19
|
+
|
20
|
+
# Setup default options
|
21
|
+
self.service = "Catalina"
|
22
|
+
|
23
|
+
@opts = OptionParser.new do |opt|
|
24
|
+
opt.banner = "Usage: #{bin_name} [command] [options]"
|
25
|
+
opt.separator ""
|
26
|
+
opt.separator "Commands:\n"
|
27
|
+
VALID_COMMANDS.each do |cmd|
|
28
|
+
opt.separator "\t#{cmd}\n"
|
29
|
+
end
|
30
|
+
opt.separator ""
|
31
|
+
opt.separator "Specific options:"
|
32
|
+
|
33
|
+
opt.on("-c", "--config CONFIG", String, "Path to Tomcat server.xml config file.") do |f|
|
34
|
+
self.config_file = f
|
35
|
+
end
|
36
|
+
opt.on("-n", "--hostname HOSTNAME", String, "Hostname of the target Virtual Host.") do |f|
|
37
|
+
self.name = f
|
38
|
+
end
|
39
|
+
opt.on("-s", "--service [SERVICE]", String, "Service to place Virtual Host under. (Default: Catalina)") do |f|
|
40
|
+
self.service = f
|
41
|
+
end
|
42
|
+
opt.on("-a", "--app-base APP_BASE", String, "Application base of Virtual Host.") do |f|
|
43
|
+
self.app_base = f
|
44
|
+
end
|
45
|
+
opt.on("-p", "--path [PATH]", String, "Path of the Virtual Host's context.") do |f|
|
46
|
+
self.path = f
|
47
|
+
end
|
48
|
+
opt.on("-d", "--doc-base [DOC_BASE]", String, "Document base of the Virtual Host's context.") do |f|
|
49
|
+
self.doc_base = f
|
50
|
+
end
|
51
|
+
opt.on("--debug-level [LEVEL]", Integer, "Debug level of Virtual Host's context.") do |f|
|
52
|
+
self.debug = f
|
53
|
+
end
|
54
|
+
opt.on("--aliases ALIAS_1,ALIAS_2", Array, "Optional list of aliases for Virtual Host.") do |list|
|
55
|
+
self.aliases = list
|
56
|
+
end
|
57
|
+
opt.on("-C", "--class-name [CLASS_NAME]", String, "Java class name of the implementation to use.") do |f|
|
58
|
+
self.class_name = f
|
59
|
+
end
|
60
|
+
opt.on("--disable-unpack-wars", "Enable unpack wars.") do
|
61
|
+
self.unpack_wars = false
|
62
|
+
end
|
63
|
+
opt.on("--reloadable", "Enable reloadable flag.") do
|
64
|
+
self.reloadable = true
|
65
|
+
end
|
66
|
+
opt.on("--disable-auto-deploy", "Disables periodic checks for new or updated web applications while running.") do
|
67
|
+
self.auto_deploy = false
|
68
|
+
end
|
69
|
+
opt.on("--background-processor-delay", "Sets the delay in seconds between invocation of backgroundProcess method on host and child containers.") do |f|
|
70
|
+
self.background_processor_delay = f
|
71
|
+
end
|
72
|
+
opt.on("--disable-deploy-on-startup", "Indicates if web applications from this host should be automatically deployed when Tomcat starts.") do
|
73
|
+
self.deploy_on_startup = false
|
74
|
+
end
|
75
|
+
opt.on_tail(HELP_FLAG, "--help", "Show this message.") do
|
76
|
+
self.show_help = true
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
begin
|
81
|
+
@opts.parse!(args)
|
82
|
+
rescue OptionParser::InvalidOption => e
|
83
|
+
self.invalid_option = e
|
84
|
+
end
|
85
|
+
|
86
|
+
if self.command == HELP_FLAG
|
87
|
+
self.show_help = true
|
88
|
+
else
|
89
|
+
mandatory_flags = [:config_file, :name]
|
90
|
+
missing_required_opts = mandatory_flags.select { |param| self.send(param).nil? }
|
91
|
+
unless missing_required_opts.empty?
|
92
|
+
self.missing_options = missing_required_opts
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def command=(command)
|
100
|
+
if Options.valid_command?(command)
|
101
|
+
@command = command
|
102
|
+
else
|
103
|
+
self.invalid_command = command
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.valid_command?(command)
|
108
|
+
VALID_COMMANDS.any? { |cmd| cmd == command } || command == HELP_FLAG
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class TCCBuilder
|
2
|
+
module Tomcat6
|
3
|
+
class ServerXML
|
4
|
+
require 'ostruct'
|
5
|
+
require 'rexml/document'
|
6
|
+
|
7
|
+
attr_reader :xml
|
8
|
+
attr_reader :file
|
9
|
+
FORMATTER = REXML::Formatters::Pretty.new
|
10
|
+
|
11
|
+
def initialize(file)
|
12
|
+
raw = File.read(file)
|
13
|
+
@file = file
|
14
|
+
@xml = REXML::Document.new(raw, :raw => :all).root
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_virtual_host(name, service, params)
|
18
|
+
host = VirtualHost.new(name, service)
|
19
|
+
|
20
|
+
# All implementations of Host support the following attribute:
|
21
|
+
host.app_base = params.app_base if params.respond_to?(:app_base)
|
22
|
+
host.auto_deploy = params.auto_deploy if params.respond_to?(:auto_deploy)
|
23
|
+
host.background_processor_delay = params.background_processor_delay if params.respond_to?(:background_processor_delay)
|
24
|
+
host.class_name = params.class_name if params.respond_to?(:class_name)
|
25
|
+
host.deploy_on_startup = params.deploy_on_startup if params.respond_to?(:deploy_on_startup)
|
26
|
+
# The standard implementation of Host is org.apache.catalina.core.StandardHost. It supports the following additional attributes:
|
27
|
+
host.unpack_wars = params.unpack_wars if params.respond_to?(:unpack_wars)
|
28
|
+
|
29
|
+
# All implementations of Context support the following attributes:
|
30
|
+
host.path = params.path if params.respond_to?(:path)
|
31
|
+
host.doc_base = params.doc_base if params.respond_to?(:doc_base)
|
32
|
+
host.debug = params.debug if params.respond_to?(:debug)
|
33
|
+
host.reloadable = params.reloadable if params.respond_to?(:reloadable)
|
34
|
+
|
35
|
+
if params.aliases
|
36
|
+
params.aliases.each do |al|
|
37
|
+
host.add_alias(al)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# TODO: Make valves configurable
|
42
|
+
host.add_valve "org.apache.catalina.valves.AccessLogValve", :directory => "logs",
|
43
|
+
:prefix => "#{name}_access_log.",
|
44
|
+
:suffix => ".log",
|
45
|
+
:pattern => "common"
|
46
|
+
|
47
|
+
engine_element = get_engine_element(service)
|
48
|
+
engine_element.add_element(host.to_rexml)
|
49
|
+
end
|
50
|
+
|
51
|
+
def remove_virtual_host(name, service)
|
52
|
+
@xml.delete_element("Service[@name='#{service}']/Engine/Host[@name='#{name}']")
|
53
|
+
end
|
54
|
+
|
55
|
+
def update_virtual_host(name, service, params)
|
56
|
+
host = @xml.elements["Server[@name='#{service}']/Engine/Host[@name='#{name}']"]
|
57
|
+
end
|
58
|
+
|
59
|
+
def virtual_host_exists?(name, service)
|
60
|
+
host = @xml.elements["Service[@name='#{service}']/Engine/Host[@name='#{name}']"]
|
61
|
+
host.nil? ? false : true
|
62
|
+
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
|
66
|
+
def get_engine_element(service)
|
67
|
+
service_element = get_service_element(service)
|
68
|
+
engine_element = service_element.elements["Engine"]
|
69
|
+
if engine_element.nil?
|
70
|
+
raise ElementNotFound, "Engine element not found for Service: '#{service}'."
|
71
|
+
end
|
72
|
+
return engine_element
|
73
|
+
end
|
74
|
+
|
75
|
+
def get_service_element(service)
|
76
|
+
service_element = @xml.elements["Service[@name='#{service}']"]
|
77
|
+
if service_element.nil?
|
78
|
+
raise ElementNotFound, "Service element with name '#{service}' was not found."
|
79
|
+
end
|
80
|
+
return service_element
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
class TCCBuilder
|
2
|
+
module Tomcat6
|
3
|
+
class VirtualHost
|
4
|
+
attr_reader :service
|
5
|
+
|
6
|
+
attr_reader :app_base
|
7
|
+
attr_reader :auto_deploy
|
8
|
+
attr_reader :background_processor_delay
|
9
|
+
attr_reader :class_name
|
10
|
+
attr_reader :deploy_on_startup
|
11
|
+
attr_reader :name
|
12
|
+
attr_reader :unpack_wars
|
13
|
+
|
14
|
+
attr_reader :path
|
15
|
+
attr_reader :doc_base
|
16
|
+
attr_reader :debug
|
17
|
+
attr_reader :reloadable
|
18
|
+
|
19
|
+
attr_reader :aliases
|
20
|
+
|
21
|
+
def initialize(name, service)
|
22
|
+
@host_element = REXML::Element.new("Host")
|
23
|
+
@context_element = nil
|
24
|
+
@service = service
|
25
|
+
self.name = name
|
26
|
+
end
|
27
|
+
|
28
|
+
def app_base=(value)
|
29
|
+
add_host_attribute("appBase", value)
|
30
|
+
end
|
31
|
+
|
32
|
+
def auto_deploy=(value)
|
33
|
+
add_host_attribute("autoDeploy", value)
|
34
|
+
end
|
35
|
+
|
36
|
+
def background_processor_delay=(value)
|
37
|
+
add_host_attribute("backgroundProcessorDelay", value)
|
38
|
+
end
|
39
|
+
|
40
|
+
def class_name=(value)
|
41
|
+
add_host_attribute("className", value)
|
42
|
+
end
|
43
|
+
|
44
|
+
def deploy_on_startup=(value)
|
45
|
+
add_host_attribute("deployOnStartup", value)
|
46
|
+
end
|
47
|
+
|
48
|
+
def name
|
49
|
+
get_host_attribute("name")
|
50
|
+
end
|
51
|
+
|
52
|
+
def name=(value)
|
53
|
+
add_host_attribute("name", value)
|
54
|
+
end
|
55
|
+
|
56
|
+
def unpack_wars=(value)
|
57
|
+
add_host_attribute("unpackWars", value)
|
58
|
+
end
|
59
|
+
|
60
|
+
def path=(value)
|
61
|
+
add_context_attribute("path", value)
|
62
|
+
end
|
63
|
+
|
64
|
+
def doc_base=(value)
|
65
|
+
add_context_attribute("docBase", value)
|
66
|
+
end
|
67
|
+
|
68
|
+
def debug=(value)
|
69
|
+
add_context_attribute("debug", value)
|
70
|
+
end
|
71
|
+
|
72
|
+
def reloadable=(value)
|
73
|
+
add_context_attribute("reloadable", value)
|
74
|
+
end
|
75
|
+
|
76
|
+
def add_alias(text)
|
77
|
+
al = @host_element.add_element("Alias")
|
78
|
+
al.text = text
|
79
|
+
return al
|
80
|
+
end
|
81
|
+
|
82
|
+
def add_valve(class_name, options = {})
|
83
|
+
valve = @host_element.add_element("Valve")
|
84
|
+
valve.attributes["className"] = class_name
|
85
|
+
options.each do |key, value|
|
86
|
+
valve.attributes[key.to_s] = value
|
87
|
+
end
|
88
|
+
return valve
|
89
|
+
end
|
90
|
+
|
91
|
+
def to_rexml
|
92
|
+
@host_element
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def add_host_attribute(name, value)
|
98
|
+
@host_element.attributes[name] = value
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_host_attribute(name)
|
102
|
+
@host_element.attributes[name]
|
103
|
+
end
|
104
|
+
|
105
|
+
def add_context_attribute(name, value)
|
106
|
+
@context_element = host.add_element("Context") if @context_element.nil?
|
107
|
+
@context_element.attributes[name] = value
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/tccbuilder.gemspec
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{tccbuilder}
|
8
|
+
s.version = "0.2.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jamie Winsor"]
|
12
|
+
s.date = %q{2010-09-19}
|
13
|
+
s.default_executable = %q{tc6confbldr}
|
14
|
+
s.description = %q{Utilities to assist in configuring Tomcat via Ruby or the command line}
|
15
|
+
s.email = %q{resetexistence@gmail.com}
|
16
|
+
s.executables = ["tc6confbldr"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/tc6confbldr",
|
29
|
+
"lib/tccbuilder.rb",
|
30
|
+
"lib/tccbuilder/cmdlet.rb",
|
31
|
+
"lib/tccbuilder/errors.rb",
|
32
|
+
"lib/tccbuilder/options.rb",
|
33
|
+
"lib/tccbuilder/tomcat6.rb",
|
34
|
+
"lib/tccbuilder/tomcat6/server_xml.rb",
|
35
|
+
"lib/tccbuilder/tomcat6/virtual_host.rb",
|
36
|
+
"tccbuilder.gemspec",
|
37
|
+
"test/helper.rb",
|
38
|
+
"test/test_tccbuilder.rb"
|
39
|
+
]
|
40
|
+
s.homepage = %q{http://github.com/resetexistence/tccbuilder}
|
41
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubygems_version = %q{1.3.7}
|
44
|
+
s.summary = %q{Utilities to assist in configuring Tomcat via Ruby or the command line}
|
45
|
+
s.test_files = [
|
46
|
+
"test/helper.rb",
|
47
|
+
"test/test_tccbuilder.rb"
|
48
|
+
]
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
else
|
56
|
+
end
|
57
|
+
else
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/test/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tccbuilder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jamie Winsor
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-09-19 00:00:00 -07:00
|
19
|
+
default_executable: tc6confbldr
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Utilities to assist in configuring Tomcat via Ruby or the command line
|
23
|
+
email: resetexistence@gmail.com
|
24
|
+
executables:
|
25
|
+
- tc6confbldr
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- LICENSE
|
30
|
+
- README.rdoc
|
31
|
+
files:
|
32
|
+
- .document
|
33
|
+
- .gitignore
|
34
|
+
- LICENSE
|
35
|
+
- README.rdoc
|
36
|
+
- Rakefile
|
37
|
+
- VERSION
|
38
|
+
- bin/tc6confbldr
|
39
|
+
- lib/tccbuilder.rb
|
40
|
+
- lib/tccbuilder/cmdlet.rb
|
41
|
+
- lib/tccbuilder/errors.rb
|
42
|
+
- lib/tccbuilder/options.rb
|
43
|
+
- lib/tccbuilder/tomcat6.rb
|
44
|
+
- lib/tccbuilder/tomcat6/server_xml.rb
|
45
|
+
- lib/tccbuilder/tomcat6/virtual_host.rb
|
46
|
+
- tccbuilder.gemspec
|
47
|
+
- test/helper.rb
|
48
|
+
- test/test_tccbuilder.rb
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/resetexistence/tccbuilder
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options:
|
55
|
+
- --charset=UTF-8
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 1.3.7
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Utilities to assist in configuring Tomcat via Ruby or the command line
|
83
|
+
test_files:
|
84
|
+
- test/helper.rb
|
85
|
+
- test/test_tccbuilder.rb
|