Class: Jekyll::Commands::Contentful
- Inherits:
-
Command
- Object
- Command
- Jekyll::Commands::Contentful
- Defined in:
- lib/jekyll/commands/contentful.rb
Overview
jekyll contentful Command
Class Method Summary collapse
- .command_action(command) ⇒ Object
- .init_with_program(prog) ⇒ Object
- .options ⇒ Object
- .process(_args = [], options = {}, contentful_config = {}) ⇒ Object
Class Method Details
.command_action(command) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/jekyll/commands/contentful.rb', line 30 def self.command_action(command) command.action do |args, | = () contentful_config = ['contentful'] process args, , contentful_config end end |
.init_with_program(prog) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# 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' .each { |opt| c.option(*opt) } (c) command_action(c) end end |
.options ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/jekyll/commands/contentful.rb', line 21 def self. [ [ 'rebuild', '-r', '--rebuild', 'Rebuild Jekyll Site after fetching data' ] ] end |
.process(_args = [], options = {}, contentful_config = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jekyll/commands/contentful.rb', line 38 def self.process(_args = [], = {}, contentful_config = {}) Jekyll.logger.info 'Starting Contentful import' Jekyll::Contentful::Importer.new(contentful_config).run Jekyll.logger.info 'Contentful import finished' return unless ['rebuild'] Jekyll.logger.info 'Starting Jekyll Rebuild' Jekyll::Commands::Build.process() end |