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
32
33
|
# File 'lib/ucb_deployer/deployer.rb', line 32
def build()
end
|
29
30
|
# File 'lib/ucb_deployer/deployer.rb', line 29
def configure()
end
|
#debug(str) ⇒ Object
70
71
72
|
# File 'lib/ucb_deployer/deployer.rb', line 70
def debug(str)
UcbDeployer.debug(str)
end
|
#deploy ⇒ Object
38
39
|
# File 'lib/ucb_deployer/deployer.rb', line 38
def deploy()
end
|
#disable_web ⇒ Object
78
79
80
81
82
83
84
85
|
# File 'lib/ucb_deployer/deployer.rb', line 78
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
87
88
89
90
|
# File 'lib/ucb_deployer/deployer.rb', line 87
def enable_web()
return unless maintenance_file_dir()
FileUtils.rm("#{maintenance_file_dir}/maintenance.html")
end
|
#export ⇒ Object
26
27
|
# File 'lib/ucb_deployer/deployer.rb', line 26
def export()
end
|
#info(str) ⇒ Object
74
75
76
|
# File 'lib/ucb_deployer/deployer.rb', line 74
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/ucb_deployer/deployer.rb', line 53
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'lib/ucb_deployer/deployer.rb', line 92
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
35
36
|
# File 'lib/ucb_deployer/deployer.rb', line 35
def rollback()
end
|