forked from rubygame/rubygame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
176 lines (122 loc) · 3.38 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# This is the Rakefile for Rubygame. It's used for packaging,
# installing, generating the documentation, and running specs.
#
# The version number for Rubygame.
# If you update this, also update lib/rubygame/main.rb.
RUBYGAME_VERSION = [2,6,4]
require 'rubygems'
require 'rake'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require "rbconfig"
include Config
#######
# GEM #
#######
gem_spec = Gem::Specification.new do |s|
s.name = "rubygame"
s.version = RUBYGAME_VERSION.join(".")
s.author = "John Croisant"
s.email = "[email protected]"
s.homepage = "http://rubygame.org/"
s.summary = "Clean and powerful library for game programming"
s.rubyforge_project = "rubygame"
s.files = FileList.new do |fl|
fl.include("{lib,samples,doc}/**/*")
end
s.require_paths = ["lib"]
s.has_rdoc = true
s.extra_rdoc_files = FileList.new do |fl|
fl.include "doc/*.rdoc"
fl.include "README", "LICENSE", "CREDITS", "ROADMAP", "NEWS"
end
s.required_ruby_version = ">= 1.8"
s.add_dependency( "rake", ">=0.7.0" )
s.add_dependency( "ruby-sdl-ffi", ">=0.1.0" )
s.requirements = ["SDL >= 1.2.7",
"SDL_gfx >= 2.0.10 (optional)",
"SDL_image >= 1.2.3 (optional)",
"SDL_mixer >= 1.2.7 (optional)",
"SDL_ttf >= 2.0.6 (optional)"]
end
Rake::GemPackageTask.new(gem_spec) do |pkg|
pkg.need_tar_bz2 = true
end
########
# RDOC #
########
Rake::RDocTask.new do |rd|
rd.main = "README"
rd.title = "Rubygame #{RUBYGAME_VERSION.join(".")} Docs"
rd.rdoc_files.include("lib/rubygame/**/*.rb",
"doc/*.rdoc",
"README",
"LICENSE",
"CREDITS",
"ROADMAP",
"NEWS")
end
#########
# CLEAN #
#########
require 'rake/clean'
task(:clean) { puts "Cleaning out temporary generated files" }
task(:clobber) { puts "Cleaning out final generated files" }
###########
# INSTALL #
###########
task :install do |task|
sitelibdir = (ENV["RUBYLIBDIR"] or CONFIG["sitelibdir"])
puts "Installing to #{sitelibdir}"
files = FileList.new do |fl|
fl.include("lib/**/*.rb")
end
files.each do |f|
dir = File.join(sitelibdir, File.dirname(f).sub('lib',''), "")
mkdir_p dir
cp f, dir
end
end
#########
# SPECS #
#########
begin
require 'spec/rake/spectask'
desc "Run all specs"
Spec::Rake::SpecTask.new do |t|
t.spec_files = FileList['spec/*_spec.rb']
end
namespace :spec do
desc "Run all specs"
Spec::Rake::SpecTask.new(:all) do |t|
t.spec_files = FileList['spec/*_spec.rb']
end
desc "Run spec/[name]_spec.rb (e.g. 'color')"
task :name do
puts( "This is just a stand-in spec.",
"Run rake spec:[name] where [name] is e.g. 'color', 'music'." )
end
end
rule(/spec:.+/) do |t|
name = t.name.gsub("spec:","")
path = File.join( File.dirname(__FILE__),'spec','%s_spec.rb'%name )
if File.exist? path
Spec::Rake::SpecTask.new(name) do |t|
t.spec_files = [path]
end
puts "\nRunning spec/%s_spec.rb"%name
Rake::Task[name].invoke
else
puts "File does not exist: %s"%path
end
end
rescue LoadError
error = "ERROR: RSpec is not installed?"
task :spec do
puts error
end
rule( /spec:.*/ ) do
puts error
end
end