/
Rakefile
104 lines (89 loc) · 2.75 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# -*- ruby -*-
#--
# Copyright (C) 2008 David Kellum
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#++
require 'rubygems'
require 'hoe'
$LOAD_PATH << './lib'
ENV['NODOT'] = "no thank you"
# Instead of 'slf4j' to avoid loading slf4j-api in Rake parent loader
require 'slf4j/base'
SLF4J = SLF4JBase
loaders = SLF4J::ADAPTERS.flatten.compact
loader_files = loaders.map { |adp| "lib/slf4j/#{adp}.rb" }
jars = [ 'slf4j-api' ]
jars += SLF4J::ADAPTERS.map { |i,o| [ i, "slf4j-#{o}" ] }.flatten.compact
jars.map! { |n| "#{n}-#{SLF4J::SLF4J_VERSION}.jar" }
jar_files = jars.map { |jar| "lib/slf4j/#{jar}" }
desc "Update the Manifest with actual jars/loaders"
task :manifest do
out = File.new( 'Manifest.txt', 'w' )
begin
out.write <<END
Manifest.txt
README.txt
History.txt
Rakefile
pom.xml
assembly.xml
lib/slf4j.rb
lib/slf4j/base.rb
test/test_slf4j.rb
END
out.puts loader_files
out.puts jar_files
ensure
out.close
end
end
loaders.each do |adapter|
file "lib/slf4j/#{adapter}.rb" do
out = File.new( "lib/slf4j/#{adapter}.rb", 'w' )
begin
out.puts "SLF4J.require_adapter( '#{adapter}' )"
ensure
out.close
end
end
end
ASSEMBLY = "target/slf4j-assembly-1.0-bin.dir"
file ASSEMBLY => [ 'pom.xml', 'assembly.xml' ] do
sh( 'mvn package' )
end
jars.each do |jar|
file "lib/slf4j/#{jar}" => [ ASSEMBLY ] do
cp_r( File.join( ASSEMBLY, jar ), 'lib/slf4j' )
end
end
[ :gem, :test ].each { |t| task t => ( jar_files + loader_files ) }
task :mvn_clean do
rm_f( jar_files )
rm_f( loader_files )
sh( 'mvn clean' )
end
task :clean => :mvn_clean
hoe = Hoe.new( "slf4j", SLF4J::VERSION ) do |p|
p.developer( "David Kellum", "dek-ruby@gravitext.com" )
p.rubyforge_name = "rjack"
p.rdoc_pattern = /^(lib.*\.(rb|txt))|[^\/]*\.txt$/
end