Rakefile in faster_path-0.1.13 vs Rakefile in faster_path-0.2.0

- old
+ new

@@ -22,12 +22,42 @@ rescue Errno::ENOENT => _ puts "\nNo Gemfile.lock" end end +desc "Add libruby to deps" +task :libruby_release do + filename = RbConfig::CONFIG["LIBRUBY_ALIASES"].split(" ").first + libfile = File.join(RbConfig::CONFIG["libdir"], filename) + deps = "target/release/deps" + + printf "Copying libruby.so ... " + unless File.exist? "#{deps}/#{filename}" + FileUtils.mkdir_p deps + FileUtils.cp libfile, deps + end + exit 1 unless File.exist? "#{deps}/#{filename}" + puts "libruby.so copied." +end + +desc "Add libruby to debug deps" +task :libruby_debug do + filename = RbConfig::CONFIG["LIBRUBY_ALIASES"].split(" ").first + libfile = File.join(RbConfig::CONFIG["libdir"], filename) + deps = "target/debug/deps" + + printf "Copying libruby.so ... " + unless File.exist? "#{deps}/#{filename}" + FileUtils.mkdir_p deps + FileUtils.cp libfile, deps + end + exit 1 unless File.exist? "#{deps}/#{filename}" + puts "libruby.so copied." +end + desc "Build Rust extension" -task :build_src do +task build_src: :libruby_release do puts "Building extension..." sh "cargo build --release" end desc "Clean up Rust build" @@ -56,10 +86,10 @@ sh "rubocop" puts end desc "Run Rust Tests" -task :cargo do +task cargo: :libruby_debug do sh "cargo test -- --nocapture" end Rake::TestTask.new(minitest: :build_lib) do |t| t.libs << "test"