Module: Executor
- Defined in:
- lib/specss/executor.rb
Class Method Summary collapse
- .extended ⇒ Object
-
.get_all_affected_files ⇒ Object
Returns all unique files in changelist and their dependents.
-
.get_dependents ⇒ Object
Returns all dependents of files in changelist.
- .lite ⇒ Object
-
.main(opt) ⇒ Object
Takes in option from parse and executes main functions.
Class Method Details
.extended ⇒ Object
53 54 55 56 |
# File 'lib/specss/executor.rb', line 53 def extended all_files = get_all_affected_files Files::Specs.get_specs(all_files) end |
.get_all_affected_files ⇒ Object
Returns all unique files in changelist and their dependents
30 31 32 33 34 35 36 37 38 |
# File 'lib/specss/executor.rb', line 30 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 ⇒ Object
Returns all dependents of files in changelist
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/specss/executor.rb', line 42 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 |
.lite ⇒ Object
58 59 60 |
# File 'lib/specss/executor.rb', line 58 def lite Files::Specs.get_specs($changed_files) end |
.main(opt) ⇒ Object
Takes in option from parse and executes main functions
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/specss/executor.rb', line 8 def main(opt) $changed_files = Files::Perforce.get_changelist_files # Pass in options from ARGV on whether to run lite or extended case opt when 'extended' specs_to_run = extended else specs_to_run = lite end 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 |