Class: Jekyll::Assets::Manifest

Inherits:
Sprockets::Manifest
  • Object
show all
Defined in:
lib/jekyll/assets/manifest.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Object

– Set @new_manifest to false by default. –



27
28
29
30
# File 'lib/jekyll/assets/manifest.rb', line 27

def initialize(*args)
  @new_manifest = false
  super
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



10
11
12
# File 'lib/jekyll/assets/manifest.rb', line 10

def data
  @data
end

Class Method Details

.keep_keysArray<String>

Note:

the format should be ‘key: { hashKey: hashVal }` or `key: []`

Note:

complex keys aren’t supported.

– Allows you to add a manifest key for us to keep. –

Returns:

  • (Array<String>)


47
48
49
50
51
# File 'lib/jekyll/assets/manifest.rb', line 47

def self.keep_keys
  @keep_keys ||= %w(
    assets
  )
end

.simple_logical_path?(file) ⇒ Boolean

– Works around some weird behavior in Sprockets 3.x that seemd to make it so that when you use an absolute path, it was automatically a filter and so you could never find an asset that was dynamically added. –

Returns:

  • (Boolean)


37
38
39
# File 'lib/jekyll/assets/manifest.rb', line 37

def self.simple_logical_path?(file)
  super || File.file?(file)
end

Instance Method Details

#find_directory_manifest(dirname) ⇒ Object

– rubocop:disable Metrics/LineLength Allows us to discover the manifest path, but know

if it's new.



58
59
60
61
62
63
# File 'lib/jekyll/assets/manifest.rb', line 58

def find_directory_manifest(dirname)
  entries = File.directory?(dirname) ? Dir.entries(dirname) : []
  entry = (f = entries.find { |e| e =~ MANIFEST_RE }) || generate_manifest_path
  f || @new_manifest = true
  File.join(dirname, entry)
end

#new_manifest?true, false

Note:

it helps us keep the cache directory clean.

– Determines if we’ve a new manifest file. rubocop:disable Style/RedundantReturn –

Returns:

  • (true, false)


18
19
20
# File 'lib/jekyll/assets/manifest.rb', line 18

def new_manifest?
  return @new_manifest
end