rjack-tarpit 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +7 -0
- data/README.rdoc +1 -1
- data/Rakefile +11 -0
- data/lib/rjack-tarpit.rb +64 -9
- metadata +2 -2
data/History.rdoc
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 1.2.0 (2010-3-6)
|
2
|
+
* Add RJack::TarPit::BaseStrategy.test_line_match for common
|
3
|
+
version, etc. file checks. See example usage in this gem's Rakefile.
|
4
|
+
* Add :java_platform flag for setting gem specification platform to java.
|
5
|
+
* Add available Gem.configuration in gem command tasks.
|
6
|
+
* Fix tag task outside of RJack repo.
|
7
|
+
|
1
8
|
=== 1.1.0 (2009-12-19)
|
2
9
|
* Add :rdoc_diagram option to use Graphviz dot --diagram with rdoc.
|
3
10
|
* Added gem :push (gemcutter) and :install tasks
|
data/README.rdoc
CHANGED
@@ -53,7 +53,7 @@ Besides the explicit gem dependencies, TarPit requires:
|
|
53
53
|
|
54
54
|
== License
|
55
55
|
|
56
|
-
Copyright (c) 2009 David Kellum
|
56
|
+
Copyright (c) 2009-2010 David Kellum
|
57
57
|
|
58
58
|
Licensed under the Apache License, Version 2.0 (the "License"); you
|
59
59
|
may not use this file except in compliance with the License. You
|
data/Rakefile
CHANGED
@@ -36,4 +36,15 @@ t.specify do |h|
|
|
36
36
|
h.remote_rdoc_dir = 'tarpit'
|
37
37
|
end
|
38
38
|
|
39
|
+
task :check_history_version do
|
40
|
+
t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
|
41
|
+
end
|
42
|
+
task :check_history_date do
|
43
|
+
t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
|
44
|
+
end
|
45
|
+
|
46
|
+
task :gem => [ :check_history_version ]
|
47
|
+
task :tag => [ :check_history_version, :check_history_date ]
|
48
|
+
task :push => [ :check_history_date ]
|
49
|
+
|
39
50
|
t.define_tasks
|
data/lib/rjack-tarpit.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (C) 2009 David Kellum
|
2
|
+
# Copyright (C) 2009-2010 David Kellum
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
5
5
|
# may not use this file except in compliance with the License. You
|
@@ -21,7 +21,7 @@ module RJack
|
|
21
21
|
# Provides glue for Rake, Hoe, and Maven by generating tasks.
|
22
22
|
module TarPit
|
23
23
|
# Module version
|
24
|
-
VERSION = '1.
|
24
|
+
VERSION = '1.2.0'
|
25
25
|
|
26
26
|
# Construct new task generator by gem name, version, and flags. A descendant
|
27
27
|
# of BaseStrategy is returned.
|
@@ -30,6 +30,7 @@ module RJack
|
|
30
30
|
# set in Rakefile.
|
31
31
|
# :no_assembly:: One jar created from source, jars=[default_jar],
|
32
32
|
# no assembly setup in maven.
|
33
|
+
# :java_platform:: Set gem specification platform to java.
|
33
34
|
def self.new( name, version, *flags )
|
34
35
|
if flags.include?( :jars_from_assembly )
|
35
36
|
JarsFromAssembly.new( name, version, flags )
|
@@ -77,6 +78,7 @@ module RJack
|
|
77
78
|
@jar_dest = File.join( 'lib', @name )
|
78
79
|
@hoe_specifier = :unset
|
79
80
|
@rdoc_diagram = false
|
81
|
+
@spec = nil
|
80
82
|
end
|
81
83
|
|
82
84
|
# Return a default jar name built from name and version
|
@@ -114,6 +116,38 @@ module RJack
|
|
114
116
|
define_gem_tasks
|
115
117
|
end
|
116
118
|
|
119
|
+
# Test that all specified files have at least one line matching
|
120
|
+
# line_regex, and that first line additionally matches (optional)
|
121
|
+
# pass_line_regex.
|
122
|
+
# ==== Parameters
|
123
|
+
# files<~to_a>:: List of files to test
|
124
|
+
# line_regex<Regexp>:: Test first matching line
|
125
|
+
# pass_line_regex:: Further test on match line (default: match all)
|
126
|
+
# ==== Raises
|
127
|
+
# RuntimeError:: on test failure.
|
128
|
+
def test_line_match( files, line_regex, pass_line_regex = // )
|
129
|
+
files.to_a.each do |mfile|
|
130
|
+
found = false
|
131
|
+
open( mfile ) do |mf|
|
132
|
+
num = 0
|
133
|
+
mf.each do |line|
|
134
|
+
num += 1
|
135
|
+
if line =~ line_regex
|
136
|
+
found = true
|
137
|
+
unless line =~ pass_line_regex
|
138
|
+
raise( "%s:%d: %s !~ %s" %
|
139
|
+
[ mfile, num, line.strip, pass_line_regex.inspect ] )
|
140
|
+
end
|
141
|
+
break
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
unless found
|
146
|
+
raise "#{mfile}: #{line_regex.inspect} not found"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
117
151
|
# Define task for dynamically generating Manifest.txt, by
|
118
152
|
# appending array returned by the given block to specified files, or
|
119
153
|
# contents of Manifest.static.
|
@@ -197,7 +231,7 @@ module RJack
|
|
197
231
|
desc "git tag current version"
|
198
232
|
task :tag do
|
199
233
|
tag = [ name, version ].join( '-' )
|
200
|
-
dname =
|
234
|
+
dname = Rake.original_dir
|
201
235
|
dname = '.' if Dir.getwd == dname
|
202
236
|
sh( "git status --only #{dname}" ) do |ok,res|
|
203
237
|
if ok #changes present
|
@@ -213,18 +247,36 @@ module RJack
|
|
213
247
|
desc "gem push (gemcutter)"
|
214
248
|
task :push => [ :gem ] do
|
215
249
|
require 'rubygems'
|
216
|
-
cm = Gem::CommandManager
|
217
|
-
cm.run(
|
250
|
+
cm = Gem::CommandManager.instance
|
251
|
+
cm.run( gem_config( 'push' ) +
|
252
|
+
[ '-V', gem_file ] )
|
218
253
|
end
|
219
254
|
|
220
255
|
desc "gem install (default install dir)"
|
221
256
|
task :install => [ :gem ] do
|
222
257
|
require 'rubygems'
|
223
|
-
cm = Gem::CommandManager
|
224
|
-
cm.run(
|
258
|
+
cm = Gem::CommandManager.instance
|
259
|
+
cm.run( gem_config( 'install' ) +
|
260
|
+
[ '--no-ri', '-V', gem_file ] )
|
225
261
|
end
|
226
262
|
end
|
227
263
|
|
264
|
+
def gem_file
|
265
|
+
parts = [ name, version ]
|
266
|
+
if @spec
|
267
|
+
pform = @spec.spec_extras[ :platform ]
|
268
|
+
parts << 'java' if ( pform && pform.os == 'java' )
|
269
|
+
end
|
270
|
+
|
271
|
+
"pkg/#{ parts.join( '-' ) }.gem"
|
272
|
+
end
|
273
|
+
|
274
|
+
def gem_config( command )
|
275
|
+
cargs = Gem.configuration[ command ]
|
276
|
+
cargs = cargs.is_a?( String ) ? cargs.split( ' ' ) : cargs.to_a
|
277
|
+
[ command ] + cargs
|
278
|
+
end
|
279
|
+
|
228
280
|
# Setup Hoe via Hoe.spec
|
229
281
|
def hoe_specify
|
230
282
|
|
@@ -236,13 +288,16 @@ module RJack
|
|
236
288
|
unless @hoe_specifier == :unset
|
237
289
|
tp = self
|
238
290
|
outer = @hoe_specifier
|
239
|
-
|
240
|
-
|
291
|
+
jplat = @flags.include?( :java_platform )
|
292
|
+
@spec = Hoe.spec( @name ) do |h|
|
241
293
|
|
294
|
+
h.version = tp.version
|
242
295
|
h.readme_file = 'README.rdoc' if File.exist?( 'README.rdoc' )
|
243
296
|
h.history_file = 'History.rdoc' if File.exist?( 'History.rdoc' )
|
244
297
|
h.extra_rdoc_files = FileList[ '*.rdoc' ]
|
245
298
|
|
299
|
+
h.spec_extras[ :platform ] = Gem::Platform.new( "java" ) if jplat
|
300
|
+
|
246
301
|
outer.call( h )
|
247
302
|
end
|
248
303
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjack-tarpit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Kellum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-03-06 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|