-
Notifications
You must be signed in to change notification settings - Fork 37
/
Rakefile
64 lines (56 loc) · 1.66 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
require "bundler/gem_tasks"
require "rake/testtask"
require "rdoc/task"
task :default => [:compile, :test]
namespace :version do
desc "Bump version"
task :bump do
strscan_c_path = "ext/strscan/strscan.c"
strscan_c = File.read(strscan_c_path).gsub(/STRSCAN_VERSION "(.+?)"/) do
version = $1
"STRSCAN_VERSION \"#{version.succ}\""
end
File.write(strscan_c_path, strscan_c)
strscan_java_path = "ext/jruby/org/jruby/ext/strscan/RubyStringScanner.java"
strscan_java = File.read(strscan_java_path).gsub(/STRSCAN_VERSION = "(.+?)"/) do
version = $1
"STRSCAN_VERSION = \"#{version.succ}\""
end
File.write(strscan_java_path, strscan_java)
end
end
if RUBY_ENGINE == "jruby"
require 'rake/javaextensiontask'
Rake::JavaExtensionTask.new("strscan") do |ext|
require 'maven/ruby/maven'
ext.source_version = '1.8'
ext.target_version = '1.8'
ext.ext_dir = 'ext/jruby'
end
elsif RUBY_ENGINE == "ruby"
require 'rake/extensiontask'
Rake::ExtensionTask.new("strscan")
else
task :compile
end
desc "Run test"
task :test do
extra_require_path = RUBY_ENGINE == 'jruby' ? "ext/jruby/lib" : "lib"
ENV["RUBYOPT"] = "-I#{extra_require_path} -rbundler/setup"
ruby("run-test.rb")
end
desc "Run benchmark"
task :benchmark do
ruby("-S",
"benchmark-driver",
"benchmark/scan.yaml")
end
RDoc::Task.new
release_task = Rake.application["release"]
release_task.prerequisites.delete("build")
release_task.prerequisites.delete("release:rubygem_push")
release_task_comment = release_task.comment
if release_task_comment
release_task.clear_comments
release_task.comment = release_task_comment.gsub(/ and build.*$/, "")
end