ienders-tomcap 0.2 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ tomcap-*.gem
3
+ github-test.rb
data/README.txt CHANGED
@@ -12,13 +12,39 @@ Capistrano tasks which allow you to quickly and easily deploy Java WAR files loc
12
12
  * A running Tomcat container. The manager port does not need to be open from your local machine. (Otherwise you could probably deploy just
13
13
  as easily without using this plugin!)
14
14
 
15
+ == INSTALLATION:
16
+
17
+ $ gem sources -a http://gems.github.com/ (if you havn't already, which is unlikely)
18
+ $ gem install ienders-tomcap
19
+
15
20
  == USAGE:
16
21
 
17
22
  = Include in capistrano
18
23
 
19
24
  In your deploy.rb, simply include this line at the top:
20
25
 
21
- require 'tomcap/recipes'
26
+ require 'tomcap/recipes'
27
+
28
+ = Set your configuration parameters
29
+
30
+ set :tomcat_user, "..."
31
+ set :tomcat_pass, "..."
32
+
33
+ set :mvn_repo_user, "..."
34
+ set :mvn_repo_pass, "..."
35
+
36
+ set :mvn_repository, "libs-snapshots-local"
37
+ set :mvn_war_group_id, "com.mycompany"
38
+ set :mvn_war_artifact_id, "my-application"
39
+ set :mvn_war_version, "1.0-SNAPSHOT"
40
+
41
+ = Assign a java role to all servers hosting your app
42
+
43
+ role :java, 'myhost.com'
44
+
45
+ = Deploy
46
+
47
+ $ cap <environment> deploy:java
22
48
 
23
49
  == AUTHOR:
24
50
 
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gemspec|
6
+ gemspec.name = "tomcap"
7
+ gemspec.summary = "Tomcat deployment with Capistrano"
8
+ gemspec.description = "Capistrano tasks which allow you to quickly and easily deploy Java WAR files located in remote repositories (currently Artifactory repos) to a running Tomcat container."
9
+ gemspec.email = "ian.enders@gmail.com"
10
+ gemspec.homepage = "http://github.com/ienders/tomcap"
11
+ gemspec.authors = ["Ian Enders"]
12
+ end
13
+ rescue LoadError
14
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
15
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.2
@@ -24,27 +24,37 @@ Capistrano::Configuration.instance(:must_exist).load do
24
24
  set :artifactory_url, "http://localhost:8080/artifactory"
25
25
  DESC
26
26
  task :java, :roles => :java, :except => { :no_release => true } do
27
- raise ArgumentError, "Must set tomcat_user" unless tomcat_user
28
- raise ArgumentError, "Must set tomcat_pass" unless tomcat_pass
29
- raise ArgumentError, "Must set mvn_repo_user" unless mvn_repo_user
30
- raise ArgumentError, "Must set mvn_repo_pass" unless mvn_repo_pass
31
- raise ArgumentError, "Must set mvn_repository" unless mvn_repository
32
- raise ArgumentError, "Must set mvn_war_group_id" unless mvn_war_group_id
33
- raise ArgumentError, "Must set mvn_war_artifact_id" unless mvn_war_artifact_id
34
- raise ArgumentError, "Must set mvn_war_version" unless mvn_war_version
35
-
27
+ require 'net/http'
28
+
29
+ raise ArgumentError, "Must set tomcat_user" unless tomcat_user = fetch(:tomcat_user, nil)
30
+ raise ArgumentError, "Must set tomcat_pass" unless tomcat_pass = fetch(:tomcat_pass, nil)
31
+ raise ArgumentError, "Must set mvn_repo_user" unless mvn_repo_user = fetch(:mvn_repo_user, nil)
32
+ raise ArgumentError, "Must set mvn_repo_pass" unless mvn_repo_pass = fetch(:mvn_repo_pass, nil)
33
+ raise ArgumentError, "Must set mvn_repository" unless mvn_repository = fetch(:mvn_repository, nil)
34
+ raise ArgumentError, "Must set mvn_war_group_id" unless mvn_war_group_id = fetch(:mvn_war_group_id, nil)
35
+ raise ArgumentError, "Must set mvn_war_artifact_id" unless mvn_war_artifact_id = fetch(:mvn_war_artifact_id, nil)
36
+ raise ArgumentError, "Must set mvn_war_version" unless mvn_war_version = fetch(:mvn_war_version, nil)
37
+
38
+ war_file = "#{mvn_war_artifact_id}-#{mvn_war_version}.war"
39
+
40
+ run "rm -rf #{shared_path}/cached_java_copy/#{war_file}"
41
+
36
42
  tomcat_url = fetch(:tomcat_url, "http://localhost:8080")
37
43
  artifactory_url = fetch(:artifactory_url, "http://localhost:8080/artifactory")
38
-
44
+
39
45
  war_path = "#{artifactory_url}/#{mvn_repository}/#{mvn_war_group_id.gsub(/\./, '/')}/#{mvn_war_artifact_id}/#{mvn_war_version}"
40
- war_file = "#{mvn_war_artifact_id}-#{mvn_war_version}.war"
41
-
46
+
42
47
  run <<-CMD
43
48
  cd #{shared_path}/cached_java_copy &&
44
- wget #{war_path}/#{war_file}" &&
45
- curl -F "@#{war_file}" #{tomcat_url}/manager/deploy?path=#{mvn_war_artifact_id}-#{mvn_war_version}&update=true
49
+ wget #{war_path}/#{war_file} --user=#{mvn_repo_user} --password=#{mvn_repo_pass}
46
50
  CMD
47
- end
51
+
52
+ manager_url = "#{tomcat_url}/manager"
53
+ context_path = "/#{mvn_war_artifact_id}-#{mvn_war_version}"
54
+
55
+ run "curl -v -u #{tomcat_user}:#{tomcat_pass} #{manager_url}/undeploy?path=#{context_path}"
56
+ run "curl -v -u #{tomcat_user}:#{tomcat_pass} \"#{manager_url}/deploy?path=#{context_path}&war=file:#{shared_path}/cached_java_copy/#{war_file}\""
57
+ end
48
58
  end
49
59
 
50
60
  before "deploy:java", "deploy:setup_java"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ienders-tomcap
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Enders
@@ -11,48 +11,28 @@ cert_chain: []
11
11
 
12
12
  date: 2009-08-24 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: capistrano
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 2.2.0
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: hoe
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.5.1
34
- version:
14
+ dependencies: []
15
+
35
16
  description: Capistrano tasks which allow you to quickly and easily deploy Java WAR files located in remote repositories (currently Artifactory repos) to a running Tomcat container.
36
17
  email: ian.enders@gmail.com
37
18
  executables: []
38
19
 
39
20
  extensions: []
40
21
 
41
- extra_rdoc_files: []
42
-
22
+ extra_rdoc_files:
23
+ - README.txt
43
24
  files:
44
- - History.txt
45
- - Manifest.txt
25
+ - .gitignore
46
26
  - README.txt
47
- - lib/tomcap.rb
27
+ - Rakefile
28
+ - VERSION
48
29
  - lib/tomcap/recipes.rb
49
30
  has_rdoc: true
50
- homepage: http://github.com/ienders/tomcap/tree/master
31
+ homepage: http://github.com/ienders/tomcap
51
32
  licenses:
52
33
  post_install_message:
53
34
  rdoc_options:
54
- - --main
55
- - README.txt
35
+ - --charset=UTF-8
56
36
  require_paths:
57
37
  - lib
58
38
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -73,6 +53,6 @@ rubyforge_project:
73
53
  rubygems_version: 1.3.5
74
54
  signing_key:
75
55
  specification_version: 2
76
- summary: Tomcat deployments with Capistrano
56
+ summary: Tomcat deployment with Capistrano
77
57
  test_files: []
78
58
 
data/History.txt DELETED
@@ -1,2 +0,0 @@
1
- == 0.1 / 2009-08-24
2
- * Created gem. Touching to get github to detect gemspec.
data/Manifest.txt DELETED
@@ -1,6 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
4
- Rakefile
5
- lib/tomcap.rb
6
- lib/tomcap/recipes.rb
data/lib/tomcap.rb DELETED
@@ -1,3 +0,0 @@
1
- module Tomcap
2
- VERSION = '0.2'
3
- end