Module: Jekyll

Defined in:
lib/ngage/jekyll/url.rb,
lib/ngage/jekyll.rb,
lib/ngage/jekyll/page.rb,
lib/ngage/jekyll/site.rb,
lib/ngage/jekyll/hooks.rb,
lib/ngage/jekyll/theme.rb,
lib/ngage/jekyll/utils.rb,
lib/ngage/jekyll/errors.rb,
lib/ngage/jekyll/layout.rb,
lib/ngage/jekyll/plugin.rb,
lib/ngage/jekyll/reader.rb,
lib/ngage/jekyll/cleaner.rb,
lib/ngage/jekyll/command.rb,
lib/ngage/jekyll/excerpt.rb,
lib/ngage/jekyll/filters.rb,
lib/ngage/jekyll/document.rb,
lib/ngage/jekyll/external.rb,
lib/ngage/jekyll/renderer.rb,
lib/ngage/jekyll/converter.rb,
lib/ngage/jekyll/generator.rb,
lib/ngage/jekyll/publisher.rb,
lib/ngage/jekyll/stevenson.rb,
lib/ngage/jekyll/tags/link.rb,
lib/ngage/jekyll/collection.rb,
lib/ngage/jekyll/deprecator.rb,
lib/ngage/jekyll/drops/drop.rb,
lib/ngage/jekyll/utils/ansi.rb,
lib/ngage/jekyll/utils/exec.rb,
lib/ngage/jekyll/convertible.rb,
lib/ngage/jekyll/log_adapter.rb,
lib/ngage/jekyll/regenerator.rb,
lib/ngage/jekyll/static_file.rb,
lib/ngage/jekyll/commands/new.rb,
lib/ngage/jekyll/entry_filter.rb,
lib/ngage/jekyll/tags/include.rb,
lib/ngage/jekyll/utils/win_tz.rb,
lib/ngage/jekyll/commands/help.rb,
lib/ngage/jekyll/configuration.rb,
lib/ngage/jekyll/related_posts.rb,
lib/ngage/jekyll/tags/post_url.rb,
lib/ngage/jekyll/theme_builder.rb,
lib/ngage/jekyll/commands/build.rb,
lib/ngage/jekyll/commands/clean.rb,
lib/ngage/jekyll/commands/serve.rb,
lib/ngage/jekyll/drops/url_drop.rb,
lib/ngage/jekyll/plugin_manager.rb,
lib/ngage/jekyll/tags/highlight.rb,
lib/ngage/jekyll/utils/internet.rb,
lib/ngage/jekyll/commands/doctor.rb,
lib/ngage/jekyll/drops/site_drop.rb,
lib/ngage/jekyll/liquid_renderer.rb,
lib/ngage/jekyll/utils/platforms.rb,
lib/ngage/jekyll/drops/jekyll_drop.rb,
lib/ngage/jekyll/liquid_extensions.rb,
lib/ngage/jekyll/commands/new_theme.rb,
lib/ngage/jekyll/drops/excerpt_drop.rb,
lib/ngage/jekyll/utils/thread_event.rb,
lib/ngage/jekyll/converters/identity.rb,
lib/ngage/jekyll/converters/markdown.rb,
lib/ngage/jekyll/drops/document_drop.rb,
lib/ngage/jekyll/filters/url_filters.rb,
lib/ngage/jekyll/page_without_a_file.rb,
lib/ngage/jekyll/readers/data_reader.rb,
lib/ngage/jekyll/readers/page_reader.rb,
lib/ngage/jekyll/readers/post_reader.rb,
lib/ngage/jekyll/filters/date_filters.rb,
lib/ngage/jekyll/frontmatter_defaults.rb,
lib/ngage/jekyll/liquid_renderer/file.rb,
lib/ngage/jekyll/drops/collection_drop.rb,
lib/ngage/jekyll/liquid_renderer/table.rb,
lib/ngage/jekyll/readers/layout_reader.rb,
lib/ngage/jekyll/commands/serve/servlet.rb,
lib/ngage/jekyll/converters/smartypants.rb,
lib/ngage/jekyll/drops/static_file_drop.rb,
lib/ngage/jekyll/filters/grouping_filters.rb,
lib/ngage/jekyll/commands/serve/websockets.rb,
lib/ngage/jekyll/readers/collection_reader.rb,
lib/ngage/jekyll/drops/unified_payload_drop.rb,
lib/ngage/jekyll/readers/static_file_reader.rb,
lib/ngage/jekyll/readers/theme_assets_reader.rb,
lib/ngage/jekyll/commands/serve/live_reload_reactor.rb,
lib/ngage/jekyll/converters/markdown/kramdown_parser.rb

Overview

Convertible provides methods for converting a pagelike item from a certain type of markup into actual content

Requires

self.site -> Jekyll::Site
self.content
self.content=
self.data=
self.ext=
self.output=
self.name
self.path
self.type -> :page, :post or :draft

Defined Under Namespace

Modules: Commands, Converters, Convertible, Deprecator, Drops, Errors, External, Filters, Hooks, LiquidExtensions, Tags, Utils Classes: Cleaner, Collection, CollectionReader, Command, Configuration, Converter, DataReader, Document, EntryFilter, Excerpt, FrontmatterDefaults, Layout, LayoutReader, LiquidRenderer, LogAdapter, Page, PageReader, PageWithoutAFile, Plugin, PluginManager, PostReader, Publisher, Reader, Regenerator, RelatedPosts, Renderer, Site, StaticFile, StaticFileReader, Stevenson, Theme, ThemeAssetsReader, ThemeBuilder, URL

Constant Summary collapse

Generator =
Class.new(Plugin)

Class Method Summary collapse

Class Method Details

.configuration(override = {}) ⇒ Object

Public: Generate a Jekyll configuration Hash by merging the default options with anything in _config.yml, and adding the given options on top.

override - A Hash of config directives that override any options in both

the defaults and the config file.
See Jekyll::Configuration::DEFAULTS for a
list of option names and their defaults.

Returns the final configuration Hash.



109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/ngage/jekyll.rb', line 109

def configuration(override = {})
  config = Configuration.new
  override = Configuration[override].stringify_keys
  unless override.delete("skip_config_files")
    config = config.read_config_files(config.config_files(override))
  end

  # Merge DEFAULTS < _config.yml < override
  Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |obj|
    set_timezone(obj["timezone"]) if obj["timezone"]
  end
end

.envObject

Public: Tells you which Jekyll environment you are building in so you can skip tasks if you need to. This is useful when doing expensive compression tasks on css and images and allows you to skip that when working in development.



96
97
98
# File 'lib/ngage/jekyll.rb', line 96

def env
  ENV["JEKYLL_ENV"] || "development"
end

.loggerObject

Public: Fetch the logger instance for this Jekyll process.

Returns the LogAdapter instance.



140
141
142
# File 'lib/ngage/jekyll.rb', line 140

def logger
  @logger ||= LogAdapter.new(Stevenson.new, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
end

.logger=(writer) ⇒ Object

Public: Set the log writer.

New log writer must respond to the same methods
as Ruby's interal Logger.

writer - the new Logger-compatible log transport

Returns the new logger.



151
152
153
# File 'lib/ngage/jekyll.rb', line 151

def logger=(writer)
  @logger = LogAdapter.new(writer, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
end

.sanitized_path(base_directory, questionable_path) ⇒ Object

Public: Ensures the questionable path is prefixed with the base directory

and prepends the questionable path with the base directory if false.

base_directory - the directory with which to prefix the questionable path questionable_path - the path we’re unsure about, and want prefixed

Returns the sanitized path.



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/ngage/jekyll.rb', line 169

def sanitized_path(base_directory, questionable_path)
  return base_directory if base_directory.eql?(questionable_path)

  clean_path = questionable_path.dup
  clean_path.insert(0, "/") if clean_path.start_with?("~")
  clean_path = File.expand_path(clean_path, "/")

  return clean_path if clean_path.eql?(base_directory)

  # remove any remaining extra leading slashes not stripped away by calling
  # `File.expand_path` above.
  clean_path.squeeze!("/")

  if clean_path.start_with?(base_directory.sub(%r!\z!, "/"))
    clean_path
  else
    clean_path.sub!(%r!\A\w:/!, "/")
    File.join(base_directory, clean_path)
  end
end

.set_timezone(timezone) ⇒ Object

Public: Set the TZ environment variable to use the timezone specified

timezone - the IANA Time Zone

Returns nothing rubocop:disable Naming/AccessorMethodName



128
129
130
131
132
133
134
# File 'lib/ngage/jekyll.rb', line 128

def set_timezone(timezone)
  ENV["TZ"] = if Utils::Platforms.really_windows?
                Utils::WinTZ.calculate(timezone)
              else
                timezone
              end
end

.sitesObject

Public: An array of sites

Returns the Jekyll sites created.



158
159
160
# File 'lib/ngage/jekyll.rb', line 158

def sites
  @sites ||= []
end