Sha256: fda52d785d789f7a4ec5d7b5948c554ed1406eaf15feda31adc16170866b8c02
Contents?: true
Size: 964 Bytes
Versions: 2
Compression:
Stored size: 964 Bytes
Contents
require 'git' require_relative 'file_name_style' module BareMinimumChecks class Project def run_specs specs = local_changes.reduce([]) do |specs, file_path| arr = specs.concat FileNameStyle.camel_case.get_test_file_name(file_path) arr.concat FileNameStyle.snake_case.get_test_file_name(file_path) end specs.each do |spec_file| puts "Running #{spec_file}" system("rspec #{spec_file}") end end private def local_changes g = Git.open('.') local_changes = g.diff.map(&:path) current_branch_name = g.current_branch branch_name = is_local_branch?(current_branch_name) ? 'origin/master' : "origin/#{current_branch_name}" local_changes.concat g.diff(branch_name, 'HEAD').map(&:path) local_changes.uniq end def is_local_branch?(branch_name) count = `git remote show origin | grep #{branch_name} | wc -l` count.to_i == 0 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bare_minimum_checks-0.1.2 | lib/bare_minimum_checks/project.rb |
bare_minimum_checks-0.1.1 | lib/bare_minimum_checks/project.rb |