-
-
Save goldmann/26b4727b769d10fe2a57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
require 'fileutils' | |
# Change here | |
bg_dist_name = "boxgrinder-torquebox" | |
bg_profile_name = "boxgrinder-rest" | |
# Change, if you *need* here | |
bg_profiles_dir = "#{bg_dist_name}/jboss/server" | |
jboss_version = "jboss-6.0.0.Final" | |
jboss_dist_zip = "jboss-as-distribution-6.0.0.Final.zip" | |
jboss_profiles_dir = "#{jboss_version}/server" | |
abort "Usage: ruby slimb.rb torquebox-dist-bin.zip" if ARGV.size != 1 | |
tb_dist_zip = ARGV.first | |
abort "File '#{tb_dist_zip}' doesn't exists" unless File.exists?(tb_dist_zip) | |
puts "Cleaning all sub-directories..." | |
Dir.entries( '.' ).each {| file | FileUtils.rm_rf(file) if File.directory?(file) and !(file =~ /^\./) } | |
puts "Extracting '#{tb_dist_zip}'..." | |
system "unzip -q #{tb_dist_zip}" | |
puts "Renaming the distribution directory..." | |
dirs = Dir.entries( '.' ).reject {| file | !File.directory?(file) or (file =~ /^\./) } | |
abort "There are more directories than one, please execute this script in a clean directory." if dirs.size > 1 | |
FileUtils.mv(dirs.first, bg_dist_name) | |
puts "Extracting JBoss AS distribution..." | |
system "unzip -q #{jboss_dist_zip}" | |
# | |
# Actual changes to dist | |
# | |
puts "Copying jbossweb-standalone profile to #{bg_profile_name}..." | |
FileUtils.cp_r("#{jboss_profiles_dir}/jbossweb-standalone", "#{bg_profiles_dir}/#{bg_profile_name}") | |
puts "Copying 'naming-jboss-beans.xml' from default profile..." | |
FileUtils.cp_r("#{jboss_profiles_dir}/default/deploy/naming-jboss-beans.xml", "#{bg_profiles_dir}/#{bg_profile_name}/deploy/") | |
puts "Removing ROOT.war..." | |
FileUtils.rm_rf("#{bg_profiles_dir}/#{bg_profile_name}/deploy/ROOT.war") | |
puts "Removing client libs..." | |
FileUtils.rm_rf("#{bg_dist_name}/jboss/client") | |
puts "Removing admin-console..." | |
FileUtils.rm_rf("#{bg_dist_name}/jboss/common/deploy/admin-console.war") | |
puts "Copying TorqueBox files" | |
FileUtils.cp_r("#{bg_profiles_dir}/default/deployers/torquebox.deployer", "#{bg_profiles_dir}/#{bg_profile_name}/deployers/") | |
puts "Enabling HornetQ..." | |
FileUtils.cp_r("#{bg_profiles_dir}/default/deploy/hornetq", "#{bg_profiles_dir}/#{bg_profile_name}/deploy/") | |
FileUtils.cp_r("#{bg_profiles_dir}/default/deploy/jms-ra.rar", "#{bg_profiles_dir}/#{bg_profile_name}/deploy/") | |
FileUtils.cp_r("#{bg_profiles_dir}/default/deployers/hornetq-deployers-jboss-beans.xml", "#{bg_profiles_dir}/#{bg_profile_name}/deployers/") | |
puts"Removing all and default profiles..." | |
FileUtils.rm_rf("#{bg_profiles_dir}/all") | |
FileUtils.rm_rf("#{bg_profiles_dir}/default") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment