class Jekyll::Commands::Contentful

jekyll contentful Command

Public Class Methods

command_action(command) click to toggle source
# File lib/jekyll/commands/contentful.rb, line 30
def self.command_action(command)
  command.action do |args, options|
    jekyll_options = configuration_from_options(options)
    process args, options, jekyll_options
  end
end
init_with_program(prog) click to toggle source
# File lib/jekyll/commands/contentful.rb, line 8
def self.init_with_program(prog)
  prog.command(:contentful) do |c|
    c.syntax 'contentful [OPTIONS]'
    c.description 'Imports data from Contentful'

    options.each { |opt| c.option(*opt) }

    add_build_options(c)

    command_action(c)
  end
end
options() click to toggle source
# File lib/jekyll/commands/contentful.rb, line 21
def self.options
  [
    [
      'rebuild', '-r', '--rebuild',
      'Rebuild Jekyll Site after fetching data'
    ]
  ]
end
process(_args = [], options = {}, config = {}) click to toggle source
# File lib/jekyll/commands/contentful.rb, line 37
def self.process(_args = [], options = {}, config = {})
  Jekyll.logger.info 'Starting Contentful import'

  Jekyll::Contentful::Importer.new(config).run

  Jekyll.logger.info 'Contentful import finished'

  return unless options['rebuild']

  Jekyll.logger.info 'Starting Jekyll Rebuild'
  Jekyll::Commands::Build.process(options)
end