Module: Octopress
- Extended by:
- Octopress
- Included in:
- Octopress
- Defined in:
- lib/octopress.rb,
lib/octopress/docs.rb,
lib/octopress/page.rb,
lib/octopress/post.rb,
lib/octopress/draft.rb,
lib/octopress/utils.rb,
lib/octopress/command.rb,
lib/octopress/isolate.rb,
lib/octopress/version.rb,
lib/octopress/docs/doc.rb,
lib/octopress/scaffold.rb,
lib/octopress/docs/hooks.rb,
lib/octopress/commands/new.rb,
lib/octopress/commands/docs.rb,
lib/octopress/commands/init.rb,
lib/octopress/commands/helpers.rb,
lib/octopress/commands/isolate.rb,
lib/octopress/commands/publish.rb,
lib/octopress/docs/jekyll/page.rb,
lib/octopress/commands/unpublish.rb,
lib/octopress/docs/jekyll/convertible.rb
Defined Under Namespace
Modules: CommandHelpers, Commands, Docs, Utils Classes: Command, Draft, Init, Isolate, New, Page, Post, Publish, Scaffold, Unpublish
Constant Summary collapse
- BLESSED_GEMS =
Automatically require these gems if installed
%w[ octopress-ink octopress-deploy octopress-multilingual ]
- VERSION =
"3.0.11"
Instance Method Summary collapse
-
#alias_site_title(site) ⇒ Object
Octopress historically used site.title This ensures we can all use site.name to be compatible with Jekyll’s scaffold convention.
-
#configuration(options = {}) ⇒ Object
Cache Jekyll’s site configuration.
- #gem_dir(dir = '') ⇒ Object
- #logger ⇒ Object
-
#multilingual? ⇒ Boolean
Is this site set up with the multilingual plugin?.
-
#read_site(options = {}) ⇒ Object
Quietly read from Jekyll’s site.
- #require_blessed_gems ⇒ Object
- #require_gems ⇒ Object
-
#site(options = {}) ⇒ Object
Cache Jekyll’s site.
-
#site=(site) ⇒ Object
Allow site to be set.
- #site? ⇒ Boolean
Instance Method Details
#alias_site_title(site) ⇒ Object
Octopress historically used site.title This ensures we can all use site.name to be compatible with Jekyll’s scaffold convention
87 88 89 90 |
# File 'lib/octopress.rb', line 87 def alias_site_title(site) site.config['name'] ||= site.config['title'] site end |
#configuration(options = {}) ⇒ Object
Cache Jekyll’s site configuration
40 41 42 43 44 45 46 |
# File 'lib/octopress.rb', line 40 def configuration(={}) if site? @site.config else @config ||= Jekyll.configuration() end end |
#gem_dir(dir = '') ⇒ Object
92 93 94 |
# File 'lib/octopress.rb', line 92 def gem_dir(dir='') File.(File.join(File.dirname(__FILE__), '..', dir)) end |
#logger ⇒ Object
32 33 34 35 36 |
# File 'lib/octopress.rb', line 32 def logger @logger ||= Mercenary::Command.logger @logger.level = Logger::DEBUG @logger end |
#multilingual? ⇒ Boolean
Is this site set up with the multilingual plugin?
54 55 56 |
# File 'lib/octopress.rb', line 54 def multilingual? defined?(Octopress::Multilingual) && !Octopress.site.config['lang'].nil? end |
#read_site(options = {}) ⇒ Object
Quietly read from Jekyll’s site
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/octopress.rb', line 66 def read_site(={}) Jekyll.logger.log_level = :error s = Jekyll::Site.new(Jekyll.configuration()) if defined?(Jekyll::PluginManager) && Jekyll::PluginManager.respond_to?(:require_from_bundler) Jekyll::PluginManager.require_from_bundler s.plugin_manager.conscientious_require end Jekyll.logger.log_level = :info alias_site_title(s) end |
#require_blessed_gems ⇒ Object
96 97 98 99 100 101 102 103 |
# File 'lib/octopress.rb', line 96 def require_blessed_gems BLESSED_GEMS.each do |gem| begin require gem rescue LoadError end end end |
#require_gems ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/octopress.rb', line 105 def require_gems require_blessed_gems if !ENV["OCTOPRESS_NO_BUNDLER_REQUIRE"] && File.file?("Gemfile") begin require "bundler" Bundler.setup(:default, :octopress, :jekyll_plugins) true rescue LoadError, Bundler::GemfileNotFound false end else false end end |
#site(options = {}) ⇒ Object
Cache Jekyll’s site
60 61 62 |
# File 'lib/octopress.rb', line 60 def site(={}) @site ||= read_site() end |
#site=(site) ⇒ Object
Allow site to be set
79 80 81 |
# File 'lib/octopress.rb', line 79 def site=(site) @site = alias_site_title(site) end |
#site? ⇒ Boolean
48 49 50 |
# File 'lib/octopress.rb', line 48 def site? !@site.nil? end |