ittayd-buildr 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +62 -9
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +20 -39
- data/_buildr +1 -0
- data/{spec/java/ant.rb → _jbuildr} +11 -15
- metadata +30 -210
- data/DISCLAIMER +0 -7
- data/addon/buildr/antlr.rb +0 -65
- data/addon/buildr/cobertura.rb +0 -22
- data/addon/buildr/drb.rb +0 -281
- data/addon/buildr/emma.rb +0 -22
- data/addon/buildr/hibernate.rb +0 -142
- data/addon/buildr/javacc.rb +0 -85
- data/addon/buildr/jdepend.rb +0 -60
- data/addon/buildr/jetty.rb +0 -248
- data/addon/buildr/jibx.rb +0 -86
- data/addon/buildr/nailgun.rb +0 -221
- data/addon/buildr/openjpa.rb +0 -90
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +0 -41
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +0 -144
- data/addon/buildr/path.rb +0 -136
- data/addon/buildr/xmlbeans.rb +0 -93
- data/buildr.buildfile +0 -53
- data/buildr.gemspec +0 -58
- data/doc/css/default.css +0 -228
- data/doc/css/print.css +0 -100
- data/doc/css/syntax.css +0 -52
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +0 -207
- data/doc/pages/building.textile +0 -240
- data/doc/pages/contributing.textile +0 -208
- data/doc/pages/download.textile +0 -62
- data/doc/pages/extending.textile +0 -175
- data/doc/pages/getting_started.textile +0 -273
- data/doc/pages/index.textile +0 -42
- data/doc/pages/languages.textile +0 -407
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/more_stuff.textile +0 -314
- data/doc/pages/packaging.textile +0 -427
- data/doc/pages/projects.textile +0 -274
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/settings_profiles.textile +0 -274
- data/doc/pages/testing.textile +0 -212
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/print.toc.yaml +0 -29
- data/doc/scripts/buildr-git.rb +0 -412
- data/doc/scripts/install-jruby.sh +0 -44
- data/doc/scripts/install-linux.sh +0 -64
- data/doc/scripts/install-osx.sh +0 -52
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/KEYS +0 -151
- data/etc/git-svn-authors +0 -16
- data/lib/buildr.rb +0 -33
- data/lib/buildr/core.rb +0 -29
- data/lib/buildr/core/application.rb +0 -665
- data/lib/buildr/core/build.rb +0 -311
- data/lib/buildr/core/checks.rb +0 -254
- data/lib/buildr/core/common.rb +0 -150
- data/lib/buildr/core/compile.rb +0 -590
- data/lib/buildr/core/environment.rb +0 -117
- data/lib/buildr/core/filter.rb +0 -366
- data/lib/buildr/core/generate.rb +0 -195
- data/lib/buildr/core/help.rb +0 -119
- data/lib/buildr/core/osx.rb +0 -49
- data/lib/buildr/core/progressbar.rb +0 -156
- data/lib/buildr/core/project.rb +0 -923
- data/lib/buildr/core/test.rb +0 -715
- data/lib/buildr/core/transports.rb +0 -560
- data/lib/buildr/core/util.rb +0 -294
- data/lib/buildr/groovy.rb +0 -18
- data/lib/buildr/groovy/bdd.rb +0 -106
- data/lib/buildr/groovy/compiler.rb +0 -138
- data/lib/buildr/ide.rb +0 -19
- data/lib/buildr/ide/eclipse.rb +0 -222
- data/lib/buildr/ide/idea.ipr.template +0 -300
- data/lib/buildr/ide/idea.rb +0 -190
- data/lib/buildr/ide/idea7x.ipr.template +0 -290
- data/lib/buildr/ide/idea7x.rb +0 -212
- data/lib/buildr/java.rb +0 -23
- data/lib/buildr/java/ant.rb +0 -92
- data/lib/buildr/java/bdd.rb +0 -451
- data/lib/buildr/java/cobertura.rb +0 -236
- data/lib/buildr/java/commands.rb +0 -211
- data/lib/buildr/java/compiler.rb +0 -348
- data/lib/buildr/java/deprecated.rb +0 -141
- data/lib/buildr/java/emma.rb +0 -238
- data/lib/buildr/java/jruby.rb +0 -117
- data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
- data/lib/buildr/java/packaging.rb +0 -717
- data/lib/buildr/java/pom.rb +0 -174
- data/lib/buildr/java/rjb.rb +0 -155
- data/lib/buildr/java/test_result.rb +0 -307
- data/lib/buildr/java/tests.rb +0 -329
- data/lib/buildr/java/version_requirement.rb +0 -172
- data/lib/buildr/packaging.rb +0 -24
- data/lib/buildr/packaging/archive.rb +0 -488
- data/lib/buildr/packaging/artifact.rb +0 -759
- data/lib/buildr/packaging/artifact_namespace.rb +0 -972
- data/lib/buildr/packaging/artifact_search.rb +0 -140
- data/lib/buildr/packaging/gems.rb +0 -102
- data/lib/buildr/packaging/package.rb +0 -233
- data/lib/buildr/packaging/tar.rb +0 -186
- data/lib/buildr/packaging/version_requirement.rb +0 -172
- data/lib/buildr/packaging/zip.rb +0 -64
- data/lib/buildr/packaging/ziptask.rb +0 -313
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +0 -19
- data/lib/buildr/scala/compiler.rb +0 -109
- data/lib/buildr/scala/tests.rb +0 -203
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/doc.rake +0 -103
- data/rakelib/package.rake +0 -76
- data/rakelib/release.rake +0 -65
- data/rakelib/rspec.rake +0 -83
- data/rakelib/rubyforge.rake +0 -56
- data/rakelib/scm.rake +0 -49
- data/rakelib/setup.rake +0 -81
- data/rakelib/stage.rake +0 -48
- data/spec/addon/drb_spec.rb +0 -328
- data/spec/core/application_spec.rb +0 -419
- data/spec/core/build_spec.rb +0 -423
- data/spec/core/checks_spec.rb +0 -519
- data/spec/core/common_spec.rb +0 -670
- data/spec/core/compile_spec.rb +0 -582
- data/spec/core/generate_spec.rb +0 -33
- data/spec/core/project_spec.rb +0 -776
- data/spec/core/test_spec.rb +0 -1098
- data/spec/core/transport_spec.rb +0 -500
- data/spec/groovy/bdd_spec.rb +0 -80
- data/spec/groovy/compiler_spec.rb +0 -239
- data/spec/ide/eclipse_spec.rb +0 -311
- data/spec/java/bdd_spec.rb +0 -358
- data/spec/java/cobertura_spec.rb +0 -77
- data/spec/java/compiler_spec.rb +0 -446
- data/spec/java/emma_spec.rb +0 -120
- data/spec/java/java_spec.rb +0 -96
- data/spec/java/packaging_spec.rb +0 -1120
- data/spec/java/test_coverage_spec.rb +0 -255
- data/spec/java/tests_spec.rb +0 -471
- data/spec/packaging/archive_spec.rb +0 -503
- data/spec/packaging/artifact_namespace_spec.rb +0 -646
- data/spec/packaging/artifact_spec.rb +0 -795
- data/spec/packaging/packaging_helper.rb +0 -63
- data/spec/packaging/packaging_spec.rb +0 -589
- data/spec/sandbox.rb +0 -139
- data/spec/scala/compiler_spec.rb +0 -228
- data/spec/scala/tests_spec.rb +0 -215
- data/spec/spec_helpers.rb +0 -327
- data/spec/version_requirement_spec.rb +0 -123
data/addon/buildr/javacc.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
|
17
|
-
require 'buildr/java'
|
18
|
-
|
19
|
-
|
20
|
-
module Buildr
|
21
|
-
# Provides JavaCC compile tasks. Require explicitly using <code>require "buildr/javacc"</code>.
|
22
|
-
module JavaCC
|
23
|
-
|
24
|
-
REQUIRES = [ "net.java.dev.javacc:javacc:jar:4.0", "net.java.dev.javacc:javacc:jar:4.0" ]
|
25
|
-
|
26
|
-
Java.classpath << REQUIRES
|
27
|
-
|
28
|
-
class << self
|
29
|
-
|
30
|
-
def javacc(*args)
|
31
|
-
options = Hash === args.last ? args.pop : {}
|
32
|
-
rake_check_options options, :output
|
33
|
-
|
34
|
-
args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.jj"] : f }.flatten
|
35
|
-
args.unshift "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output]
|
36
|
-
Java.load
|
37
|
-
Java.org.javacc.parser.Main.mainProgram(args.to_java(Java.java.lang.String)) == 0 or
|
38
|
-
fail "Failed to run JavaCC, see errors above."
|
39
|
-
end
|
40
|
-
|
41
|
-
def jjtree(*args)
|
42
|
-
options = Hash === args.last ? args.pop : {}
|
43
|
-
rake_check_options options, :output, :build_node_files
|
44
|
-
|
45
|
-
args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "**/*.jjt"] : f }.flatten
|
46
|
-
args.unshift "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output]
|
47
|
-
args.unshift "-BUILD_NODE_FILES=#{options[:build_node_files] || false}"
|
48
|
-
Java.load
|
49
|
-
Java.org.javacc.jjtree.JJTree.new.main(args.to_java(Java.java.lang.String)) == 0 or
|
50
|
-
fail "Failed to run JJTree, see errors above."
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
def javacc(*args)
|
56
|
-
if Hash === args.last
|
57
|
-
options = args.pop
|
58
|
-
in_package = options[:in_package].split(".")
|
59
|
-
else
|
60
|
-
in_package = []
|
61
|
-
end
|
62
|
-
file(path_to(:target, :generated, :javacc)=>args.flatten) do |task|
|
63
|
-
JavaCC.javacc task.prerequisites, :output=>File.join(task.name, in_package)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def jjtree(*args)
|
68
|
-
if Hash === args.last
|
69
|
-
options = args.pop
|
70
|
-
in_package = options[:in_package].split(".")
|
71
|
-
build_node_files = options[:build_node_files]
|
72
|
-
else
|
73
|
-
in_package = []
|
74
|
-
end
|
75
|
-
file(path_to(:target, :generated, :jjtree)=>args.flatten) do |task|
|
76
|
-
JavaCC.jjtree task.prerequisites, :output=>File.join(task.name, in_package), :build_node_files=>build_node_files
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
class Project
|
83
|
-
include JavaCC
|
84
|
-
end
|
85
|
-
end
|
data/addon/buildr/jdepend.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
|
17
|
-
require 'buildr/java'
|
18
|
-
|
19
|
-
|
20
|
-
module Buildr
|
21
|
-
|
22
|
-
# Addes the <code>jdepend:swing</code>, <code>jdepend:text</code> and <code>jdepend:xml</code> tasks.
|
23
|
-
# Require explicitly using <code>require "buildr/jdepend"</code>.
|
24
|
-
module Jdepend
|
25
|
-
|
26
|
-
REQUIRES = ["jdepend:jdepend:jar:2.9.1"]
|
27
|
-
|
28
|
-
class << self
|
29
|
-
|
30
|
-
def requires()
|
31
|
-
@requires ||= Buildr.artifacts(REQUIRES).each(&:invoke).map(&:to_s)
|
32
|
-
end
|
33
|
-
|
34
|
-
def paths()
|
35
|
-
Project.projects.map(&:compile).each(&:invoke).map(&:target).
|
36
|
-
map(&:to_s).select { |path| File.exist?(path) }.map { |path| File.expand_path(path) }
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
namespace "jdepend" do
|
42
|
-
|
43
|
-
desc "Runs JDepend on all your projects (Swing UI)"
|
44
|
-
task "swing" do
|
45
|
-
Java::Commands.java "jdepend.swingui.JDepend", paths, :classpath=>requires, :name=>"JDepend"
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "Runs JDepend on all your projects (Text UI)"
|
49
|
-
task "text" do
|
50
|
-
Java::Commands.java "jdepend.textui.JDepend", paths, :classpath=>requires, :name=>"JDepend"
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Runs JDepend on all your projects (XML output to jdepend.xml)"
|
54
|
-
task "xml" do
|
55
|
-
Java::Commands.java "jdepend.xmlui.JDepend", "-file", "jdepend.xml", paths, :classpath=>requires, :name=>"JDepend"
|
56
|
-
puts "Created jdepend.xml"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/addon/buildr/jetty.rb
DELETED
@@ -1,248 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
|
17
|
-
require 'uri'
|
18
|
-
require 'net/http'
|
19
|
-
require 'buildr/core/project'
|
20
|
-
require 'buildr/java'
|
21
|
-
require 'buildr/packaging'
|
22
|
-
require 'thread'
|
23
|
-
|
24
|
-
|
25
|
-
module Buildr
|
26
|
-
|
27
|
-
# Provides a collection of tasks and methods for using Jetty, specifically as a server
|
28
|
-
# for testing your application.
|
29
|
-
#
|
30
|
-
# Build files should always start Jetty by invoking the #use task, typically as
|
31
|
-
# a prerequisite. This task will start Jetty once during the build, and shut it down
|
32
|
-
# when the build completes.
|
33
|
-
#
|
34
|
-
# If you want to keep Jetty running across builds, and look at error messages, you can
|
35
|
-
# start Jetty in a separate console with:
|
36
|
-
# buildr jetty:start
|
37
|
-
# To stop this instance of Jetty, simply kill the process (Ctrl-C) or run:
|
38
|
-
# buildr jetty:stop
|
39
|
-
#
|
40
|
-
# If you start Jetty separately from the build, the #use task will connect to that
|
41
|
-
# existing server. Since you are using Jetty across several builds, you will want to
|
42
|
-
# cleanup any mess created by each build. You can use the #setup and #teardown tasks,
|
43
|
-
# which are called when Jetty is first used in the build, and when the build ends.
|
44
|
-
class Jetty
|
45
|
-
|
46
|
-
# Which version of Jetty we're using by default (change with options.jetty.version).
|
47
|
-
VERSION = "6.1.3"
|
48
|
-
SLF4J_VERSION = "1.4.3"
|
49
|
-
|
50
|
-
# Libraries used by Jetty.
|
51
|
-
REQUIRES = [ "org.mortbay.jetty:jetty:jar:#{VERSION}", "org.mortbay.jetty:jetty-util:jar:#{VERSION}",
|
52
|
-
"org.mortbay.jetty:servlet-api-2.5:jar:#{VERSION}", "org.slf4j:slf4j-api:jar:#{SLF4J_VERSION}",
|
53
|
-
"org.slf4j:slf4j-simple:jar:#{SLF4J_VERSION}", "org.slf4j:jcl104-over-slf4j:jar:#{SLF4J_VERSION}" ]
|
54
|
-
|
55
|
-
Java.classpath << REQUIRES
|
56
|
-
Java.classpath << File.dirname(__FILE__)
|
57
|
-
|
58
|
-
# Default URL for Jetty (change with options.jetty.url).
|
59
|
-
URL = "http://localhost:8080"
|
60
|
-
|
61
|
-
class << self
|
62
|
-
|
63
|
-
# :call-seq:
|
64
|
-
# instance() => Jetty
|
65
|
-
#
|
66
|
-
# Returns an instance of Jetty.
|
67
|
-
def instance()
|
68
|
-
@instance ||= Jetty.new("jetty", URL)
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
def initialize(name, url) #:nodoc:
|
74
|
-
@url = url
|
75
|
-
namespace name do
|
76
|
-
@setup = task("setup")
|
77
|
-
@teardown = task("teardown")
|
78
|
-
@use = task("use") { fire }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# The URL for the Jetty server. Leave as is if you want to use the default server
|
83
|
-
# (http://localhost:8080).
|
84
|
-
attr_accessor :url
|
85
|
-
|
86
|
-
# :call-seq:
|
87
|
-
# start(pipe?)
|
88
|
-
#
|
89
|
-
# Starts Jetty. This method does not return, it keeps the thread running until
|
90
|
-
# Jetty is stopped. If you want to run Jetty parallel with other tasks in the build,
|
91
|
-
# invoke the #use task instead.
|
92
|
-
def start(sync = nil)
|
93
|
-
begin
|
94
|
-
puts "classpath #{Java.classpath.inspect}"
|
95
|
-
port = URI.parse(url).port
|
96
|
-
puts "Starting Jetty at http://localhost:#{port}" if verbose
|
97
|
-
Java.load
|
98
|
-
jetty = Java.org.apache.buildr.JettyWrapper.new(port)
|
99
|
-
sync << "Started" if sync
|
100
|
-
sleep # Forever
|
101
|
-
rescue Interrupt # Stopped from console
|
102
|
-
rescue Exception=>error
|
103
|
-
puts "#{error.class}: #{error.message}"
|
104
|
-
end
|
105
|
-
exit! # No at_exit
|
106
|
-
end
|
107
|
-
|
108
|
-
# :call-seq:
|
109
|
-
# stop()
|
110
|
-
#
|
111
|
-
# Stops Jetty. Stops a server running in a separate process.
|
112
|
-
def stop()
|
113
|
-
uri = URI.parse(url)
|
114
|
-
begin
|
115
|
-
Net::HTTP.start(uri.host, uri.port) do |http|
|
116
|
-
http.request_post "/buildr/stop", ""
|
117
|
-
end
|
118
|
-
rescue Errno::ECONNREFUSED
|
119
|
-
# Expected if Jetty server not running.
|
120
|
-
rescue EOFError
|
121
|
-
# We get EOFError because Jetty is brutally killed.
|
122
|
-
end
|
123
|
-
puts "Jetty server stopped"
|
124
|
-
end
|
125
|
-
|
126
|
-
# :call-seq:
|
127
|
-
# running?() => boolean
|
128
|
-
#
|
129
|
-
# Returns true if it finds a running Jetty server that supports the Buildr
|
130
|
-
# requests for deploying, stopping, etc.
|
131
|
-
def running?()
|
132
|
-
uri = URI.parse(url)
|
133
|
-
begin
|
134
|
-
Net::HTTP.start(uri.host, uri.port) do |http|
|
135
|
-
response = http.request_get("/buildr/")
|
136
|
-
response.is_a?(Net::HTTPSuccess) && response.body =~ /Alive/
|
137
|
-
end
|
138
|
-
rescue Errno::ECONNREFUSED, Errno::EBADF
|
139
|
-
false
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
# :call-seq:
|
144
|
-
# deploy(url, webapp) => path
|
145
|
-
#
|
146
|
-
# Deploy a WAR in the specified URL.
|
147
|
-
def deploy(url, webapp)
|
148
|
-
use.invoke
|
149
|
-
uri = URI.parse(url)
|
150
|
-
Net::HTTP.start(uri.host, uri.port) do |http|
|
151
|
-
response = http.request_post("/buildr/deploy", "webapp=#{webapp}&path=#{uri.path}")
|
152
|
-
if Net::HTTPOK === response && response.body =~ /Deployed/
|
153
|
-
path = response.body.split[1]
|
154
|
-
puts "Deployed #{webapp}, context path #{uri.path}" if Rake.application.options.trace
|
155
|
-
path
|
156
|
-
else
|
157
|
-
fail "Deployment failed: #{response}"
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
# :call-seq:
|
163
|
-
# undeploy(url) => boolean
|
164
|
-
#
|
165
|
-
# Undeploys a WAR from the specified URL.
|
166
|
-
def undeploy(url)
|
167
|
-
use.invoke
|
168
|
-
uri = URI.parse(url)
|
169
|
-
Net::HTTP.start(uri.host, uri.port) do |http|
|
170
|
-
response = http.request_post("/buildr/undeploy", "path=#{uri.path}")
|
171
|
-
if Net::HTTPOK === response && response.body =~ /Undeployed/
|
172
|
-
true
|
173
|
-
else
|
174
|
-
fail "Deployment failed: #{response}"
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
# :call-seq:
|
180
|
-
# setup(*prereqs) => task
|
181
|
-
# setup(*prereqs) { |task| .. } => task
|
182
|
-
#
|
183
|
-
# This task executes when Jetty is first used in the build. You can use it to
|
184
|
-
# deploy artifacts into Jetty.
|
185
|
-
def setup(*prereqs, &block)
|
186
|
-
@setup.enhance prereqs, &block
|
187
|
-
end
|
188
|
-
|
189
|
-
# :call-seq:
|
190
|
-
# teardown(*prereqs) => task
|
191
|
-
# teardown(*prereqs) { |task| .. } => task
|
192
|
-
#
|
193
|
-
# This task executes when the build is done. You can use it to undeploy artifacts
|
194
|
-
# previously deployed into Jetty.
|
195
|
-
def teardown(*prereqs, &block)
|
196
|
-
@teardown.enhance prereqs, &block
|
197
|
-
end
|
198
|
-
|
199
|
-
# :call-seq:
|
200
|
-
# use(*prereqs) => task
|
201
|
-
# use(*prereqs) { |task| .. } => task
|
202
|
-
#
|
203
|
-
# If you intend to use Jetty, invoke this task. It will start a new instance of
|
204
|
-
# Jetty and close it when the build is done. However, if you already have a server
|
205
|
-
# running in the background (e.g. jetty:start), it will use that server and will
|
206
|
-
# not close it down.
|
207
|
-
def use(*prereqs, &block)
|
208
|
-
@use.enhance prereqs, &block
|
209
|
-
end
|
210
|
-
|
211
|
-
protected
|
212
|
-
|
213
|
-
# If you want to start Jetty inside the build, call this method instead of #start.
|
214
|
-
# It will spawn a separate process that will run Jetty, and will stop Jetty when
|
215
|
-
# the build ends. However, if you already started Jetty from the console (with
|
216
|
-
# take jetty:start), it will use the existing instance without shutting it down.
|
217
|
-
def fire()
|
218
|
-
unless running?
|
219
|
-
sync = Queue.new
|
220
|
-
Thread.new { start sync }
|
221
|
-
# Wait for Jetty to fire up before doing anything else.
|
222
|
-
sync.pop == "Started" or fail "Jetty not started"
|
223
|
-
puts "Jetty started" if verbose
|
224
|
-
at_exit { stop }
|
225
|
-
end
|
226
|
-
@setup.invoke
|
227
|
-
at_exit { @teardown.invoke }
|
228
|
-
end
|
229
|
-
|
230
|
-
end
|
231
|
-
|
232
|
-
namespace "jetty" do
|
233
|
-
desc "Start an instance of Jetty running in the background"
|
234
|
-
task("start") { Jetty.instance.start }
|
235
|
-
desc "Stop an instance of Jetty running in the background"
|
236
|
-
task("stop") { Jetty.instance.stop }
|
237
|
-
end
|
238
|
-
|
239
|
-
# :call-seq:
|
240
|
-
# jetty() => Jetty
|
241
|
-
#
|
242
|
-
# Returns a Jetty object. You can use this to discover the Jetty#use task,
|
243
|
-
# configure the Jetty#setup and Jetty#teardown tasks, deploy and undeploy to Jetty.
|
244
|
-
def jetty()
|
245
|
-
@jetty ||= Jetty.instance
|
246
|
-
end
|
247
|
-
|
248
|
-
end
|
data/addon/buildr/jibx.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
|
17
|
-
require 'java/java'
|
18
|
-
|
19
|
-
|
20
|
-
module Buildr
|
21
|
-
|
22
|
-
# Provides JiBX bytecode enhancement. Require explicitly using <code>require 'buildr/jibx'</code>.
|
23
|
-
module JiBX
|
24
|
-
|
25
|
-
JIBX_VERSION = '1.1.5'
|
26
|
-
BCEL_VERSION = '5.2'
|
27
|
-
STAX_VERSION = '1.0-2'
|
28
|
-
XPP3_VERSION = '1.1.4c'
|
29
|
-
|
30
|
-
REQUIRES = [ "org.jibx:jibx-bind:jar:#{JIBX_VERSION}",
|
31
|
-
"org.jibx:jibx-run:jar:#{JIBX_VERSION}",
|
32
|
-
"org.apache.bcel:bcel:jar:#{BCEL_VERSION}",
|
33
|
-
"javax.xml.stream:stax-api:jar:#{STAX_VERSION}",
|
34
|
-
"xpp3:xpp3:jar:#{XPP3_VERSION}" ]
|
35
|
-
|
36
|
-
Java.classpath << REQUIRES
|
37
|
-
|
38
|
-
class << self
|
39
|
-
|
40
|
-
def bind(options)
|
41
|
-
rake_check_options options, :classpath, :output, :binding, :target, :verbose, :load
|
42
|
-
artifacts = Buildr.artifacts(options[:classpath]).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s]
|
43
|
-
binding = file(options[:binding]).tap { |task| task.invoke }.to_s
|
44
|
-
|
45
|
-
Buildr.ant 'jibx' do |ant|
|
46
|
-
ant.taskdef :name=>'bind', :classname=>'org.jibx.binding.ant.CompileTask',
|
47
|
-
:classpath => requires.join(File::PATH_SEPARATOR)
|
48
|
-
ant.bind :verbose => options[:verbose].to_s, :load => options[:load].to_s, :binding=>options[:binding].to_s do
|
49
|
-
ant.classpath :path => artifacts.join(File::PATH_SEPARATOR)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def requires()
|
57
|
-
@requires ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s)
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def jibx_bind(options = nil)
|
63
|
-
|
64
|
-
# FIXME - add support for :bindingfileset and :classpathset
|
65
|
-
# Note: either :binding or :bindingfileset should be set, and either
|
66
|
-
# :classpath or :classpathset should be set, and options passed to
|
67
|
-
# ant.bind should be adjusted accordingly. At present, only :binding
|
68
|
-
# and :classpath are supported (which should be fine for most!)
|
69
|
-
jibx_options = { :output => compile.target,
|
70
|
-
:classpath => compile.classpath,
|
71
|
-
:binding => path_to(:source, :main, :resources, 'META-INF/binding.xml'),
|
72
|
-
:target => compile.target,
|
73
|
-
:load => false,
|
74
|
-
:verbose => false
|
75
|
-
}
|
76
|
-
|
77
|
-
JiBX.bind jibx_options.merge(options || {})
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
class Project
|
83
|
-
include JiBX
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|