Class: Jekyll::FridgeGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/jekyll-fridge.rb

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jekyll-fridge.rb', line 12

def generate(site)
  # Reset cache if client already exists
  if site.config['fridge'].kind_of?(Fridge::Client)
    site.config['fridge'].reset!()
    return
  end

  # get api configuration from _config.yml
  #
  # fridge:
  #   client_id: sk_xxxx
  #   client_secret: xxxx
  api_config = site.config['fridge']
  api_config['asset_dir'] ||= 'assets'

  # set site.fridge as plugin entry
  site.config['fridge'] = Fridge::Client.new api_config
end