Class: UcbDeployer::Deployer
Abstract
- Inherits:
-
Object
- Object
- UcbDeployer::Deployer
show all
- Defined in:
- lib/ucb_deployer/deployer.rb
Overview
This class is abstract.
Subclass and override {#export, #build, #configure, #deploy,
#rollback} to implement a custom UcbDeployer class
Constant Summary
collapse
- CONFIG_OPTIONS =
[
:build_dir,
:deploy_dir,
:war_name,
:cas_service_url,
:cas_server_url,
:data_dir,
:maintenance_file_dir,
:svn_project_url,
]
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#debug_mode ⇒ Object
Returns the value of attribute debug_mode.
23
24
25
|
# File 'lib/ucb_deployer/deployer.rb', line 23
def debug_mode
@debug_mode
end
|
#version ⇒ Object
Returns the value of attribute version.
23
24
25
|
# File 'lib/ucb_deployer/deployer.rb', line 23
def version
@version
end
|
Instance Method Details
#build ⇒ Object
34
35
36
|
# File 'lib/ucb_deployer/deployer.rb', line 34
def build()
raise NotImplementedError
end
|
30
31
32
|
# File 'lib/ucb_deployer/deployer.rb', line 30
def configure()
raise NotImplementedError
end
|
#debug(str) ⇒ Object
83
84
85
|
# File 'lib/ucb_deployer/deployer.rb', line 83
def debug(str)
UcbDeployer.debug(str)
end
|
#deploy ⇒ Object
42
43
44
|
# File 'lib/ucb_deployer/deployer.rb', line 42
def deploy()
raise NotImplementedError
end
|
#disable_web ⇒ Object
91
92
93
94
95
96
97
98
|
# File 'lib/ucb_deployer/deployer.rb', line 91
def disable_web()
return unless maintenance_file_dir()
maint_start = Time.now.strftime("%m-%d-%Y %H:%M:%S")
template = ERB.new(maintenance_template)
File.open("#{maintenance_file_dir}/maintenance.html", "w") do |f|
f.puts template.result(binding)
end
end
|
#enable_web ⇒ Object
100
101
102
103
|
# File 'lib/ucb_deployer/deployer.rb', line 100
def enable_web()
return unless maintenance_file_dir()
FileUtils.rm("#{maintenance_file_dir}/maintenance.html")
end
|
#export ⇒ Object
26
27
28
|
# File 'lib/ucb_deployer/deployer.rb', line 26
def export()
raise NotImplementedError
end
|
#info(str) ⇒ Object
87
88
89
|
# File 'lib/ucb_deployer/deployer.rb', line 87
def info(str)
UcbDeployer.info(str)
end
|
#load_config(config_file) ⇒ Object
Configuration options are:
build_dir
deploy_dir
war_name
svn_project_url
cas_service_url
cas_server_url
maintenance_file_dir
data_dir
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/ucb_deployer/deployer.rb', line 58
def load_config(config_file)
if !(hash = YAML.load_file(config_file))
raise(ConfigError, "Config file [#{config_file}] contains no options.")
end
debug("Config options:")
debug("")
hash.each do |key, val|
debug("#{key}: #{val}")
if CONFIG_OPTIONS.include?(key.to_sym)
self.send("#{key}=", val)
else
raise(ConfigError, "Unrecognized Option: #{key}")
end
end
end
|
#maintenance_template ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/ucb_deployer/deployer.rb', line 105
def maintenance_template()
%q{
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Site Maintenance</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 35em;
padding: 0 3em;
margin: 3em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<div class="dialog">
<h1>Site Maintenance</h1>
<p>
The site is down for maintenance as of: <strong><%= maint_start %></strong> <br/>
it should be available shortly.
</p>
</div>
</body>
</html>
}
end
|
#rollback ⇒ Object
38
39
40
|
# File 'lib/ucb_deployer/deployer.rb', line 38
def rollback()
raise NotImplementedError
end
|