Module: Bunto
- Defined in:
- lib/bunto/url.rb,
lib/bunto.rb,
lib/bunto/page.rb,
lib/bunto/site.rb,
lib/bunto/hooks.rb,
lib/bunto/theme.rb,
lib/bunto/utils.rb,
lib/bunto/errors.rb,
lib/bunto/layout.rb,
lib/bunto/plugin.rb,
lib/bunto/reader.rb,
lib/bunto/cleaner.rb,
lib/bunto/command.rb,
lib/bunto/excerpt.rb,
lib/bunto/filters.rb,
lib/bunto/version.rb,
lib/bunto/document.rb,
lib/bunto/external.rb,
lib/bunto/renderer.rb,
lib/bunto/converter.rb,
lib/bunto/generator.rb,
lib/bunto/publisher.rb,
lib/bunto/stevenson.rb,
lib/bunto/tags/link.rb,
lib/bunto/collection.rb,
lib/bunto/deprecator.rb,
lib/bunto/drops/drop.rb,
lib/bunto/utils/ansi.rb,
lib/bunto/convertible.rb,
lib/bunto/log_adapter.rb,
lib/bunto/regenerator.rb,
lib/bunto/static_file.rb,
lib/bunto/commands/new.rb,
lib/bunto/entry_filter.rb,
lib/bunto/tags/include.rb,
lib/bunto/commands/help.rb,
lib/bunto/configuration.rb,
lib/bunto/related_posts.rb,
lib/bunto/tags/post_url.rb,
lib/bunto/commands/build.rb,
lib/bunto/commands/clean.rb,
lib/bunto/commands/serve.rb,
lib/bunto/drops/url_drop.rb,
lib/bunto/plugin_manager.rb,
lib/bunto/tags/highlight.rb,
lib/bunto/commands/doctor.rb,
lib/bunto/drops/site_drop.rb,
lib/bunto/liquid_renderer.rb,
lib/bunto/utils/platforms.rb,
lib/bunto/drops/bunto_drop.rb,
lib/bunto/liquid_extensions.rb,
lib/bunto/drops/excerpt_drop.rb,
lib/bunto/converters/identity.rb,
lib/bunto/converters/markdown.rb,
lib/bunto/drops/document_drop.rb,
lib/bunto/readers/data_reader.rb,
lib/bunto/readers/page_reader.rb,
lib/bunto/readers/post_reader.rb,
lib/bunto/frontmatter_defaults.rb,
lib/bunto/liquid_renderer/file.rb,
lib/bunto/drops/collection_drop.rb,
lib/bunto/liquid_renderer/table.rb,
lib/bunto/readers/layout_reader.rb,
lib/bunto/commands/serve/servlet.rb,
lib/bunto/readers/collection_reader.rb,
lib/bunto/drops/unified_payload_drop.rb,
lib/bunto/readers/static_file_reader.rb,
lib/bunto/converters/markdown/kramdown_parser.rb,
lib/bunto/converters/markdown/rdiscount_parser.rb,
lib/bunto/converters/smartypants.rb
Overview
Convertible provides methods for converting a pagelike item from a certain type of markup into actual content
Requires
self.site -> Bunto::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, Plugin, PluginManager, PostReader, Publisher, Reader, Regenerator, RelatedPosts, Renderer, Site, StaticFile, StaticFileReader, Stevenson, Theme, ThemeBuilder, URL
Constant Summary collapse
- VERSION =
"3.2.1".freeze
- Generator =
Class.new(Plugin)
Class Method Summary collapse
-
.configuration(override = {}) ⇒ Object
Public: Generate a Bunto configuration Hash by merging the default options with anything in _config.yml, and adding the given options on top.
-
.env ⇒ Object
Public: Tells you which Bunto environment you are building in so you can skip tasks if you need to.
-
.logger ⇒ Object
Public: Fetch the logger instance for this Bunto process.
-
.logger=(writer) ⇒ Object
Public: Set the log writer.
-
.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.
-
.set_timezone(timezone) ⇒ Object
Public: Set the TZ environment variable to use the timezone specified.
-
.sites ⇒ Object
Public: An array of sites.
Class Method Details
.configuration(override = {}) ⇒ Object
Public: Generate a Bunto 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 Bunto::Configuration::DEFAULTS for a
list of option names and their defaults.
Returns the final configuration Hash.
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/bunto.rb', line 102 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 |
.env ⇒ Object
Public: Tells you which Bunto 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.
89 90 91 |
# File 'lib/bunto.rb', line 89 def env ENV["BUNTO_ENV"] || "development" end |
.logger ⇒ Object
Public: Fetch the logger instance for this Bunto process.
Returns the LogAdapter instance.
129 130 131 |
# File 'lib/bunto.rb', line 129 def logger @logger ||= LogAdapter.new(Stevenson.new, (ENV["BUNTO_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.
140 141 142 |
# File 'lib/bunto.rb', line 140 def logger=(writer) @logger = LogAdapter.new(writer, (ENV["BUNTO_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.
158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/bunto.rb', line 158 def sanitized_path(base_directory, questionable_path) return base_directory if base_directory.eql?(questionable_path) questionable_path.insert(0, "/") if questionable_path.start_with?("~") clean_path = File.(questionable_path, "/") clean_path.sub!(%r!\A\w:/!, "/") if clean_path.start_with?(base_directory.sub(%r!\A\w:/!, "/")) clean_path else 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 Style/AccessorMethodName
121 122 123 |
# File 'lib/bunto.rb', line 121 def set_timezone(timezone) ENV["TZ"] = timezone end |
.sites ⇒ Object
Public: An array of sites
Returns the Bunto sites created.
147 148 149 |
# File 'lib/bunto.rb', line 147 def sites @sites ||= [] end |