Class: Jekyll::Commands::Contentful
- Inherits:
-
Command
- Object
- Command
- Jekyll::Commands::Contentful
- Defined in:
- lib/jekyll/commands/contentful.rb
Class Method Summary collapse
- .init_with_program(prog) ⇒ Object
- .options ⇒ Object
- .process(args = [], options = {}, contentful_config = {}) ⇒ Object
Class Method Details
.init_with_program(prog) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jekyll/commands/contentful.rb', line 6 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.action do |args, | contentful_config = Jekyll.configuration['contentful'] process args, , contentful_config end end end |
.options ⇒ Object
20 21 22 23 24 |
# File 'lib/jekyll/commands/contentful.rb', line 20 def self. [ ['rebuild', '-r', '--rebuild', 'Rebuild Jekyll Site after fetching data'], ] end |
.process(args = [], options = {}, contentful_config = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jekyll/commands/contentful.rb', line 27 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' if ['rebuild'] Jekyll.logger.info 'Starting Jekyll Rebuild' Jekyll::Commands::Build.process() end end |