Sha256: 856a1f969aa2870a06f4d3a40df1327ac07eae407115ba589e4a9afe523ebf52

Contents?: true

Size: 1.99 KB

Versions: 1

Compression:

Stored size: 1.99 KB

Contents

namespace :rubber do

  namespace :jetty do
  
    rubber.allow_optional_tasks(self)
  
    after "rubber:install_packages", "rubber:jetty:custom_install"
    
    task :custom_install, :roles => :jetty do
      rubber.sudo_script 'install_jetty', <<-ENDSCRIPT
        if [[ -z `ls #{rubber_env.jetty_prefix}/jetty-hightide-#{rubber_env.jetty_version} 2> /dev/null` ]]; then
          wget -q http://dist.codehaus.org/jetty/jetty-hightide-7.0.0/jetty-hightide-#{rubber_env.jetty_version}.tar.gz
          tar -zxf jetty-hightide-#{rubber_env.jetty_version}.tar.gz
          
          # Install to appropriate location.
          mv jetty-hightide-#{rubber_env.jetty_version} #{rubber_env.jetty_prefix}
          rm -f #{rubber_env.jetty_dir}
          ln -s #{rubber_env.jetty_prefix}/jetty-hightide-#{rubber_env.jetty_version} #{rubber_env.jetty_dir}
          chmod 744 #{rubber_env.jetty_dir}/bin/*.sh
          
          # Cleanup the jetty distribution
          rm -r #{rubber_env.jetty_dir}/webapps/*
          rm -r #{rubber_env.jetty_dir}/contexts/test.d/

          for file in #{rubber_env.jetty_dir}/contexts/*.xml; do
            mv $file $file.example
          done

          # Cleanup after ourselves.
          rm jetty-hightide-#{rubber_env.jetty_version}.tar.gz
        fi
      ENDSCRIPT
    end

    after "rubber:setup_app_permissions", "rubber:jetty:setup_jetty_permissions"

    task :setup_jetty_permissions, :roles => :jetty do
      sudo "chown -R #{rubber_env.app_user}:#{rubber_env.app_user} #{rubber_env.jetty_dir}"
    end
    
    before "deploy:stop", "rubber:jetty:stop"
    after "deploy:start", "rubber:jetty:start"
    after "deploy:restart", "rubber:jetty:restart"
    
    task :restart, :roles => :jetty do
      sudo "#{rubber_env.jetty_dir}/bin/jetty.sh restart"
    end
    
    task :stop, :roles => :jetty do
      sudo "#{rubber_env.jetty_dir}/bin/jetty.sh stop"
    end
    
    task :start, :roles => :jetty do
      sudo "#{rubber_env.jetty_dir}/bin/jetty.sh start"
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubber-1.3.0 generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb