Module: Kiba::Extend::Fcar
- Extended by:
- Dry::Configurable
- Defined in:
- lib/kiba/extend/fcar.rb
Overview
Optional settings for creating sequenced FCAR processes in a project.
This code’s original use was in an abstract project, where it was used to determine whether a client project was using a given facilitated cleanup and remapping (FCAR) process or not, and thus automagically determine the correct source job for a given FCAR process in a given client project
Class Method Summary collapse
-
.base_source ⇒ Symbol
Job key of job whose output should be used as input for initial FCAR process.
-
.chute ⇒ Array<String>, Hash{String => String}
Sample CHUTE for a reusable codebase on which multiple client projects can be based:.
-
.final_merged ⇒ Object
-
.pending_processes ⇒ Array<Module>
FCAR processes intended for use in your project, for which there are not yet any files.
-
.previous_merged(mod) ⇒ Object
-
.processes ⇒ Array<Module>
FCAR processes used in client project.
Class Method Details
.base_source ⇒ Symbol
Returns job key of job whose output should be used as input for initial FCAR process.
24 |
# File 'lib/kiba/extend/fcar.rb', line 24 setting :base_source, reader: true, default: :your__jobkey |
.chute ⇒ Array<String>, Hash{String => String}
Sample CHUTE for a reusable codebase on which multiple client projects can be based:
-
ObjectCounts
The order of the overall CHUTE is NOT the order you must complete all the FCAR processes. For instance, your migration process may have you starting with the 2, not Itemandboxcount. Without an Itemandboxcount process set up, the
sourcefor AgencyMuseumNameCleanup will be thebase_source. If/when you set up an Itemandboxcount process, itssourcewill bebase_sourceand AgencyMuseumNameCleanup’ssourcewill become the output of the merge job for Itemandboxcount.
Within a group, you can leave out steps if they aren’t needed. For instance, if no site values are multi-value, you can skip SiteSplit. If multiple processs from a group are needed, they must be done in order.
Any hard-dependencies on order between processes and/or groups should be specified in the comments.
51 52 53 54 55 56 57 58 59 |
# File 'lib/kiba/extend/fcar.rb', line 51 setting :chute, reader: true, default: [], constructor: ->(default) do return {} if default.empty? return default if default.is_a?(Hash) default.map { |e| [e, ""] }.to_h end |
.final_merged ⇒ Object
77 |
# File 'lib/kiba/extend/fcar.rb', line 77 def final_merged = processes[-1]&.merge_job || base_source |
.pending_processes ⇒ Array<Module>
Returns FCAR processes intended for use in your project, for which there are not yet any files.
20 |
# File 'lib/kiba/extend/fcar.rb', line 20 setting :pending_processes, reader: true, default: [] |
.previous_merged(mod) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/kiba/extend/fcar.rb', line 69 def previous_merged(mod) idx = processes.find_index(mod) fail(Kiba::Extend::UnknownFcarConfigError.new(mod)) unless idx return base_source if idx == 0 processes[idx - 1].merge_job end |
.processes ⇒ Array<Module>
Returns FCAR processes used in client project.
62 63 64 65 66 67 |
# File 'lib/kiba/extend/fcar.rb', line 62 def processes chute.keys .map { |name| project_process(name) } .compact .select { |mod| active?(mod) && valid?(mod) } end |