Module: Lanyon

Defined in:
lib/lanyon.rb,
lib/lanyon/router.rb,
lib/lanyon/version.rb,
lib/lanyon/backports.rb,
lib/lanyon/application.rb

Overview

Lanyon serves your Jekyll site as a Rack application.

See Lanyon.application for available initialization options.

Further information on the Lanyon library is available in the README file or on the project home page: <github.com/stomar/lanyon/>.

Defined Under Namespace

Modules: Backports Classes: Application, Router

Constant Summary collapse

VERSION =
"0.5.0"
DATE =
"2024-01-05"

Class Method Summary collapse

Class Method Details

.application(options = {}) ⇒ Object

Builds the Jekyll site, prepares the middleware stack, and returns the Rack application.

Options:

:config

use given config file (default: “_config.yml”)

:skip_build

whether to skip site generation at startup (default: false)

Other options are passed on to Jekyll::Site.

Returns a Rack application.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/lanyon.rb', line 38

def self.application(options = {})
  skip_build = options.fetch(:skip_build, default_options[:skip_build])

  config = jekyll_config(options)

  if skip_build
    puts skip_build_warning
  else
    process(config)
  end

  destination = config["destination"]
  router = Router.new(destination)

  Rack::Builder.new do
    use Rack::Head
    use Rack::ContentLength
    use Rack::ConditionalGet
    use Rack::ETag, nil, nil

    run Application.new(router)
  end
end

.build(options = {}) ⇒ Object

Builds the Jekyll site.

Accepts the same options as ::application, except for the :skip_build option which is ignored.



66
67
68
69
70
# File 'lib/lanyon.rb', line 66

def self.build(options = {})
  config = jekyll_config(options)

  process(config)
end