зеркало из https://github.com/github/bert.git
Use rake-compiler
Don't reinvent this particular wheel. There's still a mention or two of `.bundle` which is what we have on OS X. So some of the cleaning up just did not work on anything else.
This commit is contained in:
Родитель
43d07dcdae
Коммит
cb40a8bfb8
|
@ -8,6 +8,8 @@ GEM
|
|||
specs:
|
||||
git (1.3.0)
|
||||
rake (11.1.2)
|
||||
rake-compiler (0.9.9)
|
||||
rake
|
||||
thoughtbot-shoulda (2.11.1)
|
||||
|
||||
PLATFORMS
|
||||
|
@ -17,6 +19,7 @@ DEPENDENCIES
|
|||
bert!
|
||||
git
|
||||
rake
|
||||
rake-compiler (~> 0.9.0)
|
||||
thoughtbot-shoulda
|
||||
|
||||
BUNDLED WITH
|
||||
|
|
43
Rakefile
43
Rakefile
|
@ -1,6 +1,16 @@
|
|||
require 'rubygems'
|
||||
require 'rake'
|
||||
|
||||
require 'rake/extensiontask'
|
||||
|
||||
gemspec = Gem::Specification::load(File.expand_path('../bert.gemspec', __FILE__))
|
||||
|
||||
Rake::ExtensionTask.new(gemspec) do |ext|
|
||||
ext.name = 'decode'
|
||||
ext.ext_dir = 'ext/bert/c'
|
||||
ext.lib_dir = 'ext/bert/c'
|
||||
end
|
||||
|
||||
require 'rake/testtask'
|
||||
Rake::TestTask.new(:runtests) do |test|
|
||||
test.libs << 'lib' << 'test'
|
||||
|
@ -8,34 +18,13 @@ Rake::TestTask.new(:runtests) do |test|
|
|||
test.verbose = true
|
||||
end
|
||||
|
||||
task :make do
|
||||
Dir.chdir('ext/bert/c') { `ruby extconf.rb`; `make` }
|
||||
end
|
||||
task :default => [:compile, :test]
|
||||
|
||||
task :clean do
|
||||
['rm -f ext/bert/c/*.bundle', 'rm -f ext/bert/c/*.o'].each do |cmd|
|
||||
`#{cmd}` && puts(cmd)
|
||||
end
|
||||
end
|
||||
|
||||
task :test do
|
||||
require 'fileutils'
|
||||
|
||||
puts "\nCleaning extension build files and running all specs in native ruby mode..."
|
||||
['rm -f ext/bert/c/*.bundle', 'rm -f ext/bert/c/*.o'].each do |cmd|
|
||||
`#{cmd}` && puts(cmd)
|
||||
end
|
||||
pid = fork do
|
||||
exec 'rake runtests'
|
||||
end
|
||||
Process.waitpid(pid)
|
||||
|
||||
puts "\nRunning `make` to build extensions and rerunning decoder specs..."
|
||||
Dir.chdir('ext/bert/c') { `ruby extconf.rb`; `make` }
|
||||
pid = fork do
|
||||
exec 'rake runtests'
|
||||
end
|
||||
Process.waitpid(pid)
|
||||
Rake::TestTask.new do |t|
|
||||
t.libs << 'lib' << 'test'
|
||||
t.pattern = 'test/**/*_test.rb'
|
||||
t.verbose = false
|
||||
t.warning = true
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
|
@ -37,7 +37,6 @@ end
|
|||
|
||||
Benchmark.bm(13) do |bench|
|
||||
pid = fork do
|
||||
Dir.chdir(File.join(File.dirname(__FILE__), *%w[.. ext bert c])) { `make` }
|
||||
require 'bert'
|
||||
raise "Could not load C extension" unless BERT::Decode.impl == 'C'
|
||||
setup
|
||||
|
|
|
@ -19,8 +19,10 @@ Gem::Specification.new do |s|
|
|||
s.files = `git ls-files`.split("\n")
|
||||
s.require_paths = ["lib", "ext"]
|
||||
|
||||
s.extensions = ["ext/bert/c/extconf.rb"]
|
||||
|
||||
s.add_development_dependency "thoughtbot-shoulda"
|
||||
s.add_development_dependency "git"
|
||||
s.add_development_dependency "rake"
|
||||
|
||||
s.add_development_dependency "rake-compiler", "~> 0.9.0"
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче