Rakefile in congruence_solver-0.4.0 vs Rakefile in congruence_solver-0.5.0
- old
+ new
@@ -3,11 +3,11 @@
require "rake/extensiontask"
require "os"
def verbose_sh_exec(cmd)
puts cmd
- `#{cmd}`
+ system cmd
end
def verbose_rm_files(files_to_rm_ary)
if OS.windows?
rm_cmd = "rm /s /q"
@@ -18,32 +18,33 @@
files_to_rm_ary.each {|fname| verbose_sh_exec "#{rm_cmd} #{fname}"}
end
# runs the csolve binary
task :exe do
- system "bin/csolve"
+ verbose_sh_exec "bin/csolve"
end
#spec runs all RSpec examples
RSpec::Core::RakeTask.new :spec
# run the tests shipped the extension
-task :ctest => [:compile_ext] do
+task :ctest do
verbose_sh_exec "(cd ext/congruence_solver && make test)"
end
task :test => [:ctest, :spec]
# uses task template provided by rake-compiler to run the extension compilation
# workflow
Rake::ExtensionTask.new 'congruence_solver' do |ext|
ext.lib_dir = "lib/congruence_solver"
+ ext.config_options << "--openmp=-fopenmp"
end
# runs benchmarks
task :bench do
- system "csolve bench"
+ verbose_sh_exec "csolve bench"
end
# download source files for the extension
task :download_ext do
congruences_lib_url="https://github.com/laneb/congruences/archive/master.zip"
@@ -78,27 +79,29 @@
]
verbose_rm_files files_to_rm
end
# build Ruby gem
-task :build => [:compile_ext] do
+task :build do
gemspec = "congruence_solver.gemspec"
verbose_sh_exec "gem build #{gemspec}"
end
-# install gem locally
-task :install => [:clean, :update_ext, :test, :build] do
+def gemfile
dot_gem_files = Dir.entries(Dir.pwd).select {|f| f =~ /congruence_solver\-.*\.gem/}
if dot_gem_files.empty?
STDERR.puts "Failed to build gem. Exiting."
elsif dot_gem_files.length > 1
STDERR.puts "Error: conflicting .gem files in directory. Exiting."
else
- verbose_sh_exec "gem install #{dot_gem_files.first}"
+ dot_gem_files.first
end
end
-task :publish do
- cmd = "gem push *.gem"
- p cmd
- system cmd
+# install gem locally
+task :install => [:compile_ext, :build] do
+ verbose_sh_exec "gem install #{gemfile}"
+end
+
+task :publish => [:clean, :compile_ext, :test, :build] do
+ verbose_sh_exec "gem push #{gemfile}"
end