-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
executable file
·92 lines (84 loc) · 2.88 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
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/gempackagetask'
require 'rake/packagetask'
require 'rubygems'
if Gem.required_location("hanna", "hanna/rdoctask.rb")
puts "using Hanna RDoc template"
require 'hanna/rdoctask'
else
puts "using standard RDoc template"
require 'rake/rdoctask'
end
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "Simple Declarative Language for Ruby library"
s.name = 'sdl4r'
s.version = '0.9.7'
s.requirements << 'none'
s.require_path = 'lib'
s.authors = ['Philippe Vosges', 'Daniel Leuck']
s.email = '[email protected]'
s.rubyforge_project = 'sdl4r'
s.homepage = 'http://www.ikayzo.org/confluence/display/SDL/Home'
s.files = FileList['lib/sdl4r.rb', 'lib/sdl4r/**/*.rb', 'bin/*', '[A-Z]*', 'test/**/*', 'doc/**/*'].to_a
s.test_files = FileList[ 'test/**/*test.rb' ].to_a
s.description = <<EOF
The Simple Declarative Language provides an easy way to describe lists, maps,
and trees of typed data in a compact, easy to read representation.
For property files, configuration files, logs, and simple serialization
requirements, SDL provides a compelling alternative to XML and Properties
files.
EOF
end
Rake::PackageTask.new(spec.name, spec.version) do |p|
p.need_zip = true
p.need_tar = false
p.need_tar_gz = false
p.need_tar_bz2 = false
#p.package_files.include("lib/sdl4r/**/*.rb")
# If "zip" is not available, we try 7-zip.
system("zip")
p.zip_command = "7z a -tzip" if $?.exitstatus == 127
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
Rake::RDocTask.new do |rd|
files = ['README', 'LICENSE', 'CHANGELOG', 'lib/**/*.rb', 'doc/**/*.rdoc', 'test/**/*.rb']
rd.main = 'README'
rd.rdoc_files.include(files)
rd.rdoc_files.exclude("lib/scratchpad.rb")
rd.rdoc_dir = "doc"
rd.title = "RDoc: Simple Declarative Language for Ruby"
rd.options << '--charset' << 'utf-8'
rd.options << '--line-numbers'
rd.options << '--inline-source'
end
gen_rubyforge = task :gen_rubyforge => [:rdoc] do
# Modify the front page of the Rubyforge front page
File.open("doc/files/CHANGELOG.html", "r:UTF-8") do |f|
changelog = f.read
if changelog =~ /(<div id='content'>.*?)<div id='footer-push'>/im
changelog = $1
new_front_page = File.open("rubyforge/index.html", "r:UTF-8") do |f2|
f2.read.gsub(
/<!-- CHANGELOG_START -->.*?<!-- CHANGELOG_END -->/m,
"<!-- CHANGELOG_START -->\n" + changelog + "\n<!-- CHANGELOG_END -->")
end
File.open("rubyforge/index.html", "w:UTF-8") do |f2|
f2.write new_front_page
end
else
puts "couldn't extract info from changelog"
end
end
end
gen_rubyforge.comment = "Includes the CHANGELOG into the Rubyforge front page"
Rake::TestTask.new do |t|
t.libs << "lib"
t.test_files = FileList['test/**/*test.rb']
t.verbose = true
end