Module: Jekyll::Algolia
- Included in:
- Configurator, ErrorHandler, Extractor, FileBrowser, Indexer, ProgressBar
- Defined in:
- lib/jekyll-algolia.rb,
lib/jekyll/algolia/hooks.rb,
lib/jekyll/algolia/utils.rb,
lib/jekyll/algolia/logger.rb,
lib/jekyll/algolia/indexer.rb,
lib/jekyll/algolia/version.rb,
lib/jekyll/algolia/extractor.rb,
lib/jekyll/algolia/configurator.rb,
lib/jekyll/algolia/file_browser.rb,
lib/jekyll/algolia/progress_bar.rb,
lib/jekyll/algolia/error_handler.rb,
lib/jekyll/algolia/overwrites/jekyll-algolia-site.rb
Overview
Requirable file, loading all dependencies. Methods here are called by the main ‘jekyll algolia` command
Defined Under Namespace
Modules: Configurator, ErrorHandler, Extractor, FileBrowser, Hooks, Indexer, Logger, ProgressBar, Utils Classes: Site
Constant Summary collapse
- VERSION =
'1.3.2'
Class Method Summary collapse
-
.init(config = {}) ⇒ Object
Public: Init the Algolia module.
-
.run ⇒ Object
Public: Run the main Algolia module.
-
.site ⇒ Object
Public: Get access to the Jekyll site.
Class Method Details
.init(config = {}) ⇒ Object
Public: Init the Algolia module
config - A hash of Jekyll config option (merge of _config.yml options and options passed on the command line)
The gist of the plugin works by instanciating a Jekyll site, monkey-patching its ‘write` method and building it.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jekyll-algolia.rb', line 31 def self.init(config = {}) config = Configurator.init(config).config @site = Jekyll::Algolia::Site.new(config) exit 1 unless Configurator.assert_valid_credentials Configurator. # Register our own tags to overwrite the default tags Liquid::Template.register_tag('link', JekyllAlgoliaLink) if Configurator.dry_run? Logger.log('W:==== THIS IS A DRY RUN ====') Logger.log('W: - No records will be pushed to your index') Logger.log('W: - No settings will be updated on your index') end self end |
.run ⇒ Object
Public: Run the main Algolia module
Actually “process” the site, which will acts just like a regular ‘jekyll build` except that our monkey patched `write` method will be called instead.
Note: The internal list of files to be processed will only be created when calling .process
59 60 61 62 |
# File 'lib/jekyll-algolia.rb', line 59 def self.run Logger.log('I:Processing site...') @site.process end |
.site ⇒ Object
Public: Get access to the Jekyll site
Tests will need access to the inner Jekyll website so we expose it here
67 68 69 |
# File 'lib/jekyll-algolia.rb', line 67 def self.site @site end |