Module: Files::Perforce

Defined in:
lib/specss/files.rb

Class Method Summary collapse

Class Method Details

.get_changelist_filesObject

Returns all ruby files in changelist as an array of files without extension



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/specss/files.rb', line 7

def self.get_changelist_files
  changed_files = []
  p4_status = %x|p4 status &|
  p4_array = p4_status.split("\n")

  # Add all ruby files ready to be submitted to changed file array
  p4_array.each do |p|
    next unless p.include?('.rb')
    file = p.split(' - ')[0]
    status = p.split(' - ')[1]
    changed_files.push(File.basename(file, ".*")) if status.include? 'submit'
  end
  changed_files
end