Class: Rspectacle::FileGather
- Inherits:
-
Object
- Object
- Rspectacle::FileGather
- Defined in:
- lib/rspectacle/file_gather.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
Instance Method Summary collapse
- #get_staged_files ⇒ Object
-
#initialize ⇒ FileGather
constructor
A new instance of FileGather.
- #specs_to_run ⇒ Object
Constructor Details
#initialize ⇒ FileGather
Returns a new instance of FileGather.
5 6 7 |
# File 'lib/rspectacle/file_gather.rb', line 5 def initialize self.files = get_staged_files end |
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
3 4 5 |
# File 'lib/rspectacle/file_gather.rb', line 3 def files @files end |
Instance Method Details
#get_staged_files ⇒ Object
9 10 11 |
# File 'lib/rspectacle/file_gather.rb', line 9 def get_staged_files `git status --porcelain | cut -c4-`.split("\n") end |
#specs_to_run ⇒ Object
13 14 15 16 |
# File 'lib/rspectacle/file_gather.rb', line 13 def specs_to_run spec_files = convert_to_spec.select{|file| file =~ /_spec\.rb$/}.uniq spec_files.select{|path| File.exist? path} end |