|
1 | 1 | #!/usr/bin/env rake |
2 | 2 | # -*- Ruby -*- |
3 | 3 | require 'rubygems' |
4 | | -require 'rake/gempackagetask' |
| 4 | + |
| 5 | +require 'bundler/gem_tasks' |
5 | 6 | require 'rake/rdoctask' |
6 | 7 | require 'rake/testtask' |
7 | | -#require 'rake/extensiontask' |
8 | | - |
9 | | -#Rake::ExtensionTask.new('ruby_debug') |
10 | | - |
11 | | -SO_NAME = "ruby_debug.so" |
12 | | - |
13 | | -# ------- Default Package ---------- |
14 | | -RUBY_DEBUG_VERSION = open("ext/ruby_debug/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 | 8 |
|
26 | 9 | BASE_TEST_FILE_LIST = %w( |
27 | 10 | test/base/base.rb |
28 | 11 | test/base/binding.rb |
29 | 12 | test/base/catchpoint.rb) |
30 | | -BASE_FILES = COMMON_FILES + FileList[ |
31 | | - 'ext/ruby_debug/breakpoint.c', |
32 | | - 'ext/ruby_debug/extconf.rb', |
33 | | - 'ext/ruby_debug/ruby_debug.c', |
34 | | - 'ext/ruby_debug/ruby_debug.h', |
35 | | - 'ext/win32/*', |
36 | | - 'lib/**/*', |
37 | | - BASE_TEST_FILE_LIST, |
38 | | -] |
39 | | - |
40 | | -# Base GEM Specification |
41 | | -base_spec = Gem::Specification.new do |spec| |
42 | | - spec.name = "ruby-debug-base19x" |
43 | | - |
44 | | - spec.homepage = "http://rubyforge.org/projects/ruby-debug/" |
45 | | - spec.summary = "Fast Ruby debugger - core component" |
46 | | - spec.description = <<-EOF |
47 | | -ruby-debug is a fast implementation of the standard Ruby debugger debug.rb. |
48 | | -It is implemented by utilizing a new Ruby C API hook. The core component |
49 | | -provides support that front-ends can build on. It provides breakpoint |
50 | | -handling, bindings for stack frames among other things. |
51 | | -EOF |
52 | | - |
53 | | - spec.version = RUBY_DEBUG_VERSION |
54 | | - |
55 | | - spec.author = "Kent Sibilev, Mark Moseley" |
56 | | - spec.email = "ksibilev@yahoo.com" |
57 | | - spec.platform = Gem::Platform::RUBY |
58 | | - spec.require_path = "lib" |
59 | | - spec.extensions = ["ext/ruby_debug/extconf.rb"] |
60 | | - spec.files = BASE_FILES.to_a |
61 | | - |
62 | | - spec.required_ruby_version = '>= 1.8.2' |
63 | | - spec.date = Time.now |
64 | | - spec.rubyforge_project = 'ruby-debug19' |
65 | | - spec.add_dependency('columnize', [">= 0.3.1"]) |
66 | | - spec.add_dependency('ruby_core_source', [">= 0.1.4"]) |
67 | | - spec.add_dependency('linecache19', [">= 0.5.11"]) |
68 | | - |
69 | | - spec.test_files = FileList[BASE_TEST_FILE_LIST] |
70 | | - |
71 | | - # rdoc |
72 | | - spec.has_rdoc = true |
73 | | - spec.extra_rdoc_files = ['README', 'ext/ruby_debug/ruby_debug.c'] |
74 | | -end |
75 | 13 |
|
| 14 | +task :default => [:test_base] |
76 | 15 |
|
77 | | -# Rake task to build the default package |
78 | | -Rake::GemPackageTask.new(base_spec) do |pkg| |
79 | | - pkg.need_tar = true |
80 | | -end |
81 | | - |
82 | | -task :default => [:package] |
83 | | - |
84 | | -# Windows specification |
85 | | -win_spec = base_spec.clone |
86 | | -win_spec.extensions = [] |
87 | | -## win_spec.platform = Gem::Platform::WIN32 # deprecated |
88 | | -win_spec.platform = 'mswin32' |
89 | | -win_spec.files += ["lib/#{SO_NAME}"] |
90 | | - |
91 | | -desc "Create Windows Gem" |
92 | | -task :win32_gem do |
93 | | - # Copy the win32 extension the top level directory |
94 | | - current_dir = File.expand_path(File.dirname(__FILE__)) |
95 | | - source = File.join(current_dir, "ext", "win32", SO_NAME) |
96 | | - target = File.join(current_dir, "lib", SO_NAME) |
97 | | - cp(source, target) |
98 | | - |
99 | | - # Create the gem, then move it to pkg. |
100 | | - Gem::Builder.new(win_spec).build |
101 | | - gem_file = "#{win_spec.name}-#{win_spec.version}-#{win_spec.platform}.gem" |
102 | | - mv(gem_file, "pkg/#{gem_file}") |
103 | | - |
104 | | - # Remove win extension from top level directory. |
105 | | - rm(target) |
106 | | -end |
107 | | - |
108 | | -desc "Publish ruby-debug to RubyForge." |
109 | | -task :publish do |
110 | | - require 'rake/contrib/sshpublisher' |
111 | | - |
112 | | - # Get ruby-debug path. |
113 | | - ruby_debug_path = File.expand_path(File.dirname(__FILE__)) |
114 | | - |
115 | | - Rake::SshDirPublisher.new("kent@rubyforge.org", |
116 | | - "/var/www/gforge-projects/ruby-debug", ruby_debug_path) |
117 | | -end |
118 | | - |
119 | | -desc "Remove built files" |
120 | | -task :clean do |
121 | | - cd "ext" do |
122 | | - if File.exists?("Makefile") |
123 | | - sh "make clean" |
124 | | - rm "Makefile" |
125 | | - end |
126 | | - derived_files = Dir.glob(".o") + Dir.glob("*.so") |
127 | | - rm derived_files unless derived_files.empty? |
| 16 | +desc "Create the core ruby-debug shared library extension" |
| 17 | +task :lib do |
| 18 | + Dir.chdir("ext/ruby_debug") do |
| 19 | + system("#{Gem.ruby} extconf.rb && make") |
128 | 20 | end |
129 | 21 | end |
130 | 22 |
|
131 | 23 | desc "Test ruby-debug-base." |
132 | 24 | task :test_base => :lib do |
133 | 25 | Rake::TestTask.new(:test_base) do |t| |
134 | | - t.libs += ['./ext', './lib'] |
| 26 | + t.libs += ['./ext/ruby_debug', './lib'] |
135 | 27 | t.test_files = FileList[BASE_TEST_FILE_LIST] |
136 | 28 | t.verbose = true |
137 | 29 | end |
|
0 commit comments