rjack-tarpit 2.0.0-java
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/History.rdoc +71 -0
- data/Manifest.txt +45 -0
- data/NOTICE.txt +2 -0
- data/README.rdoc +124 -0
- data/Rakefile +21 -0
- data/lib/rjack-tarpit.rb +40 -0
- data/lib/rjack-tarpit/base.rb +22 -0
- data/lib/rjack-tarpit/base_strategy.rb +175 -0
- data/lib/rjack-tarpit/clean.rb +43 -0
- data/lib/rjack-tarpit/doc.rb +67 -0
- data/lib/rjack-tarpit/gem.rb +119 -0
- data/lib/rjack-tarpit/git.rb +45 -0
- data/lib/rjack-tarpit/line_match.rb +134 -0
- data/lib/rjack-tarpit/readme_parser.rb +74 -0
- data/lib/rjack-tarpit/spec.rb +314 -0
- data/lib/rjack-tarpit/test.rb +110 -0
- data/lib/rjack-tarpit/util.rb +37 -0
- data/test/jproject/History.rdoc +2 -0
- data/test/jproject/Manifest.static +10 -0
- data/test/jproject/Manifest.txt +11 -0
- data/test/jproject/NOTICE.txt +2 -0
- data/test/jproject/README.rdoc +24 -0
- data/test/jproject/Rakefile +7 -0
- data/test/jproject/jproject.gemspec +15 -0
- data/test/jproject/lib/jproject.rb +11 -0
- data/test/jproject/lib/jproject/base.rb +3 -0
- data/test/jproject/pom.xml +75 -0
- data/test/jproject/test/setup.rb +7 -0
- data/test/jproject/test/test_jproject.rb +14 -0
- data/test/setup.rb +7 -0
- data/test/test_projects.rb +71 -0
- data/test/test_readme_parser.rb +97 -0
- data/test/test_tarpit.rb +33 -0
- data/test/zookeeper/History.rdoc +2 -0
- data/test/zookeeper/Manifest.static +10 -0
- data/test/zookeeper/Manifest.txt +13 -0
- data/test/zookeeper/README.rdoc +23 -0
- data/test/zookeeper/Rakefile +7 -0
- data/test/zookeeper/assembly.xml +15 -0
- data/test/zookeeper/lib/rjack-zookeeper.rb +29 -0
- data/test/zookeeper/lib/rjack-zookeeper/base.rb +23 -0
- data/test/zookeeper/pom.xml +73 -0
- data/test/zookeeper/rjack-zookeeper.gemspec +18 -0
- data/test/zookeeper/test/setup.rb +17 -0
- data/test/zookeeper/test/test_zookeeper.rb +14 -0
- metadata +186 -0
data/History.rdoc
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
=== 2.0.0 (2011-1-12)
|
2
|
+
* Major rewrite. Consumer project changes are required on upgrade!
|
3
|
+
See also updated README.
|
4
|
+
* Gem specification details are now in a separate, but highly
|
5
|
+
automated and generally improved gemspec file. This allows full
|
6
|
+
interoperability with Bundler.
|
7
|
+
* Improved ReadmeParser for spec automation.
|
8
|
+
* For Java projects, Maven is now executed in process via the
|
9
|
+
rjack-maven gem (speed improvement)
|
10
|
+
* Hoe is no longer a dependency, however many Hoe compatible tasks are
|
11
|
+
still supported.
|
12
|
+
* New default, in process Minitest launcher (speed improvement,
|
13
|
+
particularly on JRuby)
|
14
|
+
|
15
|
+
=== 1.4.0 (2011-9-21)
|
16
|
+
* Update/broaden to rdoc ~> 3.6
|
17
|
+
* Update to hoe ~> 2.12.3
|
18
|
+
|
19
|
+
=== 1.3.3 (2011-6-26)
|
20
|
+
* Ruby 1.9 compatibility fix; to_a -> Array()
|
21
|
+
|
22
|
+
=== 1.3.2 (2011-6-11)
|
23
|
+
* Fix case where :install task would omit running "mvn install" due to
|
24
|
+
prior run of "mvn package".
|
25
|
+
* Add conditional Rake::DSL includes for rake ~> 0.9.0.
|
26
|
+
* Update rdoc dependency to >= 2.5.11, < 3.7 (3.6.1 works well.)
|
27
|
+
|
28
|
+
=== 1.3.1 (2011-5-19)
|
29
|
+
* On gem install(_deps), only ignore gem SystemExitException when
|
30
|
+
exit_code == 0; Fail on failed install.
|
31
|
+
|
32
|
+
=== 1.3.0 (2011-2-5)
|
33
|
+
* Add new install_deps task to install missing or all gem
|
34
|
+
dev. dependencies.
|
35
|
+
* Use hard links for jars to avoid package problems with rubygems 1.4+
|
36
|
+
* Update to hoe 2.8.0 and drop now unnecessary explicit dependency on
|
37
|
+
rubyforge.
|
38
|
+
* Update rdoc dependency to >= 2.5.11, < 3.6 (3.5.2 works well.)
|
39
|
+
* Generate manifest only once per run.
|
40
|
+
* Fix git status check on tag (status --only flag no longer supported.)
|
41
|
+
|
42
|
+
=== 1.2.3 (2010-12-28)
|
43
|
+
* Update rdoc dependency to >= 2.5.11, < 3.1 (3.0.1 works well.)
|
44
|
+
|
45
|
+
=== 1.2.2 (2010-7-8)
|
46
|
+
* Actually, use both Gem.configuration['gem'] and [command] in gem
|
47
|
+
command tasks (i.e. .gemrc with install: args)
|
48
|
+
* Perform a 'mvn install' with rake :install task, checking for
|
49
|
+
changes since last .tarpit-install.
|
50
|
+
|
51
|
+
=== 1.2.1 (2010-4-21)
|
52
|
+
* Also require 'rubygems/command_manager' for gem tasks (ruby)
|
53
|
+
* Really use Gem.configuration['gem'] in gem command tasks.
|
54
|
+
|
55
|
+
=== 1.2.0 (2010-3-6)
|
56
|
+
* Add RJack::TarPit::BaseStrategy.test_line_match for common
|
57
|
+
version, etc. file checks. See example usage in this gem's Rakefile.
|
58
|
+
* Add :java_platform flag for setting gem specification platform to java.
|
59
|
+
* Add available Gem.configuration in gem command tasks.
|
60
|
+
* Fix tag task outside of RJack repo.
|
61
|
+
|
62
|
+
=== 1.1.0 (2009-12-19)
|
63
|
+
* Add :rdoc_diagram option to use Graphviz dot --diagram with rdoc.
|
64
|
+
* Added gem :push (gemcutter) and :install tasks
|
65
|
+
|
66
|
+
=== 1.0.1 (2009-10-11)
|
67
|
+
* Make Hoe the last dependency to avoid version conflict with
|
68
|
+
rubyforge or others.
|
69
|
+
|
70
|
+
=== 1.0.0 (2009-10-10)
|
71
|
+
* Initial release.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
History.rdoc
|
2
|
+
Manifest.txt
|
3
|
+
NOTICE.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
lib/rjack-tarpit/base.rb
|
7
|
+
lib/rjack-tarpit.rb
|
8
|
+
lib/rjack-tarpit/base_strategy.rb
|
9
|
+
lib/rjack-tarpit/clean.rb
|
10
|
+
lib/rjack-tarpit/doc.rb
|
11
|
+
lib/rjack-tarpit/gem.rb
|
12
|
+
lib/rjack-tarpit/git.rb
|
13
|
+
lib/rjack-tarpit/line_match.rb
|
14
|
+
lib/rjack-tarpit/readme_parser.rb
|
15
|
+
lib/rjack-tarpit/spec.rb
|
16
|
+
lib/rjack-tarpit/test.rb
|
17
|
+
lib/rjack-tarpit/util.rb
|
18
|
+
test/setup.rb
|
19
|
+
test/test_projects.rb
|
20
|
+
test/test_readme_parser.rb
|
21
|
+
test/test_tarpit.rb
|
22
|
+
test/jproject/History.rdoc
|
23
|
+
test/jproject/Manifest.static
|
24
|
+
test/jproject/Manifest.txt
|
25
|
+
test/jproject/NOTICE.txt
|
26
|
+
test/jproject/README.rdoc
|
27
|
+
test/jproject/Rakefile
|
28
|
+
test/jproject/jproject.gemspec
|
29
|
+
test/jproject/pom.xml
|
30
|
+
test/jproject/lib/jproject/base.rb
|
31
|
+
test/jproject/lib/jproject.rb
|
32
|
+
test/jproject/test/setup.rb
|
33
|
+
test/jproject/test/test_jproject.rb
|
34
|
+
test/zookeeper/History.rdoc
|
35
|
+
test/zookeeper/Manifest.static
|
36
|
+
test/zookeeper/Manifest.txt
|
37
|
+
test/zookeeper/README.rdoc
|
38
|
+
test/zookeeper/Rakefile
|
39
|
+
test/zookeeper/assembly.xml
|
40
|
+
test/zookeeper/pom.xml
|
41
|
+
test/zookeeper/rjack-zookeeper.gemspec
|
42
|
+
test/zookeeper/lib/rjack-zookeeper/base.rb
|
43
|
+
test/zookeeper/lib/rjack-zookeeper.rb
|
44
|
+
test/zookeeper/test/setup.rb
|
45
|
+
test/zookeeper/test/test_zookeeper.rb
|
data/NOTICE.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
= rjack-tarpit
|
2
|
+
|
3
|
+
* http://rjack.rubyforge.org/tarpit
|
4
|
+
* http://rjack.rubyforge.org
|
5
|
+
* https://github.com/dekellum/rjack
|
6
|
+
|
7
|
+
== Description
|
8
|
+
|
9
|
+
TarPit provides the glue for an unholy union of build tools. TarPit
|
10
|
+
includes general automation for any rubygems project. It originally
|
11
|
+
used and remains heavily influenced by
|
12
|
+
Hoe[http://seattlerb.rubyforge.org/hoe/] (e.g. Manifest.txt.)
|
13
|
+
However, it fully supports use of Bundler[http://gembundler.com/]. The
|
14
|
+
gemspec benefits from sensible automation but remains in
|
15
|
+
a <project>.gemspec per Bundler's requirements.
|
16
|
+
|
17
|
+
For java platform projects, TarPit offers Maven integration via the
|
18
|
+
rjack-maven[http://rjack.rubyforge.org/maven] gem. Maven
|
19
|
+
package/install is run as needed, and jars are linked to the gem lib
|
20
|
+
directory for inclusion, with semi-automatic Manifest.txt production.
|
21
|
+
No need to bloat your git repo by checking in every version of every
|
22
|
+
jar for all time. The standard Maven layout and configuration
|
23
|
+
(i.e. src, target, pom.xml, assembly.xml) is otherwise retained for
|
24
|
+
complete java tool set compatibility. Use Maven only for what is it
|
25
|
+
good at: java compilation with dependencies. Use Rake for everything
|
26
|
+
else.
|
27
|
+
|
28
|
+
=== Features
|
29
|
+
|
30
|
+
* In Rake/JVM process Maven execution via rjack-maven (speed)
|
31
|
+
* Default, in Rake process
|
32
|
+
Minitest[http://docs.seattlerb.org/minitest/] launcher (speed)
|
33
|
+
* Manifest.txt for gem file contents, derived from Manifest.static
|
34
|
+
plus jars in Java projects
|
35
|
+
* ReadmeParser for default specification url, summary, description
|
36
|
+
values
|
37
|
+
* Specification name defaults from <name>.gemspec
|
38
|
+
* LineMatchTaskDefiner defines check_(history|init)_(version|date)
|
39
|
+
tasks where appropriate to avoid missing history or version updates
|
40
|
+
on release
|
41
|
+
|
42
|
+
=== Java strategies
|
43
|
+
|
44
|
+
Java projects require different strategies for integrating Maven,
|
45
|
+
specified via +s.maven_strategy=+ and summarized below:
|
46
|
+
|
47
|
+
+:no_assembly+ :: pom.xml builds a single jar, default same name and
|
48
|
+
same version as gem project (SpecHelper.default_jar)
|
49
|
+
or specified via +s.jars=+.
|
50
|
+
|
51
|
+
+:jars_from_assembly+ :: assembly.xml defines the jars at Maven
|
52
|
+
package time. Changes to this set of jars
|
53
|
+
must be incorporated by explicitly running
|
54
|
+
the `rake manifest` task.
|
55
|
+
|
56
|
+
Default :: No java, or use assembly for multiple jars but specify
|
57
|
+
+s.jars=+ when they can be computed, for example from
|
58
|
+
common version number or other gem data. This avoids the
|
59
|
+
need for the `rake manifest` step of +:jars_from_assembly+.
|
60
|
+
|
61
|
+
Assemblies are built and located with the pom version number. This
|
62
|
+
defaults to gem project version, but can be fixed
|
63
|
+
(i.e. s.assembly_version='1.0') to avoid a separate version to bump,
|
64
|
+
where the project will not export the pom, for example when the
|
65
|
+
project is re-packaging upstream jars as a gem.
|
66
|
+
|
67
|
+
== Synopsis
|
68
|
+
|
69
|
+
Sample gemspec for a gem including a single jar, built from java
|
70
|
+
source with maven (see also included test/jproject):
|
71
|
+
|
72
|
+
gem 'rjack-tarpit', '~> 2.0'
|
73
|
+
require 'rjack-tarpit/spec'
|
74
|
+
|
75
|
+
RJack::TarPit.specify do |s|
|
76
|
+
require 'jproject/base'
|
77
|
+
|
78
|
+
s.version = JProject::VERSION
|
79
|
+
|
80
|
+
s.add_developer 'David Kellum', 'dek-oss@gravitext.com'
|
81
|
+
|
82
|
+
s.maven_strategy = :no_assembly
|
83
|
+
|
84
|
+
s.depend 'rjack-slf4j', '~> 1.6.4'
|
85
|
+
s.depend 'minitest', '~> 2.3', :dev
|
86
|
+
end
|
87
|
+
|
88
|
+
And the associated Rakefile (assuming use of Bundler):
|
89
|
+
|
90
|
+
require 'rubygems'
|
91
|
+
require 'bundler/setup'
|
92
|
+
require 'rjack-tarpit'
|
93
|
+
|
94
|
+
RJack::TarPit.new( "jproject" ).define_tasks
|
95
|
+
|
96
|
+
And a Bundler Gemfile:
|
97
|
+
|
98
|
+
source :rubygems
|
99
|
+
gemspec
|
100
|
+
|
101
|
+
Java projects should provide a Manifest.static. Jars or other
|
102
|
+
generated files will be added to this to produce Manifest.txt for use
|
103
|
+
as the gemspec's files.
|
104
|
+
|
105
|
+
== Dependencies
|
106
|
+
|
107
|
+
See the gem dependencies. The rjack-maven gem is only a dependency on
|
108
|
+
the java platform.
|
109
|
+
|
110
|
+
== License
|
111
|
+
|
112
|
+
Copyright (c) 2009-2012 David Kellum
|
113
|
+
|
114
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you
|
115
|
+
may not use this file except in compliance with the License. You
|
116
|
+
may obtain a copy of the License at:
|
117
|
+
|
118
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
119
|
+
|
120
|
+
Unless required by applicable law or agreed to in writing, software
|
121
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
122
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
123
|
+
implied. See the License for the specific language governing
|
124
|
+
permissions and limitations under the License.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
5
|
+
|
6
|
+
require 'rjack-tarpit'
|
7
|
+
|
8
|
+
RJack::TarPit.new( 'rjack-tarpit' ) do |tp|
|
9
|
+
|
10
|
+
tp.rdoc_destinations <<
|
11
|
+
'dekellum@rubyforge.org:/var/www/gforge-projects/rjack/tarpit'
|
12
|
+
|
13
|
+
desc "Check that README sample has latest version"
|
14
|
+
task :check_sample_version do
|
15
|
+
tp.test_line_match( 'README.rdoc',
|
16
|
+
/^\s*gem.+rjack-tarpit/,
|
17
|
+
/#{ RJack::TarPit::MINOR_VERSION }/ )
|
18
|
+
end
|
19
|
+
[ :gem, :tag, :push ].each { |t| task t => :check_sample_version }
|
20
|
+
|
21
|
+
end
|
data/lib/rjack-tarpit.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2012 David Kellum
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
5
|
+
# may not use this file except in compliance with the License. You
|
6
|
+
# 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,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
13
|
+
# implied. See the License for the specific language governing
|
14
|
+
# permissions and limitations under the License.
|
15
|
+
#++
|
16
|
+
|
17
|
+
require 'rjack-tarpit/base'
|
18
|
+
require 'rjack-tarpit/spec'
|
19
|
+
require 'rjack-tarpit/base_strategy'
|
20
|
+
|
21
|
+
module RJack::TarPit
|
22
|
+
|
23
|
+
# New task generator given name matching <name>.gemspec in the
|
24
|
+
# current directory. If block is given, yields self (err, actually
|
25
|
+
# the BaseStrategy) to block and calls define_tasks upon exit.
|
26
|
+
def self.new( name )
|
27
|
+
|
28
|
+
load( "#{name}.gemspec", true )
|
29
|
+
|
30
|
+
tp = BaseStrategy.new( last_spec )
|
31
|
+
|
32
|
+
if block_given?
|
33
|
+
yield tp
|
34
|
+
tp.define_tasks
|
35
|
+
end
|
36
|
+
|
37
|
+
tp
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2012 David Kellum
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
5
|
+
# may not use this file except in compliance with the License. You
|
6
|
+
# 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,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
13
|
+
# implied. See the License for the specific language governing
|
14
|
+
# permissions and limitations under the License.
|
15
|
+
#++
|
16
|
+
|
17
|
+
module RJack
|
18
|
+
module TarPit
|
19
|
+
MINOR_VERSION = '2.0'
|
20
|
+
VERSION = MINOR_VERSION + '.0'
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2012 David Kellum
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
5
|
+
# may not use this file except in compliance with the License. You
|
6
|
+
# 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,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
13
|
+
# implied. See the License for the specific language governing
|
14
|
+
# permissions and limitations under the License.
|
15
|
+
#++
|
16
|
+
|
17
|
+
require 'rjack-tarpit/base'
|
18
|
+
require 'rjack-tarpit/util'
|
19
|
+
require 'rjack-tarpit/spec'
|
20
|
+
|
21
|
+
require 'rjack-tarpit/test'
|
22
|
+
require 'rjack-tarpit/gem'
|
23
|
+
require 'rjack-tarpit/clean'
|
24
|
+
require 'rjack-tarpit/line_match'
|
25
|
+
require 'rjack-tarpit/doc'
|
26
|
+
require 'rjack-tarpit/git'
|
27
|
+
|
28
|
+
module RJack::TarPit
|
29
|
+
|
30
|
+
# Base class for Rake task generation.
|
31
|
+
class BaseStrategy
|
32
|
+
|
33
|
+
#For rack ~> 0.9.0
|
34
|
+
include Rake::DSL if defined?( Rake::DSL )
|
35
|
+
|
36
|
+
include TestTaskDefiner
|
37
|
+
include GemTaskDefiner
|
38
|
+
include CleanTaskDefiner
|
39
|
+
include LineMatchTaskDefiner
|
40
|
+
include DocTaskDefiner
|
41
|
+
include GitTaskDefiner
|
42
|
+
|
43
|
+
include Util
|
44
|
+
|
45
|
+
# The augmented Gem::Specification as constructed.
|
46
|
+
attr_reader :spec
|
47
|
+
|
48
|
+
# See TarPit.new
|
49
|
+
def initialize( spec )
|
50
|
+
@defines = [ :define_maven_tasks ]
|
51
|
+
super()
|
52
|
+
|
53
|
+
@spec = spec
|
54
|
+
|
55
|
+
@install_request = Rake.application.top_level_tasks.include?( "install" )
|
56
|
+
end
|
57
|
+
|
58
|
+
def add_define_hook( sym )
|
59
|
+
@defines << sym
|
60
|
+
end
|
61
|
+
|
62
|
+
# Define rake tasks (given settings)
|
63
|
+
def define_tasks
|
64
|
+
@defines.each { |sym| send( sym ) }
|
65
|
+
end
|
66
|
+
|
67
|
+
# Define maven tasks based on spec strategy and other details.
|
68
|
+
def define_maven_tasks
|
69
|
+
from_assembly = ( spec.maven_strategy == :jars_from_assembly )
|
70
|
+
do_maven = from_assembly || spec.jars.size > 0
|
71
|
+
|
72
|
+
define_maven_package_task if do_maven
|
73
|
+
|
74
|
+
if do_maven || spec.generated_files
|
75
|
+
define_manifest_task
|
76
|
+
task( :manifest => [ MVN_STATE_FILE ] ) if from_assembly
|
77
|
+
end
|
78
|
+
|
79
|
+
define_post_maven_tasks if do_maven
|
80
|
+
end
|
81
|
+
|
82
|
+
# Define task for dynamically generating Manifest.txt
|
83
|
+
def define_manifest_task
|
84
|
+
|
85
|
+
if File.exist?( 'Manifest.static' )
|
86
|
+
file 'Manifest.txt' => [ 'Manifest.static' ]
|
87
|
+
end
|
88
|
+
|
89
|
+
gf = clean_list( spec.generated_files ).sort
|
90
|
+
[ :gem, :test ].each { |t| task t => gf }
|
91
|
+
|
92
|
+
unless gf.empty?
|
93
|
+
task :gen_clean do
|
94
|
+
rm_f gf
|
95
|
+
end
|
96
|
+
task :clean => :gen_clean
|
97
|
+
end
|
98
|
+
|
99
|
+
desc "Force update of Manifest.txt"
|
100
|
+
task :manifest do
|
101
|
+
spec.generate_manifest
|
102
|
+
end
|
103
|
+
|
104
|
+
mtask = file 'Manifest.txt' do
|
105
|
+
spec.generate_manifest
|
106
|
+
end
|
107
|
+
|
108
|
+
mtask
|
109
|
+
end
|
110
|
+
|
111
|
+
# File touched to record the time of last successful 'mvn
|
112
|
+
# package' run.
|
113
|
+
MVN_STATE_FILE = 'target/.tarpit'
|
114
|
+
MVN_STATE_FILE_INSTALL = 'target/.tarpit-install'
|
115
|
+
|
116
|
+
# Define a file task tracking calls to "mvn package"
|
117
|
+
def define_maven_package_task
|
118
|
+
[ MVN_STATE_FILE, MVN_STATE_FILE_INSTALL ].each do |sf|
|
119
|
+
file sf => maven_dependencies do
|
120
|
+
run_maven
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
task :install => MVN_STATE_FILE_INSTALL
|
125
|
+
end
|
126
|
+
|
127
|
+
# Run Maven mvn package or install and touch state files.
|
128
|
+
def run_maven
|
129
|
+
# Delay till now, in case we were not running on jvm
|
130
|
+
require 'rjack-maven'
|
131
|
+
|
132
|
+
target = @install_request ? 'install' : 'package'
|
133
|
+
|
134
|
+
status = RJack::Maven.launch( [ target ] )
|
135
|
+
unless status == 0
|
136
|
+
raise "TARPIT: Maven #{target} failed (exit code: #{status})"
|
137
|
+
end
|
138
|
+
|
139
|
+
touch( MVN_STATE_FILE )
|
140
|
+
touch( MVN_STATE_FILE_INSTALL ) if @install_request
|
141
|
+
end
|
142
|
+
|
143
|
+
# Define file tasks for all jar symlinks and other misc. maven
|
144
|
+
# associated tasks like :mvn_clean.
|
145
|
+
def define_post_maven_tasks
|
146
|
+
jfrom = spec.jar_from
|
147
|
+
spec.jars.each do |jar|
|
148
|
+
from = File.join( jfrom, jar )
|
149
|
+
dest = File.join( spec.jar_dest, jar )
|
150
|
+
file from => [ MVN_STATE_FILE ]
|
151
|
+
file dest => [ from ] do
|
152
|
+
ln( from, dest, :force => true )
|
153
|
+
end
|
154
|
+
[ :gem, :test ].each { |t| task t => [ dest ] }
|
155
|
+
end
|
156
|
+
|
157
|
+
task :mvn_clean do
|
158
|
+
spec.remove_dest_jars
|
159
|
+
rm_rf 'target' if File.directory?( 'target' )
|
160
|
+
end
|
161
|
+
task :clean => :mvn_clean
|
162
|
+
end
|
163
|
+
|
164
|
+
# Dependencies on "mvn package" including pom.xml, any assembly.xml,
|
165
|
+
# all files under the "src" directory.
|
166
|
+
def maven_dependencies
|
167
|
+
deps = [ 'pom.xml' ]
|
168
|
+
deps << 'assembly.xml' if File.exist?( 'assembly.xml' )
|
169
|
+
deps += FileList[ "src/**/*" ].exclude { |f| ! File.file?( f ) }
|
170
|
+
deps
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|