|
|
|
require 'erb'
|
|
|
|
require 'rake/testtask'
|
|
|
|
require 'rubygems/package'
|
|
|
|
|
|
|
|
BUILD_VERSION=1
|
|
|
|
# Determine the current version of the software
|
|
|
|
if File.read('../../CMakeLists.txt') =~ /project.*\s*VERSION\s*(\d.+)\)/
|
|
|
|
CURRENT_VERSION = "#{$1}.#{BUILD_VERSION}"
|
|
|
|
else
|
|
|
|
CURRENT_VERSION = "0.0.0.#{BUILD_VERSION}"
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Default Task (Test project)"
|
|
|
|
task :default => :test
|
|
|
|
|
|
|
|
Rake::TestTask.new(:test) do |t|
|
|
|
|
t.test_files = FileList['tests/test_*.rb']
|
|
|
|
t.verbose = false
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'Generate gem specification'
|
|
|
|
task :gemspec do
|
|
|
|
system("cp ../../LICENSE .")
|
|
|
|
system("cp ../../README.md .")
|
|
|
|
tspec = ERB.new(File.read(File.join(File.dirname(__FILE__),'lib','whispercpp.gemspec.erb')))
|
|
|
|
File.open(File.join(File.dirname(__FILE__),'whispercpp.gemspec'),'wb') do|f|
|
|
|
|
f << tspec.result
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'Build gem'
|
|
|
|
task :package => :gemspec do
|
|
|
|
spec_source = File.read File.join(File.dirname(__FILE__),'whispercpp.gemspec')
|
|
|
|
spec = nil
|
|
|
|
# see: http://gist.github.com/16215
|
|
|
|
Thread.new { spec = eval("#{spec_source}") }.join
|
|
|
|
spec.validate
|
|
|
|
Gem::Package.build(spec)
|
|
|
|
end
|