Class: Jekyll::Stork
- Inherits:
-
Object
- Object
- Jekyll::Stork
- Defined in:
- lib/jekyll/stork.rb
Constant Summary collapse
- STEMMERS =
{ 'ar' => 'Arabic', 'da' => 'Danish', 'nl' => 'Dutch', 'en' => 'English', 'fi' => 'Finnish', 'fr' => 'French', 'de' => 'German', 'el' => 'Greek', 'hu' => 'Hungarian', 'it' => 'Italian', 'no' => 'Norwegian', 'pt' => 'Portuguese', 'ro' => 'Romanian', 'ru' => 'Russian', 'es' => 'Spanish', 'sv' => 'Swedish', 'ta' => 'Tamil', 'tr' => 'Turkish' }.freeze
Instance Attribute Summary collapse
- #config ⇒ String readonly
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #dest ⇒ String
- #file ⇒ String
- #files ⇒ Hash
- #index! ⇒ Object
-
#initialize(site) ⇒ Stork
constructor
A new instance of Stork.
-
#locale ⇒ String
Returns the locale from the Site.
- #stemmer ⇒ String
Constructor Details
#initialize(site) ⇒ Stork
Returns a new instance of Stork.
32 33 34 |
# File 'lib/jekyll/stork.rb', line 32 def initialize(site) @site = site end |
Instance Attribute Details
#config ⇒ String (readonly)
84 85 86 |
# File 'lib/jekyll/stork.rb', line 84 def config @config end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
8 9 10 |
# File 'lib/jekyll/stork.rb', line 8 def site @site end |
Instance Method Details
#dest ⇒ String
79 80 81 |
# File 'lib/jekyll/stork.rb', line 79 def dest @dest ||= File.join(site.dest, file) end |
#file ⇒ String
74 75 76 |
# File 'lib/jekyll/stork.rb', line 74 def file @file ||= 'index.st' end |
#files ⇒ Hash
63 64 65 66 67 68 69 70 71 |
# File 'lib/jekyll/stork.rb', line 63 def files @files ||= site.documents.concat(site.pages).map do |page| { 'path' => page.destination(site.dest), 'url' => page.url, 'title' => page.data['title'] || '' } end end |
#index! ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/jekyll/stork.rb', line 36 def index! Open3.popen2e('stork', '--build', config) do |_, stdout, thread| puts stdout.read if thread.value.success? site.static_files << Jekyll::StaticFile.new(site, site.source, '', file) end end rescue Errno::ENOENT Jekyll.logger.warn "I couldn't find the `stork` program on your PATH, maybe you need to install it?" end |
#locale ⇒ String
Returns the locale from the Site. Stork uses English as default language so we’re following that…
52 53 54 |
# File 'lib/jekyll/stork.rb', line 52 def locale @locale ||= site.config['locale'] || site.config['lang'] || 'en' end |
#stemmer ⇒ String
58 59 60 |
# File 'lib/jekyll/stork.rb', line 58 def stemmer @stemmer ||= STEMMERS[locale] || 'English' end |