Class: Benoit::PipelineProject

Inherits:
Object
  • Object
show all
Defined in:
lib/benoit/pipeline_project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assetfile_path, output_dir = nil, tmp_cache_dir = nil) ⇒ PipelineProject



16
17
18
19
20
21
# File 'lib/benoit/pipeline_project.rb', line 16

def initialize(assetfile_path, output_dir=nil, tmp_cache_dir=nil)
    @assetfile_path = assetfile_path
    @output_dir = output_dir || default_output_dir
    @tmp_cache_dir = tmp_cache_dir || default_cache_dir
    @project = build_project!
end

Instance Attribute Details

#assetfile_pathObject (readonly)

Returns the value of attribute assetfile_path.



14
15
16
# File 'lib/benoit/pipeline_project.rb', line 14

def assetfile_path
  @assetfile_path
end

#output_dirObject (readonly)

Returns the value of attribute output_dir.



14
15
16
# File 'lib/benoit/pipeline_project.rb', line 14

def output_dir
  @output_dir
end

#projectObject (readonly)

Returns the value of attribute project.



14
15
16
# File 'lib/benoit/pipeline_project.rb', line 14

def project
  @project
end

#tmp_cache_dirObject (readonly)

Returns the value of attribute tmp_cache_dir.



14
15
16
# File 'lib/benoit/pipeline_project.rb', line 14

def tmp_cache_dir
  @tmp_cache_dir
end

Instance Method Details

#invokeObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/benoit/pipeline_project.rb', line 23

def invoke
  if Benoit.config.clean_before_build?
    Benoit::Cleaner.run
  end
    # project.pipelines.each do |pipeline|
    #   pipeline.register_invocation_hook :after_task, BuildNotifiers::FileBuiltNotifier
    #   pipeline.register_invocation_hook :before_filter, BuildNotifiers::ProgressNotifier
    #   pipeline.register_invocation_hook :filters_ready, ->(pipeline){
    #     require 'ostruct'
    #     paths_map = {}
    #     # pipeline.output_files.each do |output|
    #     #   input = output.original_inputs.first

    #     #   wrapper = OpenStruct.new(path: output.path, read: input.read, fullpath: input.fullpath)

    #     #   paths_map[input.path] = output.path

    #     #   PageMetadata::Store.current[wrapper]

    #     # end

    #     current_site = CurrentSite.load

    #     current_site.paths_map = paths_map

    #     # Load ALL filters (including filters within filters)
    #     filters = recursively_load_filters_from_pipeline(pipeline)
    #     filters.each do |filter|
    #       if filter.respond_to? :current_site=
    #         filter.current_site = current_site
    #       end
    #     end
    #   }
    # end
    project.invoke
end