Skip to content

Commit

Permalink
replacing Rugged dependency per Git gem
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomdmoura committed May 10, 2015
1 parent be29def commit b81653f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
15 changes: 7 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ install:
- bundle install --retry=3

env:
- "RAILS_VERSION=4.0"
- "RAILS_VERSION=4.1"
- "RAILS_VERSION=4.2"
- "RAILS_VERSION=master"
global:
- JRUBY_OPTS=-Xcext.enabled=true
matrix:
- "RAILS_VERSION=4.0"
- "RAILS_VERSION=4.1"
- "RAILS_VERSION=4.2"
- "RAILS_VERSION=master"

matrix:
include:
- rvm: jruby-19mode
gemfile: gemfiles/Gemfile.rails-3.2.x
env: "JRUBY_OPTS=-Xcext.enabled=true"
allow_failures:
- rvm: ruby-head
- env: "RAILS_VERSION=master"
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source 'https://rubygems.org'
gemspec

gem 'minitest'
gem 'rugged'
gem 'git'

version = ENV["RAILS_VERSION"] || "4.2"

Expand Down
41 changes: 23 additions & 18 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'bundler/gem_tasks'
require 'rugged'
require 'git'
require 'pry'
require 'benchmark'
require 'rake/testtask'

Expand All @@ -13,34 +14,38 @@ Rake::TestTask.new do |t|
end

Rake::TestTask.new :benchmark_tests do |t|
t.libs << "test"
t.test_files = FileList['test/**/*_benchmark.rb']
t.ruby_opts = ['-r./test/test_helper.rb']
t.verbose = true
begin
t.libs << "test"
t.test_files = FileList['test/**/*_benchmark.rb']
t.ruby_opts = ['-r./test/test_helper.rb']
t.verbose = true
rescue LoadError
puts "There a new tests that doesn't exist on master"
end
end

task :benchmark do
@repo = Rugged::Repository.new('.')
ref = @repo.head

actual_branch = ref.name
@git = Git.init('.')
ref = @git.current_branch

set_commit('master')
old_bench = Benchmark.realtime { Rake::Task['benchmark_tests'].execute }
actual = run_benchmark_spec ref
master = run_benchmark_spec 'master'

set_commit(actual_branch)
new_bench = Benchmark.realtime { Rake::Task['benchmark_tests'].execute }
@git.checkout(ref)

puts 'Results ============================'
puts "------------------------------------~> (Branch) MASTER"
puts old_bench
puts master
puts "------------------------------------"

puts "------------------------------------~> (Actual Branch) #{actual_branch}"
puts new_bench
puts "------------------------------------~> (Actual Branch) #{ref}"
puts actual
puts "------------------------------------"
end

def set_commit(ref)
@repo.checkout ref
def run_benchmark_spec(ref)
@git.checkout(ref)
response = Benchmark.realtime { Rake::Task['benchmark_tests'].invoke }
Rake::Task['benchmark_tests'].reenable
response
end

0 comments on commit b81653f

Please sign in to comment.