Class: Kozeki::Build
- Inherits:
-
Object
- Object
- Kozeki::Build
- Defined in:
- lib/kozeki/build.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
Returns the value of attribute events.
-
#incremental_build ⇒ Object
Returns the value of attribute incremental_build.
-
#updated_files ⇒ Object
readonly
Returns the value of attribute updated_files.
Instance Method Summary collapse
- #full_build? ⇒ Boolean
- #incremental_build? ⇒ Boolean
- #incremental_build_possible? ⇒ Boolean
-
#initialize(state:, source_filesystem:, destination_filesystem:, collection_list_included_prefix: nil, collection_options: [], loader:, events: nil, incremental_build:, logger: nil) ⇒ Build
constructor
A new instance of Build.
- #inspect ⇒ Object
- #perform ⇒ Object
Constructor Details
#initialize(state:, source_filesystem:, destination_filesystem:, collection_list_included_prefix: nil, collection_options: [], loader:, events: nil, incremental_build:, logger: nil) ⇒ Build
Returns a new instance of Build.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kozeki/build.rb', line 12 def initialize(state:, source_filesystem:, destination_filesystem:, collection_list_included_prefix: nil, collection_options: [], loader:, events: nil, incremental_build:, logger: nil) @state = state @source_filesystem = source_filesystem @destination_filesystem = destination_filesystem @collection_list_included_prefix = collection_list_included_prefix @collection_options = @loader = loader @loader_cache = {} @logger = logger @events = events @incremental_build = incremental_build @updated_files = [] @build_id = nil end |
Instance Attribute Details
#events ⇒ Object
Returns the value of attribute events.
30 31 32 |
# File 'lib/kozeki/build.rb', line 30 def events @events end |
#incremental_build ⇒ Object
Returns the value of attribute incremental_build.
30 31 32 |
# File 'lib/kozeki/build.rb', line 30 def incremental_build @incremental_build end |
#updated_files ⇒ Object (readonly)
Returns the value of attribute updated_files.
31 32 33 |
# File 'lib/kozeki/build.rb', line 31 def updated_files @updated_files end |
Instance Method Details
#full_build? ⇒ Boolean
45 46 47 |
# File 'lib/kozeki/build.rb', line 45 def full_build? !incremental_build? end |
#incremental_build? ⇒ Boolean
41 42 43 |
# File 'lib/kozeki/build.rb', line 41 def incremental_build? incremental_build_possible? && @incremental_build end |
#incremental_build_possible? ⇒ Boolean
37 38 39 |
# File 'lib/kozeki/build.rb', line 37 def incremental_build_possible? @state.build_exist? end |
#inspect ⇒ Object
33 34 35 |
# File 'lib/kozeki/build.rb', line 33 def inspect "#<#{self.class.name}#{self.__id__}>" end |
#perform ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/kozeki/build.rb', line 49 def perform raise "can't reuse" if @build_id if full_build? @logger&.info "Starting full build" else @logger&.info "Starting incremental build" end @state.transaction do process_prepare process_events end @state.transaction do process_items_remove process_items_update end @state.transaction do process_garbage end @state.transaction do process_collections end @destination_filesystem.flush @state.transaction do process_commit end @destination_filesystem.flush end |