Class: UcbDeployer::ConfluenceDeployer
- Defined in:
- lib/ucb_deployer/confluence_deployer.rb
Constant Summary
Constants inherited from Deployer
Instance Attribute Summary
Attributes inherited from Deployer
Instance Method Summary collapse
- #build ⇒ Object
- #cas_authenticator_class ⇒ Object
-
#config_confluence_init_properties ⇒ Object
Sets the confluence.home property in the file: confluence-init.properties.
-
#config_seraph_config_xml ⇒ Object
Updates the confluence seraph_config.xml file with the soulwing authenticator.
-
#config_web_xml ⇒ Object
Updates the confluence web.xml file with the soulwing (CAS library) authentication configuration.
-
#config_xwork_xml ⇒ Object
Alter xwork.xml so soulwing authenticator works with CAS.
- #configure ⇒ Object
-
#confluence_init_properties ⇒ Object
Shortcut to confluence confluence-init.properties file.
- #deploy ⇒ Object
- #export ⇒ Object
-
#initialize(config_file = "#{ENV['HOME']}/.ucb_deployer/config/confluence/deploy.yml") ⇒ ConfluenceDeployer
constructor
A new instance of ConfluenceDeployer.
-
#reshuffle_jars ⇒ Object
Remove application jars that have been installed at the container level.
- #rollback ⇒ Object
-
#seraph_config_xml ⇒ Object
Shortcut to confluence seraph-config.xml file.
- #seraph_config_xml_token ⇒ Object
- #svn_base_url ⇒ Object
- #svn_username ⇒ Object
-
#web_xml ⇒ Object
Shortcut to confluence web.xml file.
- #web_xml_token ⇒ Object
-
#xwork_xml ⇒ Object
Shortcut to xwork.xml file.
Methods inherited from Deployer
#debug, #deployer_home, #disable_web, #enable_web, #info, #load_config, #maintenance_template, #resources_dir
Constructor Details
#initialize(config_file = "#{ENV['HOME']}/.ucb_deployer/config/confluence/deploy.yml") ⇒ ConfluenceDeployer
Returns a new instance of ConfluenceDeployer.
5 6 7 8 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 5 def initialize(config_file = "#{ENV['HOME']}/.ucb_deployer/config/confluence/deploy.yml") self.debug("Using config file: #{config_file}") self.load_config(config_file) end |
Instance Method Details
#build ⇒ Object
28 29 30 31 32 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 28 def build() Dir.chdir("#{build_dir}/src") do `sh #{build_dir}/src/build.sh` end end |
#cas_authenticator_class ⇒ Object
87 88 89 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 87 def cas_authenticator_class() "org.soulwing.cas.apps.atlassian.ConfluenceCasAuthenticator" end |
#config_confluence_init_properties ⇒ Object
Sets the confluence.home property in the file: confluence-init.properties.
137 138 139 140 141 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 137 def config_confluence_init_properties() File.open(self.confluence_init_properties, "w") do |io| io.puts("confluence.home=#{data_dir}") end end |
#config_seraph_config_xml ⇒ Object
Updates the confluence seraph_config.xml file with the soulwing authenticator.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 116 def config_seraph_config_xml() seraph_xml = File.readlines(self.seraph_config_xml) seraph_xml = seraph_xml.map do |line| if m = /(#{Regexp.quote(seraph_config_xml_token)})/.match(line) debug(m[0]) debug("#{m.pre_match}#{cas_authenticator_class}#{m.post_match}") "#{m.pre_match}#{cas_authenticator_class}#{m.post_match}" else line end end File.open(self.seraph_config_xml, "w") do |io| seraph_xml.each { |line| io.puts(line) } end end |
#config_web_xml ⇒ Object
Updates the confluence web.xml file with the soulwing (CAS library) authentication configuration
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 95 def config_web_xml() web_xml = File.readlines(self.web_xml) web_xml = web_xml.map do |line| if line =~ /#{web_xml_token}/ template = File.open("#{DEPLOYER_HOME}/resources/confluence_cas_web.xml") { |f| f.read } ERB.new(template).result(self.send(:binding)) else line end end File.open(self.web_xml, "w") do |io| web_xml.each { |line| io.puts(line) } end end |
#config_xwork_xml ⇒ Object
Alter xwork.xml so soulwing authenticator works with CAS
153 154 155 156 157 158 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 153 def config_xwork_xml() template = File.open("#{UcbDeployer::RESOURCES_DIR}/xwork.xml") { |f| f.read } xml = ERB.new(template).result(self.send(:binding)) FileUtils.touch(xwork_xml()) File.open(xwork_xml(), "w") { |io| io.puts(xml) } end |
#configure ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 20 def configure() config_web_xml() config_seraph_config_xml() config_confluence_init_properties() config_xwork_xml() reshuffle_jars() end |
#confluence_init_properties ⇒ Object
Shortcut to confluence confluence-init.properties file
75 76 77 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 75 def confluence_init_properties() "#{build_dir}/src/confluence/WEB-INF/classes/confluence-init.properties" end |
#deploy ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 34 def deploy() if File.exists?("#{deploy_dir}/#{war_name}") FileUtils.rm_rf(Dir["#{deploy_dir}/#{war_name}"]) end FileUtils.mkdir("#{deploy_dir}/#{war_name}") FileUtils.mv("#{build_dir}/src/dist/confluence-#{version}.war", "#{deploy_dir}/#{war_name}/#{war_name}.war") `cd #{deploy_dir}/#{war_name}/ && jar -xvf #{war_name}.war` FileUtils.rm("#{deploy_dir}/#{war_name}/#{war_name}.war") end |
#export ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 10 def export() UcbDeployer.debug("Exporting from: #{svn_project_url}/confluence-#{version}") Dir.chdir("#{build_dir}") do FileUtils.rm_rf("#{build_dir}/src") `svn export #{svn_project_url}/confluence-#{version}` FileUtils.mv("confluence-#{version}", "src") end $stdout.puts("Export Completed") end |
#reshuffle_jars ⇒ Object
Remove application jars that have been installed at the container level.
163 164 165 166 167 168 169 170 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 163 def reshuffle_jars() FileUtils.cp(Dir["#{UcbDeployer::RESOURCES_DIR}/soulwing-casclient-*"], "#{build_dir}/src/confluence/WEB-INF/lib/") # Remove the jars that are installed at the container level ["postgresql", "activation", "mail"].each do |jar| FileUtils.rm_rf(Dir["#{build_dir}/src/confluence/WEB-INF/lib/#{jar}-*"]) end end |
#rollback ⇒ Object
47 48 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 47 def rollback() end |
#seraph_config_xml ⇒ Object
Shortcut to confluence seraph-config.xml file
68 69 70 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 68 def seraph_config_xml() "#{build_dir}/src/confluence/WEB-INF/classes/seraph-config.xml" end |
#seraph_config_xml_token ⇒ Object
83 84 85 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 83 def seraph_config_xml_token() "com.atlassian.confluence.user.ConfluenceAuthenticator" end |
#svn_base_url ⇒ Object
54 55 56 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 54 def svn_base_url() @svn_base_url || "svn.berkeley.edu/svn/ist-svn/berkeley/projects/ist/as/webapps/confluence_archives" end |
#svn_username ⇒ Object
50 51 52 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 50 def svn_username() @svn_username || "app_relmgt" end |
#web_xml ⇒ Object
Shortcut to confluence web.xml file
61 62 63 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 61 def web_xml() "#{build_dir}/src/confluence/WEB-INF/web.xml" end |
#web_xml_token ⇒ Object
79 80 81 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 79 def web_xml_token() "<!-- Uncomment the following to disable the space export long running task. -->" end |
#xwork_xml ⇒ Object
Shortcut to xwork.xml file
146 147 148 |
# File 'lib/ucb_deployer/confluence_deployer.rb', line 146 def xwork_xml() "#{build_dir}/src/confluence/WEB-INF/classes/xwork.xml" end |