forked from ruby-prof/ruby-prof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
93 lines (82 loc) · 2.73 KB
/
Rakefile
File metadata and controls
93 lines (82 loc) · 2.73 KB
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
require 'rubygems'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/testtask'
require 'date'
# to release a version of ruby-prof, do a git tag, then rake cleanr default and publish that
# git tag 0.10.1
# git push origin 0.10.1
# rake cleanr default
# gem push pkg/ruby-prof-0.10.1.gem
default_spec = eval File.read(File.expand_path('../ruby-prof.gemspec', __FILE__))
desc 'deprecated--build native .gem files -- use like "native_gems clobber cross native gem"--for non native gem creation use "native_gems clobber" then "clean gem"'
task :native_gems do
# we don't do cross compiler anymore, now that mingw has devkit
ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
require 'rake/extensiontask'
Rake::ExtensionTask.new('ruby_prof', default_spec) do |ext|
ext.cross_compile = true
ext.cross_platform = ['x86-mswin32-60', 'x86-mingw32-60']
end
end
# Rake task to build the default package
Rake::GemPackageTask.new(default_spec) do |pkg|
pkg.need_tar = true
#pkg.need_zip = true
end
# --------- RDoc Documentation ------
desc "Generate rdoc documentation"
Rake::RDocTask.new("rdoc") do |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = "ruby-prof"
# Show source inline with line numbers
rdoc.options << "--inline-source" << "--line-numbers"
# Make the readme file the start page for the generated html
rdoc.options << '--main' << 'README.rdoc'
rdoc.rdoc_files.include('bin/**/*',
'doc/*.rdoc',
'examples/flat.txt',
'examples/graph.txt',
'examples/graph.html',
'lib/**/*.rb',
'ext/ruby_prof/ruby_prof.c',
'ext/ruby_prof/version.h',
'ext/ruby_prof/measure_*.h',
'README.rdoc',
'LICENSE')
end
task :default => :package
desc 'Run the ruby-prof test suite'
Rake::TestTask.new do |t|
t.libs += %w(lib ext test)
t.test_files = Dir['test/test_suite.rb']
t.verbose = true
t.warning = true
end
require 'fileutils'
desc 'Build ruby_prof.so'
task :build do
Dir.chdir('ext/ruby_prof') do
unless File.exist? 'Makefile'
system(Gem.ruby + " extconf.rb")
system("make clean")
end
raise 'make failed' unless system("make")
FileUtils.cp 'ruby_prof.so', '../../lib' if File.exist? 'lib/ruby_prof.so'
FileUtils.cp 'ruby_prof.bundle', '../../lib' if File.exist? 'lib/ruby_prof.bundle'
end
end
desc 'clean stuff'
task :cleanr do
Dir['**/*.{so,bundle}'].each{|f| File.delete f}
Dir.chdir('ext/ruby_prof') do
if File.exist? 'Makefile'
system("make clean")
FileUtils.rm 'Makefile'
end
Dir.glob('*~') do |file|
FileUtils.rm file
end
end
system("rm -rf pkg")
end