Class: SewingKit::Webpack::Manifest::Development

Inherits:
Base
  • Object
show all
Defined in:
lib/sewing_kit/webpack/manifest/development.rb

Instance Method Summary collapse

Methods inherited from Base

#asset_dependencies, load_metadata_from_node, #manifest, mode

Constructor Details

#initialize ⇒ Development

Returns a new instance of Development.



8
9
10
11
# File 'lib/sewing_kit/webpack/manifest/development.rb', line 8

def initialize
  super
  @metadata_path = nil
end

Instance Method Details

#clear_cache! ⇒ Object



13
14
15
16
# File 'lib/sewing_kit/webpack/manifest/development.rb', line 13

def clear_cache!
  super
  @metadata_path = nil
end

#load_metadata ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/sewing_kit/webpack/manifest/development.rb', line 22

def 
  begin
    return (@metadata_path) if @metadata_path
  rescue => e
    Rails.logger.warn "[sewing_kit] could not read manifest from #{@metadata_path}; falling back to node.  #{e}"
    @metadata_path = nil
  end

  result = SewingKit::Webpack::Manifest::Base.
  raise LegacyManifestError, result unless result['entrypoints'] || result['development']

  @metadata_path = result && result['path']
  result
end

#load_metadata_from_fs(path) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/sewing_kit/webpack/manifest/development.rb', line 37

def (path)
  begin
    json_str = File.read(path)
  rescue => e
    raise ManifestLoadError.new(path, e)
  end

  begin
    JSON.parse(json_str)
  rescue => e
    raise ManifestParseError, e
  end
end

#metadata ⇒ Object



18
19
20
# File 'lib/sewing_kit/webpack/manifest/development.rb', line 18

def 
  
end