module Executor
Public Class Methods
condensed()
click to toggle source
# File lib/specss/executor.rb, line 56 def condensed Files::Specs.get_specs($changed_files) end
extended()
click to toggle source
# File lib/specss/executor.rb, line 51 def extended all_files = get_all_affected_files Files::Specs.get_specs(all_files) end
get_all_affected_files()
click to toggle source
Returns all unique files in changelist and their dependents
# File lib/specss/executor.rb, line 28 def get_all_affected_files all_files = $changed_files dependents = get_dependents dependents.each do |d| all_files.push(d) unless all_files.include? d end all_files end
get_dependents()
click to toggle source
Returns all dependents of files in changelist
# File lib/specss/executor.rb, line 40 def get_dependents dependents = [] $changed_files.each do |f| dependents_array = Files::Dependencies.get_dependencies(f) dependents_array.each do |d| dependents.push(d) unless dependents.include? d end end dependents end
list_specs()
click to toggle source
Prints a list of specs for files opened for edit
# File lib/specss/executor.rb, line 62 def list_specs specs = condensed puts specs.join("\n") end
main(opt)
click to toggle source
Takes in option from parse and executes main functions
# File lib/specss/executor.rb, line 8 def main(opt) $changed_files = Files::Perforce.get_changelist_files return false unless $changed_files # Pass in options from ARGV on whether to run lite or extended case opt when 'extended' specs_to_run = extended when 'list' list_specs else specs_to_run = condensed end run_specs(specs_to_run) unless opt == 'list' end
run_specs(specs_to_run)
click to toggle source
# File lib/specss/executor.rb, line 67 def run_specs(specs_to_run) if specs_to_run.empty? puts 'No specs need to be run' else spec_names = Files::Specs.chop_file_paths(specs_to_run) puts 'Running specs: ' + spec_names.join(" ") exec "bundle exec rspec " + specs_to_run.join(" ") end end