buildr-gemjar 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.braids +8 -0
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +98 -0
- data/Rakefile +8 -0
- data/buildr-gemjar.gemspec +42 -0
- data/lib/buildr-gemjar.rb +162 -0
- data/lib/buildr-gemjar/version.rb +3 -0
- data/meta.rakefile +30 -0
- data/spec/buildr-gemjar/version_spec.rb +11 -0
- data/spec/buildr-gemjar_spec.rb +179 -0
- data/spec/repo_builder.rb +59 -0
- data/spec/spec_helper.rb +44 -0
- data/vendor/buildr/.gitignore +17 -0
- data/vendor/buildr/CHANGELOG +1283 -0
- data/vendor/buildr/Gemfile +4 -0
- data/vendor/buildr/LICENSE +176 -0
- data/vendor/buildr/NOTICE +26 -0
- data/vendor/buildr/README.rdoc +134 -0
- data/vendor/buildr/Rakefile +44 -0
- data/vendor/buildr/_buildr +35 -0
- data/vendor/buildr/_jbuildr +35 -0
- data/vendor/buildr/addon/buildr/antlr.rb +65 -0
- data/vendor/buildr/addon/buildr/bnd.rb +147 -0
- data/vendor/buildr/addon/buildr/cobertura.rb +22 -0
- data/vendor/buildr/addon/buildr/drb.rb +281 -0
- data/vendor/buildr/addon/buildr/emma.rb +22 -0
- data/vendor/buildr/addon/buildr/hibernate.rb +149 -0
- data/vendor/buildr/addon/buildr/javacc.rb +85 -0
- data/vendor/buildr/addon/buildr/jaxb_xjc.rb +72 -0
- data/vendor/buildr/addon/buildr/jdepend.rb +60 -0
- data/vendor/buildr/addon/buildr/jetty.rb +248 -0
- data/vendor/buildr/addon/buildr/jibx.rb +86 -0
- data/vendor/buildr/addon/buildr/nailgun.rb +221 -0
- data/vendor/buildr/addon/buildr/openjpa.rb +88 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/vendor/buildr/addon/buildr/protobuf.rb +88 -0
- data/vendor/buildr/addon/buildr/xmlbeans.rb +93 -0
- data/vendor/buildr/all-in-one/_buildr +19 -0
- data/vendor/buildr/all-in-one/buildr +368 -0
- data/vendor/buildr/all-in-one/buildr.cmd +1 -0
- data/vendor/buildr/bin/buildr +19 -0
- data/vendor/buildr/buildr.buildfile +58 -0
- data/vendor/buildr/buildr.gemspec +74 -0
- data/vendor/buildr/doc/_config.yml +1 -0
- data/vendor/buildr/doc/_layouts/default.html +90 -0
- data/vendor/buildr/doc/_layouts/preface.html +22 -0
- data/vendor/buildr/doc/artifacts.textile +217 -0
- data/vendor/buildr/doc/building.textile +276 -0
- data/vendor/buildr/doc/contributing.textile +268 -0
- data/vendor/buildr/doc/css/default.css +236 -0
- data/vendor/buildr/doc/css/print.css +101 -0
- data/vendor/buildr/doc/css/syntax.css +23 -0
- data/vendor/buildr/doc/download.textile +138 -0
- data/vendor/buildr/doc/extending.textile +212 -0
- data/vendor/buildr/doc/images/1442160941-frontcover.jpg +0 -0
- data/vendor/buildr/doc/images/asf-logo.gif +0 -0
- data/vendor/buildr/doc/images/asf-logo.png +0 -0
- data/vendor/buildr/doc/images/buildr-hires.png +0 -0
- data/vendor/buildr/doc/images/buildr.png +0 -0
- data/vendor/buildr/doc/images/favicon.png +0 -0
- data/vendor/buildr/doc/images/growl-icon.tiff +0 -0
- data/vendor/buildr/doc/images/note.png +0 -0
- data/vendor/buildr/doc/images/project-structure.png +0 -0
- data/vendor/buildr/doc/images/tip.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.tif +0 -0
- data/vendor/buildr/doc/index.textile +69 -0
- data/vendor/buildr/doc/installing.textile +284 -0
- data/vendor/buildr/doc/languages.textile +599 -0
- data/vendor/buildr/doc/mailing_lists.textile +29 -0
- data/vendor/buildr/doc/more_stuff.textile +845 -0
- data/vendor/buildr/doc/packaging.textile +618 -0
- data/vendor/buildr/doc/preface.textile +54 -0
- data/vendor/buildr/doc/projects.textile +276 -0
- data/vendor/buildr/doc/quick_start.textile +210 -0
- data/vendor/buildr/doc/releasing.textile +117 -0
- data/vendor/buildr/doc/scripts/buildr-git.rb +512 -0
- data/vendor/buildr/doc/scripts/gitflow.rb +296 -0
- data/vendor/buildr/doc/scripts/install-jruby.sh +44 -0
- data/vendor/buildr/doc/scripts/install-linux.sh +73 -0
- data/vendor/buildr/doc/scripts/install-osx.sh +52 -0
- data/vendor/buildr/doc/settings_profiles.textile +287 -0
- data/vendor/buildr/doc/testing.textile +247 -0
- data/vendor/buildr/etc/KEYS +189 -0
- data/vendor/buildr/lib/buildr.rb +44 -0
- data/vendor/buildr/lib/buildr/clojure.rb +34 -0
- data/vendor/buildr/lib/buildr/clojure/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/core.rb +34 -0
- data/vendor/buildr/lib/buildr/core/application.rb +700 -0
- data/vendor/buildr/lib/buildr/core/build.rb +516 -0
- data/vendor/buildr/lib/buildr/core/cc.rb +166 -0
- data/vendor/buildr/lib/buildr/core/checks.rb +253 -0
- data/vendor/buildr/lib/buildr/core/common.rb +151 -0
- data/vendor/buildr/lib/buildr/core/compile.rb +622 -0
- data/vendor/buildr/lib/buildr/core/doc.rb +276 -0
- data/vendor/buildr/lib/buildr/core/environment.rb +129 -0
- data/vendor/buildr/lib/buildr/core/filter.rb +404 -0
- data/vendor/buildr/lib/buildr/core/generate.rb +197 -0
- data/vendor/buildr/lib/buildr/core/help.rb +119 -0
- data/vendor/buildr/lib/buildr/core/jrebel.rb +42 -0
- data/vendor/buildr/lib/buildr/core/linux.rb +30 -0
- data/vendor/buildr/lib/buildr/core/osx.rb +46 -0
- data/vendor/buildr/lib/buildr/core/progressbar.rb +161 -0
- data/vendor/buildr/lib/buildr/core/project.rb +975 -0
- data/vendor/buildr/lib/buildr/core/run.rb +43 -0
- data/vendor/buildr/lib/buildr/core/shell.rb +137 -0
- data/vendor/buildr/lib/buildr/core/test.rb +843 -0
- data/vendor/buildr/lib/buildr/core/transports.rb +565 -0
- data/vendor/buildr/lib/buildr/core/util.rb +537 -0
- data/vendor/buildr/lib/buildr/groovy.rb +20 -0
- data/vendor/buildr/lib/buildr/groovy/bdd.rb +106 -0
- data/vendor/buildr/lib/buildr/groovy/compiler.rb +153 -0
- data/vendor/buildr/lib/buildr/groovy/doc.rb +76 -0
- data/vendor/buildr/lib/buildr/groovy/shell.rb +57 -0
- data/vendor/buildr/lib/buildr/ide.rb +19 -0
- data/vendor/buildr/lib/buildr/ide/eclipse.rb +427 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/java.rb +53 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/vendor/buildr/lib/buildr/ide/idea.rb +576 -0
- data/vendor/buildr/lib/buildr/java.rb +25 -0
- data/vendor/buildr/lib/buildr/java/ant.rb +94 -0
- data/vendor/buildr/lib/buildr/java/bdd.rb +460 -0
- data/vendor/buildr/lib/buildr/java/cobertura.rb +297 -0
- data/vendor/buildr/lib/buildr/java/commands.rb +223 -0
- data/vendor/buildr/lib/buildr/java/compiler.rb +135 -0
- data/vendor/buildr/lib/buildr/java/deprecated.rb +141 -0
- data/vendor/buildr/lib/buildr/java/doc.rb +86 -0
- data/vendor/buildr/lib/buildr/java/ecj.rb +69 -0
- data/vendor/buildr/lib/buildr/java/emma.rb +244 -0
- data/vendor/buildr/lib/buildr/java/external.rb +73 -0
- data/vendor/buildr/lib/buildr/java/jruby.rb +122 -0
- data/vendor/buildr/lib/buildr/java/jtestr_result.rb +295 -0
- data/vendor/buildr/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
- data/vendor/buildr/lib/buildr/java/packaging.rb +734 -0
- data/vendor/buildr/lib/buildr/java/pom.rb +178 -0
- data/vendor/buildr/lib/buildr/java/rjb.rb +154 -0
- data/vendor/buildr/lib/buildr/java/test_result.rb +101 -0
- data/vendor/buildr/lib/buildr/java/tests.rb +362 -0
- data/vendor/buildr/lib/buildr/java/version_requirement.rb +172 -0
- data/vendor/buildr/lib/buildr/packaging.rb +25 -0
- data/vendor/buildr/lib/buildr/packaging/archive.rb +535 -0
- data/vendor/buildr/lib/buildr/packaging/artifact.rb +903 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_search.rb +140 -0
- data/vendor/buildr/lib/buildr/packaging/gems.rb +105 -0
- data/vendor/buildr/lib/buildr/packaging/package.rb +249 -0
- data/vendor/buildr/lib/buildr/packaging/tar.rb +189 -0
- data/vendor/buildr/lib/buildr/packaging/version_requirement.rb +192 -0
- data/vendor/buildr/lib/buildr/packaging/zip.rb +178 -0
- data/vendor/buildr/lib/buildr/packaging/ziptask.rb +356 -0
- data/vendor/buildr/lib/buildr/resources/buildr.icns +0 -0
- data/vendor/buildr/lib/buildr/resources/completed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/failed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/icons-license.txt +17 -0
- data/vendor/buildr/lib/buildr/run.rb +195 -0
- data/vendor/buildr/lib/buildr/scala.rb +26 -0
- data/vendor/buildr/lib/buildr/scala/bdd.rb +118 -0
- data/vendor/buildr/lib/buildr/scala/compiler.rb +242 -0
- data/vendor/buildr/lib/buildr/scala/doc.rb +142 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/vendor/buildr/lib/buildr/scala/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/scala/tests.rb +171 -0
- data/vendor/buildr/lib/buildr/shell.rb +185 -0
- data/vendor/buildr/lib/buildr/version.rb +18 -0
- data/vendor/buildr/rakelib/all-in-one.rake +113 -0
- data/vendor/buildr/rakelib/checks.rake +57 -0
- data/vendor/buildr/rakelib/doc.rake +137 -0
- data/vendor/buildr/rakelib/metrics.rake +39 -0
- data/vendor/buildr/rakelib/package.rake +73 -0
- data/vendor/buildr/rakelib/release.rake +161 -0
- data/vendor/buildr/rakelib/rspec.rake +101 -0
- data/vendor/buildr/rakelib/setup.rake +66 -0
- data/vendor/buildr/rakelib/stage.rake +220 -0
- data/vendor/buildr/spec/addon/bnd_spec.rb +330 -0
- data/vendor/buildr/spec/addon/drb_spec.rb +328 -0
- data/vendor/buildr/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/vendor/buildr/spec/core/application_spec.rb +631 -0
- data/vendor/buildr/spec/core/build_spec.rb +837 -0
- data/vendor/buildr/spec/core/cc_spec.rb +224 -0
- data/vendor/buildr/spec/core/checks_spec.rb +519 -0
- data/vendor/buildr/spec/core/common_spec.rb +725 -0
- data/vendor/buildr/spec/core/compile_spec.rb +658 -0
- data/vendor/buildr/spec/core/doc_spec.rb +195 -0
- data/vendor/buildr/spec/core/extension_spec.rb +201 -0
- data/vendor/buildr/spec/core/generate_spec.rb +33 -0
- data/vendor/buildr/spec/core/project_spec.rb +772 -0
- data/vendor/buildr/spec/core/run_spec.rb +93 -0
- data/vendor/buildr/spec/core/shell_spec.rb +146 -0
- data/vendor/buildr/spec/core/test_spec.rb +1320 -0
- data/vendor/buildr/spec/core/transport_spec.rb +544 -0
- data/vendor/buildr/spec/core/util_spec.rb +141 -0
- data/vendor/buildr/spec/groovy/bdd_spec.rb +80 -0
- data/vendor/buildr/spec/groovy/compiler_spec.rb +251 -0
- data/vendor/buildr/spec/groovy/doc_spec.rb +65 -0
- data/vendor/buildr/spec/ide/eclipse_spec.rb +739 -0
- data/vendor/buildr/spec/ide/idea_spec.rb +1144 -0
- data/vendor/buildr/spec/java/ant_spec.rb +37 -0
- data/vendor/buildr/spec/java/bdd_spec.rb +374 -0
- data/vendor/buildr/spec/java/cobertura_spec.rb +112 -0
- data/vendor/buildr/spec/java/commands_spec.rb +93 -0
- data/vendor/buildr/spec/java/compiler_spec.rb +252 -0
- data/vendor/buildr/spec/java/doc_spec.rb +56 -0
- data/vendor/buildr/spec/java/ecj_spec.rb +115 -0
- data/vendor/buildr/spec/java/emma_spec.rb +121 -0
- data/vendor/buildr/spec/java/external_spec.rb +56 -0
- data/vendor/buildr/spec/java/java_spec.rb +132 -0
- data/vendor/buildr/spec/java/packaging_spec.rb +1270 -0
- data/vendor/buildr/spec/java/run_spec.rb +78 -0
- data/vendor/buildr/spec/java/test_coverage_helper.rb +257 -0
- data/vendor/buildr/spec/java/tests_spec.rb +497 -0
- data/vendor/buildr/spec/packaging/archive_spec.rb +775 -0
- data/vendor/buildr/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/vendor/buildr/spec/packaging/artifact_spec.rb +1066 -0
- data/vendor/buildr/spec/packaging/packaging_helper.rb +63 -0
- data/vendor/buildr/spec/packaging/packaging_spec.rb +719 -0
- data/vendor/buildr/spec/sandbox.rb +165 -0
- data/vendor/buildr/spec/scala/bdd_spec.rb +124 -0
- data/vendor/buildr/spec/scala/compiler_spec.rb +289 -0
- data/vendor/buildr/spec/scala/doc_spec.rb +88 -0
- data/vendor/buildr/spec/scala/scala.rb +38 -0
- data/vendor/buildr/spec/scala/tests_spec.rb +283 -0
- data/vendor/buildr/spec/spec_helpers.rb +369 -0
- data/vendor/buildr/spec/version_requirement_spec.rb +143 -0
- data/vendor/buildr/spec/xpath_matchers.rb +121 -0
- data/vendor/buildr/tests/BUILDR-320/Buildfile +29 -0
- data/vendor/buildr/tests/JavaSystemProperty/Buildfile +18 -0
- data/vendor/buildr/tests/JavaSystemProperty/src/test/java/FooTest.java +24 -0
- data/vendor/buildr/tests/compile_with_parent/Buildfile +18 -0
- data/vendor/buildr/tests/compile_with_parent/child/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/helloWorld/Buildfile +20 -0
- data/vendor/buildr/tests/helloWorld/src/main/java/HelloWorld.java +23 -0
- data/vendor/buildr/tests/integration_testing.rb +56 -0
- data/vendor/buildr/tests/junit3/Buildfile +9 -0
- data/vendor/buildr/tests/junit3/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/junit3/src/test/java/FooTest.java +28 -0
- data/vendor/buildr/tests/package_war_as_jar/Buildfile +15 -0
- data/vendor/buildr/tests/package_war_as_jar/src/main/java/Foo.java +19 -0
- metadata +524 -0
data/.braids
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm_gemset_create_on_use_flag=1; rvm gemset use buildr-gemjar
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Rhett Sutphin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
buildr-gemjar
|
2
|
+
=============
|
3
|
+
|
4
|
+
`buildr-gemjar` is an extension for [buildr][] that makes it easy to
|
5
|
+
package gems and their dependencies into a jar so that [JRuby can
|
6
|
+
detect them on the classpath][gemjar].
|
7
|
+
|
8
|
+
[buildr]: http://buildr.apache.org/
|
9
|
+
[gemjar]: http://blog.nicksieger.com/articles/2009/01/10/jruby-1-1-6-gems-in-a-jar
|
10
|
+
|
11
|
+
Installing
|
12
|
+
----------
|
13
|
+
|
14
|
+
`buildr-gemjar` is distributed as a rubygem on
|
15
|
+
[rubygems.org][as-gem]. Install it as you would any other gem:
|
16
|
+
|
17
|
+
$ gem install buildr-gemjar
|
18
|
+
|
19
|
+
[as-gem]: https://rubygems.org/gems/buildr-gemjar
|
20
|
+
|
21
|
+
Using
|
22
|
+
-----
|
23
|
+
|
24
|
+
`buildr-gemjar` provides a [package type][buildr-package] called
|
25
|
+
`:gemjar`. Sample use:
|
26
|
+
|
27
|
+
# buildfile
|
28
|
+
require 'buildr-gemjar'
|
29
|
+
|
30
|
+
define 'sinatra-gems' do
|
31
|
+
project.version = '1.1.2'
|
32
|
+
|
33
|
+
package(:gemjar).with_gem('sinatra', project.version)
|
34
|
+
end
|
35
|
+
|
36
|
+
When you run `buildr package`, the result will be a JAR which contains
|
37
|
+
sinatra 1.1.2 and all its dependencies.
|
38
|
+
|
39
|
+
You can specify multiple gems:
|
40
|
+
|
41
|
+
package(:gemjar).
|
42
|
+
with_gem('activesupport', '2.3.10').
|
43
|
+
with_gem('facets, '2.4.5')
|
44
|
+
|
45
|
+
You can specify additional sources on top of rubygems.org:
|
46
|
+
|
47
|
+
package(:gemjar).
|
48
|
+
add_source('http://myrepo.local/gems').
|
49
|
+
with_gem('my-orm', '1.0.3')
|
50
|
+
|
51
|
+
You can also include a gem for which you have a `.gem` package:
|
52
|
+
|
53
|
+
package(:gemjar).with_gem(:file => _('snapshot-gem-2.0.7.pre.gem'))
|
54
|
+
|
55
|
+
[buildr-package]: http://buildr.apache.org/packaging.html
|
56
|
+
|
57
|
+
Caveats
|
58
|
+
-------
|
59
|
+
|
60
|
+
It's important that the name of your JAR not be the same as anything
|
61
|
+
you will `require` from it. E.g., in the sample above, if the JAR
|
62
|
+
were named `sinatra.jar`, it would not be possible to `require
|
63
|
+
"sinatra"` from it. (This is a general JRuby requirement, not
|
64
|
+
something that's specific to this tool.)
|
65
|
+
|
66
|
+
Compatibility
|
67
|
+
-------------
|
68
|
+
|
69
|
+
`buildr-gemjar` has been tested with buildr 1.4.4 on ruby 1.8.7,
|
70
|
+
1.9.2, and JRuby* 1.5.6. It's expected that it will work with any
|
71
|
+
fairly recent version of buildr. It's been tested on OS X and Linux;
|
72
|
+
it may or may not work on Windows.
|
73
|
+
|
74
|
+
(*The spec suite does not execute on JRuby for no reason I've yet
|
75
|
+
been able to track down, but manual testing indicates that the
|
76
|
+
extension works fine on that platform.)
|
77
|
+
|
78
|
+
Future work
|
79
|
+
-----------
|
80
|
+
|
81
|
+
* Use [bundler][] to get a coherent list of dependencies across
|
82
|
+
several gems. (It would already do this, except that bundler
|
83
|
+
doesn't support sourcing a gem from a `.gem` file, which is a more
|
84
|
+
important feature.)
|
85
|
+
* Improve performance. Currently a new JVM is spun up to do each gem
|
86
|
+
install, which can be slow if there are a lot of gems.
|
87
|
+
* Support Windows.
|
88
|
+
|
89
|
+
[bundler]: http://gembundler.com/
|
90
|
+
|
91
|
+
About
|
92
|
+
-----
|
93
|
+
|
94
|
+
Copyright 2011, Rhett Sutphin.
|
95
|
+
|
96
|
+
`buildr-gemjar` was built at [NUBIC][].
|
97
|
+
|
98
|
+
[NUBIC]: http://www.nucats.northwestern.edu/centers/nubic
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "buildr-gemjar/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "buildr-gemjar"
|
7
|
+
s.version = BuildrGemjar::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Rhett Sutphin"]
|
10
|
+
s.email = ["rhett@detailedbalance.net"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Provides buildr support for packaging gems in a JAR for JRuby}
|
13
|
+
|
14
|
+
s.rubyforge_project = "buildr-gemjar"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# Have to use buildr's version for its spec helper to work
|
22
|
+
# s.add_development_dependency 'rspec', '~> 2.4'
|
23
|
+
s.add_development_dependency 'braid', '~> 0.6'
|
24
|
+
|
25
|
+
# Deps for the vendored buildr that's used in testing
|
26
|
+
s.add_development_dependency 'rake', '0.8.7'
|
27
|
+
s.add_development_dependency 'builder', '2.1.2'
|
28
|
+
s.add_development_dependency 'net-ssh', '2.0.23'
|
29
|
+
s.add_development_dependency 'net-sftp', '2.0.4'
|
30
|
+
s.add_development_dependency 'rubyzip', '0.9.4'
|
31
|
+
s.add_development_dependency 'highline', '1.5.1'
|
32
|
+
s.add_development_dependency 'json_pure', '1.4.3'
|
33
|
+
s.add_development_dependency 'rubyforge', '2.0.3'
|
34
|
+
s.add_development_dependency 'hoe', '2.3.3'
|
35
|
+
s.add_development_dependency 'rjb', '1.3.3' if s.platform.to_s == 'ruby'
|
36
|
+
s.add_development_dependency 'rjb', '1.3.2' if s.platform.to_s == 'x86-mswin32'
|
37
|
+
s.add_development_dependency 'atoulme-Antwrap', '0.7.1'
|
38
|
+
s.add_development_dependency 'rspec', '~> 2.1.0'
|
39
|
+
s.add_development_dependency 'xml-simple', '1.0.12'
|
40
|
+
s.add_development_dependency 'minitar', '0.5.3'
|
41
|
+
s.add_development_dependency 'jruby-openssl', '>= 0.7' if s.platform.to_s == 'java'
|
42
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
require 'buildr/java/packaging'
|
2
|
+
|
3
|
+
module BuildrGemjar
|
4
|
+
class GemjarTask < Buildr::Packaging::Java::JarTask
|
5
|
+
def initialize(*args)
|
6
|
+
super
|
7
|
+
@target = File.expand_path("../gem_home", self.to_s)
|
8
|
+
mkdir_p @target
|
9
|
+
|
10
|
+
clean
|
11
|
+
include(@target, :as => '.')
|
12
|
+
enhance do
|
13
|
+
install_gems
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def with_gem(*args)
|
18
|
+
new_gem =
|
19
|
+
if args.first.respond_to?(:has_key?)
|
20
|
+
FileSourcedGem.new(args.first[:file])
|
21
|
+
else
|
22
|
+
NamedGem.new(args[0], args[1])
|
23
|
+
end
|
24
|
+
gems << new_gem
|
25
|
+
enhance new_gem.dependencies
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
def clear_sources
|
30
|
+
sources.clear
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_source(source)
|
35
|
+
sources << source
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
39
|
+
def gems
|
40
|
+
@gems ||= []
|
41
|
+
end
|
42
|
+
|
43
|
+
def sources
|
44
|
+
@sources ||= ['http://rubygems.org']
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def install_gems
|
50
|
+
fail "No gems specified. Did you call #with_gem?" if gems.empty?
|
51
|
+
gems.each do |gem|
|
52
|
+
cmd = [
|
53
|
+
"GEM_HOME='#{@target}'",
|
54
|
+
"java",
|
55
|
+
"-jar",
|
56
|
+
BuildrGemjar.jruby_complete_jar,
|
57
|
+
"-S",
|
58
|
+
"gem",
|
59
|
+
"install",
|
60
|
+
# The behavior of --source changed between rubygems 1.3.6
|
61
|
+
# and 1.5.0. Previously, specifying source(s) overrode the
|
62
|
+
# default source(s). After, specifying source(s) adds onto
|
63
|
+
# the default list. To get the old behavior, you have to
|
64
|
+
# include "--clear-sources". This code wants the old
|
65
|
+
# behavior, but no version of jruby-complete contains a
|
66
|
+
# version of rubygems > 1.3.6, so it's not an issue today.
|
67
|
+
# Later we'll probably have to do version sniffing or
|
68
|
+
# something.
|
69
|
+
# "--clear-sources",
|
70
|
+
sources.collect { |s| ["--source", "'#{s}'"] },
|
71
|
+
"--no-ri",
|
72
|
+
"--no-rdoc",
|
73
|
+
gem.install_command_elements
|
74
|
+
].flatten.join(" ")
|
75
|
+
|
76
|
+
trace cmd
|
77
|
+
out = %x[#{cmd} 2>&1]
|
78
|
+
trace out
|
79
|
+
if out =~ /ERROR/
|
80
|
+
fail out.split("\n").grep(/ERROR/).join("\n")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
class FileSourcedGem
|
86
|
+
attr_accessor :filename
|
87
|
+
|
88
|
+
def initialize(filename)
|
89
|
+
@filename = filename
|
90
|
+
end
|
91
|
+
|
92
|
+
def kind; :file; end
|
93
|
+
|
94
|
+
def install_command_elements
|
95
|
+
[filename]
|
96
|
+
end
|
97
|
+
|
98
|
+
def dependencies
|
99
|
+
[(filename if File.exist?(filename))].compact
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class NamedGem
|
104
|
+
attr_accessor :name, :version
|
105
|
+
|
106
|
+
def initialize(name, version)
|
107
|
+
@name = name
|
108
|
+
@version = version
|
109
|
+
end
|
110
|
+
|
111
|
+
def kind; :named; end
|
112
|
+
|
113
|
+
def install_command_elements
|
114
|
+
[name].tap do |elts|
|
115
|
+
elts << "-v '#{version}'" if version
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def dependencies
|
120
|
+
[]
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
include Buildr::Extension
|
126
|
+
|
127
|
+
def package_as_gemjar(filename)
|
128
|
+
GemjarTask.define_task(filename)
|
129
|
+
end
|
130
|
+
|
131
|
+
def package_as_gemjar_spec(spec)
|
132
|
+
spec.merge(:type => 'jar')
|
133
|
+
end
|
134
|
+
|
135
|
+
def self.jruby_version
|
136
|
+
version = Buildr.settings.build['jruby'] ||
|
137
|
+
(JRUBY_VERSION if Kernel.const_defined?(:JRUBY_VERSION)) ||
|
138
|
+
"1.5.6"
|
139
|
+
end
|
140
|
+
|
141
|
+
def self.jruby_artifact
|
142
|
+
"org.jruby:jruby-complete:jar:#{jruby_version}"
|
143
|
+
end
|
144
|
+
|
145
|
+
class << self
|
146
|
+
attr_accessor :jruby_complete_jar
|
147
|
+
end
|
148
|
+
|
149
|
+
after_define do |project|
|
150
|
+
jruby = project.artifact(BuildrGemjar.jruby_artifact)
|
151
|
+
project.packages.each do |pkg|
|
152
|
+
if pkg.is_a?(GemjarTask)
|
153
|
+
pkg.enhance [jruby]
|
154
|
+
BuildrGemjar.jruby_complete_jar = jruby.to_s
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
class Buildr::Project
|
161
|
+
include BuildrGemjar
|
162
|
+
end
|
data/meta.rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PLATFORMS = {
|
2
|
+
:ruby18 => 'ruby-1.8.7-p330',
|
3
|
+
:jruby => 'jruby-1.5.6',
|
4
|
+
:ruby19 => 'ruby-1.9.2-p136'
|
5
|
+
}
|
6
|
+
|
7
|
+
BUNDLER_VERSION = '1.0.10'
|
8
|
+
|
9
|
+
def ci_env
|
10
|
+
(ENV["GEMJAR_ENV"] || :ruby18).to_sym
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :ci do
|
14
|
+
task :rvmrc do
|
15
|
+
puts "#{PLATFORMS[ci_env]}@buildr-gemjar"
|
16
|
+
end
|
17
|
+
|
18
|
+
task :ensure_bundler_available do
|
19
|
+
unless Gem.available?('bundler', BUNDLER_VERSION)
|
20
|
+
puts "Installing bundler"
|
21
|
+
system "gem install bundler -v '#{BUNDLER_VERSION}'"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
task :setup => [:ensure_bundler_available] do
|
26
|
+
system "bundle _#{BUNDLER_VERSION}_ install"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
task :default => 'ci:setup'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path("../../spec_helper.rb", __FILE__)
|
2
|
+
|
3
|
+
describe BuildrGemjar, "::VERSION" do
|
4
|
+
it "exists" do
|
5
|
+
lambda { BuildrGemjar::VERSION }.should_not raise_error
|
6
|
+
end
|
7
|
+
|
8
|
+
it "has 3 or 4 dot separated parts" do
|
9
|
+
BuildrGemjar::VERSION.split('.').size.should be_between(3, 4)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
require File.expand_path("../spec_helper.rb", __FILE__)
|
2
|
+
|
3
|
+
describe ":gemjar packaging" do
|
4
|
+
describe "#with_gem" do
|
5
|
+
def actual_gems
|
6
|
+
projects.first.packages.first.gems
|
7
|
+
end
|
8
|
+
|
9
|
+
it "accepts a gem name" do
|
10
|
+
define('foo', :version => '1.0') {
|
11
|
+
package(:gemjar).with_gem('shenandoah', '~> 0.1.0')
|
12
|
+
}
|
13
|
+
|
14
|
+
actual_gems.first.kind.should == :named
|
15
|
+
actual_gems.first.name.should == 'shenandoah'
|
16
|
+
actual_gems.first.version.should == '~> 0.1.0'
|
17
|
+
end
|
18
|
+
|
19
|
+
it "defaults the version to nil" do
|
20
|
+
define('foo', :version => '1.0') {
|
21
|
+
package(:gemjar).with_gem('shenandoah')
|
22
|
+
}
|
23
|
+
|
24
|
+
actual_gems.first.kind.should == :named
|
25
|
+
actual_gems.first.name.should == 'shenandoah'
|
26
|
+
actual_gems.first.version.should be_nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it "accepts a filename" do
|
30
|
+
define('foo', :version => '1.0') {
|
31
|
+
package(:gemjar).with_gem(:file => 'foo/bcdatabase-1.0.3.pre.gem')
|
32
|
+
}
|
33
|
+
|
34
|
+
actual_gems.first.kind.should == :file
|
35
|
+
actual_gems.first.filename.should == 'foo/bcdatabase-1.0.3.pre.gem'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "can be invoked multiple times" do
|
39
|
+
define('foo', :version => '1.0') {
|
40
|
+
package(:gemjar).
|
41
|
+
with_gem('ladle', '~> 0.2.0').
|
42
|
+
with_gem(:file => 'target/just-built.gem').
|
43
|
+
with_gem('schema_qualified_tables', '~> 1.0.0')
|
44
|
+
}
|
45
|
+
|
46
|
+
actual_gems.collect { |g| g.kind }.should == [:named, :file, :named]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "sources" do
|
51
|
+
def actual_sources
|
52
|
+
projects.first.packages.first.sources
|
53
|
+
end
|
54
|
+
|
55
|
+
it "defaults to rubygems.org" do
|
56
|
+
define('foo', :version => '1.0') {
|
57
|
+
package(:gemjar)
|
58
|
+
}
|
59
|
+
|
60
|
+
actual_sources.should == %w(http://rubygems.org)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "appends new sources while preserving the default" do
|
64
|
+
define('foo', :version => '1.0') {
|
65
|
+
package(:gemjar).
|
66
|
+
add_source('http://archive.local/gems').
|
67
|
+
with_gem('private-stuff')
|
68
|
+
}
|
69
|
+
|
70
|
+
actual_sources.should == %w(http://rubygems.org http://archive.local/gems)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "can clear the default source" do
|
74
|
+
define('foo', :version => '1.0') {
|
75
|
+
package(:gemjar).clear_sources.add_source('http://archive.local/gems')
|
76
|
+
}
|
77
|
+
|
78
|
+
actual_sources.should == %w(http://archive.local/gems)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "name" do
|
83
|
+
it "uses 'jar' as the extension" do
|
84
|
+
define('foo', :version => '1.0') { package(:gemjar) }
|
85
|
+
project('foo').package(:gemjar).to_s.should =~ /\.jar/
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "execution" do
|
90
|
+
before(:all) do
|
91
|
+
create_repo
|
92
|
+
end
|
93
|
+
|
94
|
+
after(:all) do
|
95
|
+
rm_repo
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_package(invoke=true)
|
99
|
+
r = repo_path
|
100
|
+
define('foo', :version => '2.0') { |project|
|
101
|
+
yield package(:gemjar).clear_sources.add_source("file://#{r}")
|
102
|
+
}
|
103
|
+
@pkg = projects.first.packages.first
|
104
|
+
@pkg.invoke if invoke
|
105
|
+
@pkg.to_s
|
106
|
+
end
|
107
|
+
|
108
|
+
it "includes the explicitly requested gem" do
|
109
|
+
test_package { |p| p.with_gem("c") }.
|
110
|
+
should be_a_jar_containing("specifications/c-2.3.2.gemspec")
|
111
|
+
end
|
112
|
+
|
113
|
+
it "fails if the gem isn't available" do
|
114
|
+
lambda {
|
115
|
+
test_package { |p| p.with_gem("y") }
|
116
|
+
}.should raise_error(/could not find gem y/)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "includes the specific version requested" do
|
120
|
+
test_package { |p| p.with_gem("b", "1.1") }.
|
121
|
+
should be_a_jar_containing("specifications/b-1.1.gemspec")
|
122
|
+
end
|
123
|
+
|
124
|
+
it "fails if the version requested isn't available" do
|
125
|
+
lambda {
|
126
|
+
test_package { |p| p.with_gem("b", "> 2") }
|
127
|
+
}.should raise_error(/could not find gem b/)
|
128
|
+
end
|
129
|
+
|
130
|
+
it "includes dependencies of the requested gem" do
|
131
|
+
test_package { |p| p.with_gem("c") }.
|
132
|
+
should be_a_jar_containing("specifications/a-1.0.gemspec")
|
133
|
+
end
|
134
|
+
|
135
|
+
it "includes the java variant of the gem when applicable" do
|
136
|
+
test_package { |p| p.with_gem("jr") }.
|
137
|
+
should be_a_jar_containing("specifications/jr-1.0-java.gemspec")
|
138
|
+
end
|
139
|
+
|
140
|
+
it "includes more than one explicitly prequested gem" do
|
141
|
+
test_package { |p| p.with_gem("b").with_gem("c") }.
|
142
|
+
should be_a_jar_containing("specifications/b-1.2.gemspec", "specifications/c-2.3.2.gemspec")
|
143
|
+
end
|
144
|
+
|
145
|
+
it "includes a gem from a file" do
|
146
|
+
create_gem "f", "2.3", :path => tmp("other")
|
147
|
+
test_package { |p| p.with_gem(:file => tmp("other", "f-2.3.gem")) }.
|
148
|
+
should be_a_jar_containing("specifications/f-2.3.gemspec")
|
149
|
+
end
|
150
|
+
|
151
|
+
it "fails usefully when a specified file isn't available" do
|
152
|
+
lambda {
|
153
|
+
test_package { |p| p.with_gem(:file => "z-4.5.gem") }
|
154
|
+
}.should raise_error(/could not find gem z-4.5.gem/)
|
155
|
+
end
|
156
|
+
|
157
|
+
it "usually only builds the jar once" do
|
158
|
+
create_gem "f", "2.3", :path => tmp("other")
|
159
|
+
path = test_package(false) { |p| p.with_gem(:file => tmp("other", "f-2.3.gem")) }
|
160
|
+
touch path
|
161
|
+
stat = File.stat(path)
|
162
|
+
sleep 5
|
163
|
+
@pkg.invoke
|
164
|
+
stat.mtime.should == File.stat(path).mtime
|
165
|
+
end
|
166
|
+
|
167
|
+
it "rebuilds the jar if the source file changes" do
|
168
|
+
create_gem "f", "2.3", :path => tmp("other")
|
169
|
+
path = test_package(false) { |p| p.with_gem(:file => tmp("other", "f-2.3.gem")) }
|
170
|
+
touch path
|
171
|
+
stat = File.stat(path)
|
172
|
+
sleep 4
|
173
|
+
touch tmp("other", "f-2.3.gem")
|
174
|
+
@pkg.invoke
|
175
|
+
stat.mtime.should_not == File.stat(path).mtime
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|