Class: Jekyll::Commands::Fyll

Inherits:
Command
  • Object
show all
Defined in:
lib/jekyll/commands/fyll.rb

Overview

jekyll fyll Command

Class Method Summary collapse

Class Method Details

.command_action(command) ⇒ Object



30
31
32
33
34
35
# File 'lib/jekyll/commands/fyll.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) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/jekyll/commands/fyll.rb', line 8

def self.init_with_program(prog)
  prog.command(:fyll) do |c|
    c.syntax 'fyll [OPTIONS]'
    c.description 'Imports data from Contentful'

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

    add_build_options(c)

    command_action(c)
  end
end

.optionsObject



21
22
23
24
25
26
27
28
# File 'lib/jekyll/commands/fyll.rb', line 21

def self.options
  [
    [
      'rebuild', '-r', '--rebuild',
      'Rebuild Jekyll Site after fetching data'
    ]
  ]
end

.process(_args = [], options = {}, config = {}) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/jekyll/commands/fyll.rb', line 37

def self.process(_args = [], options = {}, config = {})
  starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  Jekyll.logger.info '... Fylling Content ...'

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

  ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  elapsed = ending - starting
  Jekyll.logger.info '... Content Fylled ... '
  Jekyll.logger.info '... finished in #{elapsed} seconds'

  # return unless options['rebuild']

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