Class: RecordLoader::ApplicationRecordLoader

Inherits:
Base
  • Object
show all
Defined in:
lib/record_loader/application_record_loader.rb

Overview

This forms the standard base class for record loaders in your application, allowing for easy configuration.

Instance Method Summary collapse

Instance Method Details

#wip_listObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/record_loader/application_record_loader.rb', line 14

def wip_list
  # return a list of WIP files name as features if deploy_wip_pipelines is set to true, or return empty list
  deploy_wip_pipelines = Rails.application.config.try(:deploy_wip_pipelines) || false
  return [] unless deploy_wip_pipelines

  wip_files = []
  # @path is initialised from the directory argument passed to the initialiser method of the super class.
  # By default, it returns 'config/default_records' directory
  # see https://github.com/sanger/record_loader/blob/master/lib/record_loader/base.rb
  wip_files_path = @path
  Find.find(wip_files_path) do |path|
    if path.match?(/\wip\.yml$/)
      file_name = File.basename(path, '.wip.yml')
      wip_files << file_name
    end
  end
  wip_files
end