tomcap 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/tomcap/recipes.rb +29 -7
- data/tomcap.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/lib/tomcap/recipes.rb
CHANGED
@@ -19,12 +19,14 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
19
19
|
set :mvn_war_version, "1.0-SNAPSHOT"
|
20
20
|
|
21
21
|
Optional Arguments (defaults specified):
|
22
|
-
set :tomcat_url,
|
23
|
-
set :artifactory_url,
|
24
|
-
set :tomcat_initd_script,
|
22
|
+
set :tomcat_url, "http://localhost:8080"
|
23
|
+
set :artifactory_url, "http://localhost:8080/artifactory"
|
24
|
+
set :tomcat_initd_script, "/etc/init.d/tomcat"
|
25
|
+
set :parse_snapshot_metadata, false
|
25
26
|
DESC
|
26
27
|
task :java, :roles => :java do
|
27
28
|
require 'net/http'
|
29
|
+
require 'rexml/document'
|
28
30
|
|
29
31
|
raise ArgumentError, "Must set tomcat_user" unless tomcat_user = fetch(:tomcat_user, nil)
|
30
32
|
raise ArgumentError, "Must set tomcat_pass" unless tomcat_pass = fetch(:tomcat_pass, nil)
|
@@ -34,16 +36,36 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
34
36
|
raise ArgumentError, "Must set mvn_war_group_id" unless mvn_war_group_id = fetch(:mvn_war_group_id, nil)
|
35
37
|
raise ArgumentError, "Must set mvn_war_artifact_id" unless mvn_war_artifact_id = fetch(:mvn_war_artifact_id, nil)
|
36
38
|
raise ArgumentError, "Must set mvn_war_version" unless mvn_war_version = fetch(:mvn_war_version, nil)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
run "rm -rf #{shared_path}/cached_java_copy/#{war_file}"
|
39
|
+
|
40
|
+
run "rm -rf #{shared_path}/cached_java_copy/#{mvn_war_artifact_id}-*.war"
|
41
41
|
|
42
42
|
tomcat_url = fetch(:tomcat_url, "http://localhost:8080")
|
43
43
|
artifactory_url = fetch(:artifactory_url, "http://localhost:8080/artifactory")
|
44
44
|
|
45
45
|
war_path = "#{artifactory_url}/#{mvn_repository}/#{mvn_war_group_id.gsub(/\./, '/')}/#{mvn_war_artifact_id}/#{mvn_war_version}"
|
46
46
|
|
47
|
+
if fetch(:parse_snapshot_metadata, false)
|
48
|
+
timestamp = nil
|
49
|
+
build_number = nil
|
50
|
+
uri = URI.parse("#{war_path}/maven-metadata.xml")
|
51
|
+
Net::HTTP.start(uri.host, Net::HTTP.http_default_port) do |http|
|
52
|
+
req = Net::HTTP::Get.new(uri.path)
|
53
|
+
req.basic_auth(mvn_repo_user, mvn_repo_pass)
|
54
|
+
response = http.request(req)
|
55
|
+
doc = REXML::Document.new(response.body)
|
56
|
+
doc.elements.each('metadata/versioning/snapshot/timestamp') do |e|
|
57
|
+
timestamp = e.text
|
58
|
+
end
|
59
|
+
doc.elements.each('metadata/versioning/snapshot/buildNumber') do |e|
|
60
|
+
build_number = e.text
|
61
|
+
end
|
62
|
+
raise Exception.new("Unable to determine timestamp and builder number for snapshot.") if !timestamp || !build_number
|
63
|
+
end
|
64
|
+
war_file = "#{mvn_war_artifact_id}-#{mvn_war_version.gsub(/SNAPSHOT/, "#{timestamp}-#{build_number}")}.war"
|
65
|
+
else
|
66
|
+
war_file = "#{mvn_war_artifact_id}-#{mvn_war_version}.war"
|
67
|
+
end
|
68
|
+
|
47
69
|
run <<-CMD
|
48
70
|
cd #{shared_path}/cached_java_copy &&
|
49
71
|
wget #{war_path}/#{war_file} --user=#{mvn_repo_user} --password=#{mvn_repo_pass}
|
data/tomcap.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomcap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ian Enders
|