rjack-tarpit 1.4.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +13 -9
- data/Manifest.txt +39 -0
- data/NOTICE.txt +1 -1
- data/README.rdoc +85 -30
- data/Rakefile +11 -30
- data/lib/rjack-tarpit.rb +15 -456
- 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/{pkg/rjack-zookeeper-3.4.1.0-java/test → test}/test_zookeeper.rb +0 -0
- metadata +132 -66
- data/.gemtest +0 -0
@@ -0,0 +1,110 @@
|
|
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 may
|
6
|
+
# 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::TarPit
|
18
|
+
|
19
|
+
module TestTaskDefiner
|
20
|
+
|
21
|
+
# Proc for setting Rake TestTask options
|
22
|
+
# (default: nil, no-op)
|
23
|
+
attr_accessor :test_task_config
|
24
|
+
|
25
|
+
# Support same options as Rake::TestTask, plus tarpit's own
|
26
|
+
# :mini_in_proc (default) option, which loads minitest tests and
|
27
|
+
# runs in (rake) process.
|
28
|
+
attr_accessor :test_loader
|
29
|
+
|
30
|
+
# Proc for setting RSpec::Core::RakeTask options
|
31
|
+
# (default: nil, no-op)
|
32
|
+
attr_accessor :rspec_task_config
|
33
|
+
|
34
|
+
def initialize
|
35
|
+
super
|
36
|
+
|
37
|
+
@test_loader = :mini_in_proc
|
38
|
+
@test_task_config = nil
|
39
|
+
@rspec_task_config = nil
|
40
|
+
|
41
|
+
add_define_hook( :define_test_tasks )
|
42
|
+
add_define_hook( :define_spec_tasks )
|
43
|
+
end
|
44
|
+
|
45
|
+
def define_spec_tasks
|
46
|
+
|
47
|
+
if File.directory?( "spec" ) || rspec_task_config
|
48
|
+
require 'rspec/core/rake_task'
|
49
|
+
|
50
|
+
desc "Run RSpec on specifications"
|
51
|
+
RSpec::Core::RakeTask.new( :spec ) do |t|
|
52
|
+
t.rspec_opts ||= []
|
53
|
+
t.rspec_opts += %w[ -Ispec:lib ]
|
54
|
+
rspec_task_config.call( t ) if rspec_task_config
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Run RSpec on specifications"
|
58
|
+
task :test => [ :spec ]
|
59
|
+
|
60
|
+
task :default => [ :test ]
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
def define_test_tasks
|
66
|
+
|
67
|
+
if test_loader == :mini_in_proc
|
68
|
+
|
69
|
+
tfiles = FileList[ "test/test*.rb" ]
|
70
|
+
if !tfiles.empty?
|
71
|
+
|
72
|
+
desc "Run minitest tests (in rake process)"
|
73
|
+
task :test do |t,args|
|
74
|
+
require 'minitest/unit'
|
75
|
+
|
76
|
+
MiniTest::Unit.class_eval do
|
77
|
+
def self.autorun # :nodoc:
|
78
|
+
# disable autorun, as we are running ourselves
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
tfiles.each { |f| load f }
|
83
|
+
|
84
|
+
code = MiniTest::Unit.new.run( ( ENV['TESTOPTS'] || '' ).split )
|
85
|
+
fail "test failed (#{code})" if code && code > 0
|
86
|
+
puts
|
87
|
+
end
|
88
|
+
|
89
|
+
else
|
90
|
+
desc "No-op"
|
91
|
+
task :test
|
92
|
+
end
|
93
|
+
|
94
|
+
else
|
95
|
+
|
96
|
+
require 'rake/testtask'
|
97
|
+
|
98
|
+
Rake::TestTask.new do |t|
|
99
|
+
t.loader = test_loader
|
100
|
+
test_task_config.call( t ) if test_task_config
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
task :default => [ :test ]
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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::TarPit
|
18
|
+
module Util
|
19
|
+
|
20
|
+
module_function
|
21
|
+
|
22
|
+
# Read a list of files and return a cleaned list.
|
23
|
+
def read_file_list( sfile )
|
24
|
+
clean_list( open( sfile ) { |f| f.readlines } )
|
25
|
+
end
|
26
|
+
|
27
|
+
# Cleanup a list of files
|
28
|
+
def clean_list( l )
|
29
|
+
Array( l ).
|
30
|
+
compact.
|
31
|
+
map { |f| f.strip }.
|
32
|
+
reject { |f| f.empty? }
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
= jproject
|
2
|
+
|
3
|
+
* http://rjack.rubyforge.org/tarpit
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
A simple project for testing. This project contains a single java jar
|
8
|
+
built from source.
|
9
|
+
|
10
|
+
== License
|
11
|
+
|
12
|
+
Copyright (c) 2011 David Kellum
|
13
|
+
|
14
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you
|
15
|
+
may not use this file except in compliance with the License. You
|
16
|
+
may obtain a copy of the License at:
|
17
|
+
|
18
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
|
20
|
+
Unless required by applicable law or agreed to in writing, software
|
21
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
22
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
23
|
+
implied. See the License for the specific language governing
|
24
|
+
permissions and limitations under the License.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- ruby -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'rjack-tarpit/spec'
|
4
|
+
|
5
|
+
RJack::TarPit.specify do |s|
|
6
|
+
require 'jproject/base'
|
7
|
+
|
8
|
+
s.version = JProject::VERSION
|
9
|
+
|
10
|
+
s.add_developer 'David Kellum', 'dek-oss@gravitext.com'
|
11
|
+
|
12
|
+
s.maven_strategy = :no_assembly
|
13
|
+
|
14
|
+
s.depend 'minitest', '~> 2.3', :dev
|
15
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
2
|
+
|
3
|
+
<modelVersion>4.0.0</modelVersion>
|
4
|
+
<groupId>rjack.tarpit</groupId>
|
5
|
+
<artifactId>jproject</artifactId>
|
6
|
+
<packaging>jar</packaging>
|
7
|
+
<version>1.0.0</version>
|
8
|
+
<name>Simple Java project</name>
|
9
|
+
|
10
|
+
<properties>
|
11
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
12
|
+
</properties>
|
13
|
+
|
14
|
+
<developers>
|
15
|
+
<developer>
|
16
|
+
<id>david</id>
|
17
|
+
<name>David Kellum</name>
|
18
|
+
<email>dek-oss@[org]</email>
|
19
|
+
<organization>Gravitext</organization>
|
20
|
+
<organizationUrl>http://gravitext.com</organizationUrl>
|
21
|
+
</developer>
|
22
|
+
</developers>
|
23
|
+
|
24
|
+
<licenses>
|
25
|
+
<license>
|
26
|
+
<name>Apache License, Version 2.0</name>
|
27
|
+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
28
|
+
<distribution>repo</distribution>
|
29
|
+
</license>
|
30
|
+
</licenses>
|
31
|
+
|
32
|
+
<dependencies>
|
33
|
+
|
34
|
+
<dependency>
|
35
|
+
<groupId>org.slf4j</groupId>
|
36
|
+
<artifactId>slf4j-api</artifactId>
|
37
|
+
<version>[1.6.1,1.6.9999]</version>
|
38
|
+
<scope>compile</scope>
|
39
|
+
</dependency>
|
40
|
+
|
41
|
+
</dependencies>
|
42
|
+
|
43
|
+
<build>
|
44
|
+
<plugins>
|
45
|
+
|
46
|
+
<plugin>
|
47
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
48
|
+
<version>2.3.2</version>
|
49
|
+
<configuration>
|
50
|
+
<source>1.6</source>
|
51
|
+
<target>1.6</target>
|
52
|
+
<optimize>true</optimize>
|
53
|
+
<debug>true</debug>
|
54
|
+
<encoding>UTF-8</encoding>
|
55
|
+
<showDeprecation>true</showDeprecation>
|
56
|
+
<showWarnings>true</showWarnings>
|
57
|
+
</configuration>
|
58
|
+
</plugin>
|
59
|
+
|
60
|
+
<plugin>
|
61
|
+
<artifactId>maven-source-plugin</artifactId>
|
62
|
+
<version>2.1.2</version>
|
63
|
+
<executions>
|
64
|
+
<execution>
|
65
|
+
<goals>
|
66
|
+
<goal>jar</goal>
|
67
|
+
</goals>
|
68
|
+
</execution>
|
69
|
+
</executions>
|
70
|
+
</plugin>
|
71
|
+
|
72
|
+
</plugins>
|
73
|
+
</build>
|
74
|
+
|
75
|
+
</project>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
#.hashdot.profile += jruby-shortlived
|
3
|
+
|
4
|
+
require File.join( File.dirname( __FILE__ ), "setup" )
|
5
|
+
|
6
|
+
require 'jproject'
|
7
|
+
|
8
|
+
class TestJProject < MiniTest::Unit::TestCase
|
9
|
+
|
10
|
+
def test
|
11
|
+
assert_equal( "Hello", JProject::Sample.hello )
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
data/test/setup.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
#. hashdot.profile += jruby-shortlived
|
3
|
+
#. jruby.launch.inproc = false
|
4
|
+
|
5
|
+
#--
|
6
|
+
# Copyright (c) 2009-2012 David Kellum
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
9
|
+
# may not use this file except in compliance with the License. You may
|
10
|
+
# obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
17
|
+
# implied. See the License for the specific language governing
|
18
|
+
# permissions and limitations under the License.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require File.join( File.dirname( __FILE__ ), "setup" )
|
22
|
+
|
23
|
+
require 'rjack-tarpit'
|
24
|
+
require 'fileutils'
|
25
|
+
|
26
|
+
class TestProjects < MiniTest::Unit::TestCase
|
27
|
+
include FileUtils
|
28
|
+
|
29
|
+
BASEDIR = File.dirname( __FILE__ )
|
30
|
+
|
31
|
+
if RUBY_PLATFORM =~ /java/
|
32
|
+
|
33
|
+
def setup
|
34
|
+
# We clean anyway, but for test consistency...
|
35
|
+
%w[ jproject zookeeper ].each do |p|
|
36
|
+
rm_rf( path( p, 'target' ) )
|
37
|
+
rm_rf( path( p, 'pkg' ) )
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_jproject
|
42
|
+
pt = path( 'jproject' )
|
43
|
+
assert runv( pt, "clean test gem" )
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_zookeeper
|
47
|
+
pt = path( 'zookeeper' )
|
48
|
+
assert runv( pt, "manifest" )
|
49
|
+
assert runv( pt, "clean test gem" )
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def path( *args )
|
55
|
+
File.join( BASEDIR, *args )
|
56
|
+
end
|
57
|
+
|
58
|
+
def runv( dir, targets )
|
59
|
+
# Shell cd is most reliabe, given java path duality and potential
|
60
|
+
# for jruby to attempt inproc otherwise.
|
61
|
+
c = "cd #{dir} && jruby -S rake #{targets}"
|
62
|
+
puts
|
63
|
+
puts "=== #{c} ==="
|
64
|
+
# Disable seemingly lame bundler ENV mods to make these tests work
|
65
|
+
# the same as if we ran it in our own shell.
|
66
|
+
r = Bundler.with_clean_env { system( c ) }
|
67
|
+
puts
|
68
|
+
r
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
#.hashdot.profile += jruby-shortlived
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2009-2012 David Kellum
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
7
|
+
# may not use this file except in compliance with the License. You
|
8
|
+
# may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
15
|
+
# implied. See the License for the specific language governing
|
16
|
+
# permissions and limitations under the License.
|
17
|
+
#++
|
18
|
+
|
19
|
+
require File.join( File.dirname( __FILE__ ), "setup" )
|
20
|
+
|
21
|
+
require 'rjack-tarpit/readme_parser'
|
22
|
+
|
23
|
+
require 'stringio'
|
24
|
+
|
25
|
+
class TestReadmeParser < MiniTest::Unit::TestCase
|
26
|
+
include RJack::TarPit::ReadmeParser
|
27
|
+
|
28
|
+
attr_accessor :summary
|
29
|
+
attr_accessor :description
|
30
|
+
attr_accessor :homepage
|
31
|
+
|
32
|
+
def test_one_liner
|
33
|
+
self.desc = <<TXT
|
34
|
+
A gem packaging of {Marble Bread}[http://special/marble-bread/]
|
35
|
+
TXT
|
36
|
+
parse_readme( nil )
|
37
|
+
|
38
|
+
assert_equal( "http://rjack.rubyforge.org/foo", homepage )
|
39
|
+
assert_equal( "A gem packaging of Marble Bread", summary )
|
40
|
+
assert_nil( description )
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_one_line_punct
|
44
|
+
self.desc = <<TXT
|
45
|
+
A gem packaging of Marbles[http://special/marbles/].
|
46
|
+
TXT
|
47
|
+
parse_readme( nil )
|
48
|
+
|
49
|
+
assert_equal( "A gem packaging of Marbles.", summary )
|
50
|
+
assert_nil( description )
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_two_sentences
|
54
|
+
self.desc = <<TXT
|
55
|
+
A gem packaging of Marbles!
|
56
|
+
Highly valued!
|
57
|
+
TXT
|
58
|
+
parse_readme( nil )
|
59
|
+
|
60
|
+
assert_equal( "A gem packaging of Marbles!", summary )
|
61
|
+
assert_equal( "A gem packaging of Marbles! Highly valued!", description )
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_colon
|
65
|
+
self.desc = <<TXT
|
66
|
+
A gem packaging of special sauces:
|
67
|
+
|
68
|
+
* Mustard
|
69
|
+
* Honey
|
70
|
+
TXT
|
71
|
+
parse_readme( nil )
|
72
|
+
|
73
|
+
assert_equal( "A gem packaging of special sauces.", summary )
|
74
|
+
assert_nil( description )
|
75
|
+
end
|
76
|
+
|
77
|
+
def readme_file_open( file )
|
78
|
+
yield StringIO.new( @test_readme_input )
|
79
|
+
end
|
80
|
+
|
81
|
+
def desc=( desc )
|
82
|
+
@test_readme_input = <<RDOC
|
83
|
+
= name
|
84
|
+
|
85
|
+
* http://rjack.rubyforge.org/foo
|
86
|
+
* http://rjack.rubyforge.org/other
|
87
|
+
|
88
|
+
== Description
|
89
|
+
|
90
|
+
#{desc}
|
91
|
+
|
92
|
+
== License
|
93
|
+
RDOC
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|