Sha256: aa1d3c327c875baba35d5121ab1cdc437bd3d1308c7ee8f0ddad47381109ad6f

Contents?: true

Size: 1.17 KB

Versions: 19

Compression:

Stored size: 1.17 KB

Contents

require 'fileutils'
require File.expand_path(File.dirname(__FILE__) + '/../utilities')

Capistrano::Configuration.instance(true).load do
  default_run_options[:pty] = true
  set :use_sudo, true

  # TOMCAT SERVERS
  _cset :tomcat_home, "/usr/local/apache-tomcat-6.0.29"
  _cset :tomcat_ctrl, "/etc/init.d/tomcat"
  _cset :java_home, "/usr/lib/jvm/java"

  set :tomcat_user do
    user   # default use current user.
  end

  #
  # simple interactions with the tomcat server
  #
  namespace :tomcat do


    desc "install tomcat"
    task :install, :role => :app do
      dir = File.dirname(tomcat_home)
      basename = File.basename(tomcat_file)
      basectl = File.basename(tomcat_ctrl)
      utilities.sudo_upload "#{tomcat_file}", "#{dir}/#{basename}"
      run "cd /tmp"
      sudo "mkdir -p #{dir}"
      sudo "tar -zvxf #{dir}/#{basename} -C #{dir}"
      sudo "chown #{tomcat_user}:root #{tomcat_home} -R"

      put utilities.render("tomcat", binding), "/tmp/tomcat.tmp"
      sudo "cp /tmp/tomcat.tmp #{tomcat_ctrl}"
      sudo "chmod a+x #{tomcat_ctrl}"
      sudo "/sbin/chkconfig --add #{basectl}"
      run "rm /tmp/tomcat.tmp"
      sudo "rm #{dir}/#{basename}"
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
crazycode-cap-recipes-0.5.3 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.5.2 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.5.1 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.5.0 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.14 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.13 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.12 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.11 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.10 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.9 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.8 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.6 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.5 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.4 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.3 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.2 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.1 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.4.0 lib/cap_recipes/tasks/tomcat/install.rb
crazycode-cap-recipes-0.3.39.3 lib/cap_recipes/tasks/tomcat/install.rb