Class: Propshaft::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/propshaft/processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(load_path:, output_path:, compilers:, manifest_path:) ⇒ Processor

Returns a new instance of Processor.



6
7
8
9
10
# File 'lib/propshaft/processor.rb', line 6

def initialize(load_path:, output_path:, compilers:, manifest_path:)
  @load_path, @output_path = load_path, output_path
  @manifest_path = manifest_path
  @compilers = compilers
end

Instance Attribute Details

#compilersObject (readonly)

Returns the value of attribute compilers.



4
5
6
# File 'lib/propshaft/processor.rb', line 4

def compilers
  @compilers
end

#load_pathObject (readonly)

Returns the value of attribute load_path.



4
5
6
# File 'lib/propshaft/processor.rb', line 4

def load_path
  @load_path
end

#manifest_pathObject (readonly)

Returns the value of attribute manifest_path.



4
5
6
# File 'lib/propshaft/processor.rb', line 4

def manifest_path
  @manifest_path
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



4
5
6
# File 'lib/propshaft/processor.rb', line 4

def output_path
  @output_path
end

Instance Method Details

#clean(count) ⇒ Object



22
23
24
# File 'lib/propshaft/processor.rb', line 22

def clean(count)
  Propshaft::OutputPath.new(output_path, load_path.manifest).clean(count, 1.hour)
end

#clobberObject



18
19
20
# File 'lib/propshaft/processor.rb', line 18

def clobber
  FileUtils.rm_r(output_path) if File.exist?(output_path)
end

#processObject



12
13
14
15
16
# File 'lib/propshaft/processor.rb', line 12

def process
  ensure_output_path_exists
  write_manifest
  output_assets
end