Skip to content
Newer
Older
100644 262 lines (222 sloc) 7.12 KB
0768eb0 @mark-moseley SVN RubyForge pull
mark-moseley authored
1 #!/usr/bin/env rake
2 # -*- Ruby -*-
3 require 'rubygems'
4 require 'rake/gempackagetask'
5 require 'rake/rdoctask'
6 require 'rake/testtask'
2a78639 @mark-moseley rake-compiler updates
mark-moseley authored
7 require 'rake/extensiontask'
8
9 Rake::ExtensionTask.new('ruby_debug')
0768eb0 @mark-moseley SVN RubyForge pull
mark-moseley authored
10
11 SO_NAME = "ruby_debug.so"
12
13 # ------- Default Package ----------
14 RUBY_DEBUG_VERSION = open("ext/ruby_debug.c") do |f|
15 f.grep(/^#define DEBUG_VERSION/).first[/"(.+)"/,1]
16 end
17
18 COMMON_FILES = FileList[
19 'AUTHORS',
20 'CHANGES',
21 'LICENSE',
22 'README',
23 'Rakefile',
24 ]
25
26 CLI_TEST_FILE_LIST = FileList['test/cli/commands/unit/*.rb',
27 'test/cli/commands/*_test.rb',
28 'test/cli/**/*_test.rb',
29 'test/test-*.rb']
30 CLI_FILES = COMMON_FILES + FileList[
31 "cli/**/*",
32 'ChangeLog',
33 'bin/*',
34 'doc/rdebug.1',
35 'test/**/data/*.cmd',
36 'test/**/data/*.right',
37 'test/**/*.rb',
38 'rdbg.rb',
39 CLI_TEST_FILE_LIST
40 ]
41
42 BASE_TEST_FILE_LIST = %w(
43 test/base/base.rb
44 test/base/binding.rb
45 test/base/catchpoint.rb)
46 BASE_FILES = COMMON_FILES + FileList[
47 'ext/breakpoint.c',
48 'ext/extconf.rb',
49 'ext/ruby_debug.c',
50 'ext/ruby_debug.h',
51 'ext/win32/*',
52 'lib/**/*',
53 BASE_TEST_FILE_LIST,
54 ]
55
56 desc "Test everything."
57 task :test => :test_base do
58 Rake::TestTask.new(:test) do |t|
4af2c90 @mark-moseley test fixes
mark-moseley authored
59 t.libs << './ext'
60 t.libs << './lib'
61 t.libs << './cli'
0768eb0 @mark-moseley SVN RubyForge pull
mark-moseley authored
62 t.test_files = CLI_TEST_FILE_LIST
63 t.verbose = true
64 end
65 end
66
67 desc "Test ruby-debug-base."
68 task :test_base => :lib do
69 Rake::TestTask.new(:test_base) do |t|
4af2c90 @mark-moseley test fixes
mark-moseley authored
70 t.libs << './ext'
71 t.libs << './lib'
0768eb0 @mark-moseley SVN RubyForge pull
mark-moseley authored
72 t.test_files = FileList[BASE_TEST_FILE_LIST]
73 t.verbose = true
74 end
75 end
76
77 desc "Test everything - same as test."
78 task :check => :test
79
80 desc "Create the core ruby-debug shared library extension"
81 task :lib do
82 Dir.chdir("ext") do
83 system("#{Gem.ruby} extconf.rb && make")
84 end
85 end
86
87 desc "Compile Emacs code"
88 task :emacs => "emacs/rdebug.elc"
89 file "emacs/rdebug.elc" => ["emacs/elisp-comp", "emacs/rdebug.el"] do
90 Dir.chdir("emacs") do
91 system("./elisp-comp ./rdebug.el")
92 end
93 end
94
95 desc "Create a GNU-style ChangeLog via svn2cl"
96 task :ChangeLog do
97 system("svn2cl --authors=svn2cl_usermap svn://rubyforge.org/var/svn/ruby-debug/trunk")
98 system("svn2cl --authors=svn2cl_usermap svn://rubyforge.org/var/svn/ruby-debug/trunk/ext -o ext/ChangeLog")
99 system("svn2cl --authors=svn2cl_usermap svn://rubyforge.org/var/svn/ruby-debug/trunk/lib -o lib/ChangeLog")
100 end
101
102 # Base GEM Specification
103 base_spec = Gem::Specification.new do |spec|
104 spec.name = "ruby-debug-base"
105
106 spec.homepage = "http://rubyforge.org/projects/ruby-debug/"
107 spec.summary = "Fast Ruby debugger - core component"
108 spec.description = <<-EOF
109 ruby-debug is a fast implementation of the standard Ruby debugger debug.rb.
110 It is implemented by utilizing a new Ruby C API hook. The core component
111 provides support that front-ends can build on. It provides breakpoint
112 handling, bindings for stack frames among other things.
113 EOF
114
115 spec.version = RUBY_DEBUG_VERSION
116
117 spec.author = "Kent Sibilev"
118 spec.email = "ksibilev@yahoo.com"
119 spec.platform = Gem::Platform::RUBY
120 spec.require_path = "lib"
121 spec.extensions = ["ext/extconf.rb"]
122 spec.files = BASE_FILES.to_a
123
124 spec.required_ruby_version = '>= 1.8.2'
125 spec.date = Time.now
126 spec.rubyforge_project = 'ruby-debug'
127 spec.add_dependency('linecache', '>= 0.3')
128
129 spec.test_files = FileList[BASE_TEST_FILE_LIST]
130
131 # rdoc
132 spec.has_rdoc = true
133 spec.extra_rdoc_files = ['README', 'ext/ruby_debug.c']
134 end
135
136 cli_spec = Gem::Specification.new do |spec|
137 spec.name = "ruby-debug"
138
139 spec.homepage = "http://rubyforge.org/projects/ruby-debug/"
140 spec.summary = "Command line interface (CLI) for ruby-debug-base"
141 spec.description = <<-EOF
142 A generic command line interface for ruby-debug.
143 EOF
144
145 spec.version = RUBY_DEBUG_VERSION
146
147 spec.author = "Kent Sibilev"
148 spec.email = "ksibilev@yahoo.com"
149 spec.platform = Gem::Platform::RUBY
150 spec.require_path = "cli"
151 spec.bindir = "bin"
152 spec.executables = ["rdebug"]
153 spec.files = CLI_FILES.to_a
154
155 spec.required_ruby_version = '>= 1.8.2'
156 spec.date = Time.now
157 spec.rubyforge_project = 'ruby-debug'
158 spec.add_dependency('columnize', '>= 0.1')
159 spec.add_dependency('ruby-debug-base', "~> #{RUBY_DEBUG_VERSION}.0")
160
161 # FIXME: work out operational logistics for this
162 # spec.test_files = FileList[CLI_TEST_FILE_LIST]
163
164 # rdoc
165 spec.has_rdoc = true
166 spec.extra_rdoc_files = ['README']
167 end
168
169 # Rake task to build the default package
170 Rake::GemPackageTask.new(base_spec) do |pkg|
171 pkg.need_tar = true
172 end
173 Rake::GemPackageTask.new(cli_spec) do |pkg|
174 pkg.need_tar = true
175 end
176
177 task :default => [:package]
178
179 # Windows specification
180 win_spec = base_spec.clone
181 win_spec.extensions = []
182 ## win_spec.platform = Gem::Platform::WIN32 # deprecated
183 win_spec.platform = 'mswin32'
184 win_spec.files += ["lib/#{SO_NAME}"]
185
186 desc "Create Windows Gem"
187 task :win32_gem do
188 # Copy the win32 extension the top level directory
189 current_dir = File.expand_path(File.dirname(__FILE__))
190 source = File.join(current_dir, "ext", "win32", SO_NAME)
191 target = File.join(current_dir, "lib", SO_NAME)
192 cp(source, target)
193
194 # Create the gem, then move it to pkg.
195 Gem::Builder.new(win_spec).build
196 gem_file = "#{win_spec.name}-#{win_spec.version}-#{win_spec.platform}.gem"
197 mv(gem_file, "pkg/#{gem_file}")
198
199 # Remove win extension from top level directory.
200 rm(target)
201 end
202
203 desc "Publish ruby-debug to RubyForge."
204 task :publish do
205 require 'rake/contrib/sshpublisher'
206
207 # Get ruby-debug path.
208 ruby_debug_path = File.expand_path(File.dirname(__FILE__))
209
210 Rake::SshDirPublisher.new("kent@rubyforge.org",
211 "/var/www/gforge-projects/ruby-debug", ruby_debug_path)
212 end
213
214 desc "Remove built files"
215 task :clean do
216 cd "ext" do
217 if File.exists?("Makefile")
218 sh "make clean"
219 rm "Makefile"
220 end
221 derived_files = Dir.glob(".o") + Dir.glob("*.so")
222 rm derived_files unless derived_files.empty?
223 end
224 end
225
226 # --------- RDoc Documentation ------
227 desc "Generate rdoc documentation"
228 Rake::RDocTask.new("rdoc") do |rdoc|
229 rdoc.rdoc_dir = 'doc/rdoc'
230 rdoc.title = "ruby-debug"
231 # Show source inline with line numbers
232 rdoc.options << "--inline-source" << "--line-numbers"
233 # Make the readme file the start page for the generated html
234 rdoc.options << '--main' << 'README'
235 rdoc.rdoc_files.include('bin/**/*',
236 'cli/ruby-debug/commands/*.rb',
237 'lib/**/*.rb',
238 'ext/**/ruby_debug.c',
239 'README',
240 'LICENSE')
241 end
242
243 desc "Publish the release files to RubyForge."
244 task :rubyforge_upload do
245 `rubyforge login`
246 release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} '#{PKG_NAME}-#{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.gem"
247 puts release_command
248 system(release_command)
249 end
250
251 PKG_NAME = 'ruby-debug'
252 desc "Publish the release files to RubyForge."
253 task :rubyforge_upload do
254 `rubyforge login`
255 for pkg_name in ['ruby-debug', 'ruby-debug-base'] do
256 pkg_file_name = "#{pkg_name}-#{pkg_version}"
257 release_command = "rubyforge add_release ruby-debug #{pkg_name} '#{pkg_file_name}' pkg/#{pkg_file_name}.gem"
258 puts release_command
259 system(release_command)
260 end
261 end
Something went wrong with that request. Please try again.