Class: Rspectacle::FileGather

Inherits:
Object
  • Object
show all
Defined in:
lib/rspectacle/file_gather.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFileGather

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

#filesObject

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_filesObject



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_runObject



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