mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Branches
This commit is contained in:
33
Rakefile
33
Rakefile
@@ -22,6 +22,39 @@ task :build_gem do
|
|||||||
File.delete("lib/linguist/languages.json")
|
File.delete("lib/linguist/languages.json")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace :benchmark do
|
||||||
|
require 'git'
|
||||||
|
git = Git.open('.')
|
||||||
|
|
||||||
|
desc "Testin'"
|
||||||
|
task :run do
|
||||||
|
reference, compare = ENV['compare'].split('...')
|
||||||
|
puts "Comparing #{reference}...#{current}"
|
||||||
|
puts "Unstaged changes" and return if git.status.changed.any?
|
||||||
|
|
||||||
|
# Get the current branch
|
||||||
|
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
|
||||||
|
|
||||||
|
# Create tmp branch for reference commit
|
||||||
|
git.branch("tmp_#{reference}").checkout
|
||||||
|
git.reset_hard(reference)
|
||||||
|
|
||||||
|
# RUN BENCHMARK
|
||||||
|
|
||||||
|
git.branch("tmp_#{compare}").checkout
|
||||||
|
git.reset_hard(compare)
|
||||||
|
|
||||||
|
# RUN BENCHMARK AGAIN
|
||||||
|
|
||||||
|
git.branch(current_branch).checkout
|
||||||
|
|
||||||
|
# CLEAN UP
|
||||||
|
git.branch("tmp_#{reference}").delete
|
||||||
|
git.branch("tmp_#{compare}").delete
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
namespace :classifier do
|
namespace :classifier do
|
||||||
LIMIT = 1_000
|
LIMIT = 1_000
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user