forked from texel/runt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
131 lines (111 loc) · 3.31 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Rakefile for runt -*- ruby -*-
begin
require 'rubygems'
require 'rake/gempackagetask'
require 'hoe'
require './lib/runt.rb'
rescue Exception
nil
end
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/contrib/sshpublisher'
require 'rake/contrib/rubyforgepublisher'
require 'fileutils'
#####################################################################
# Constants
#####################################################################
# Build Settings
PKG_VERSION = "0.7.1"
# Files to be included in Runt distribution
PKG_FILES = FileList[
'setup.rb',
'[A-Z]*',
'lib/**/*.rb',
'test/**/*.rb',
'examples/**/*.rb',
'doc/**/*',
'site/**/*'
].exclude("*.ses")
if(RUBY_PLATFORM =~ /win32/i)
PKG_EXEC_TAR = false
else
PKG_EXEC_TAR = true
end
# build directory
TARGET_DIR = "target"
# Trying to auto-build with Hoe.
Hoe.new('runt', PKG_VERSION) do |p|
p.rubyforge_name = 'Runt' # if different than lowercase project name
p.developer('Matthew Lipper', '[email protected]')
end
#####################################################################
# Targets
#####################################################################
task :default => [:test]
task :clobber => [:clobber_build_dir]
# Make the build directory
directory TARGET_DIR
# Calling this task directly doesn't work?
desc "Clobber the entire build directory."
task :clobber_build_dir do |t|
CLOBBER.include(TARGET_DIR)
end
Rake::RDocTask.new do |rd|
rd.rdoc_dir="#{TARGET_DIR}/doc"
rd.options << "-S"
rd.rdoc_files.include('lib/*','doc/*.rdoc','README','CHANGES','TODO','LICENSE.txt')
end
Rake::TestTask.new do |t|
t.libs << "test" << "examples"
t.pattern = '**/*test.rb'
t.verbose = false
t.warning = false
end
desc "Copy html files for the Runt website to the build directory."
file "copy_site" => TARGET_DIR
file "copy_site" do
cp_r Dir["site/*.{html,gif,png,css}"], TARGET_DIR
end
desc "Publish the Documentation to RubyForge."
task :publish => [:rdoc,:copy_site,:clobber_package] do |t|
publisher = Rake::CompositePublisher.new
publisher.add Rake::SshDirPublisher.new("[email protected]", "/var/www/gforge-projects/runt",TARGET_DIR)
publisher.upload
end
desc "Publish the Documentation to the build dir."
task :test_publish => [:rdoc,:copy_site,:clobber_package] do |t|
puts "YAY! We've tested publish! YAY!"
end
if ! defined?(Gem)
puts "Package Target requires RubyGEMs"
else
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "Ruby Temporal Expressions."
s.name = 'runt'
s.version = PKG_VERSION
s.requirements << 'none'
s.require_path = 'lib'
s.files = PKG_FILES.to_a
s.author = 'Matthew Lipper'
s.email = '[email protected]'
s.homepage = 'http://runt.rubyforge.org'
s.has_rdoc = true
s.rdoc_options += %w{--main README --title Runt}
s.extra_rdoc_files = FileList["README","CHANGES","TODO","LICENSE.txt","doc/*.rdoc"]
s.test_files = Dir['**/*test.rb']
s.rubyforge_project = 'runt'
s.description = <<EOF
Runt is a Ruby version of temporal patterns by
Martin Fowler. Runt provides an API for scheduling
recurring events using set-like semantics.
EOF
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = PKG_EXEC_TAR
end
end