Trifle
GitHub
Trifle::Docs / Configuration

Configuration

You don't need to use it with Rails, but you still need to run Trifle::Stats.configure.

Configuration allows you to specify:

  • path - path to a folder where your static files are located.
  • views - path to a views folder used for rendering (Sinatra App).
  • template - name of a rails template (Rails Engine).
  • register_harvester(HARVESTER_KLASS) - register a Harvester class used for serving files.

Gem fallbacks to global configuration if custom configuration is not passed to method. You can do this by creating initializer, or calling it on the beginning of your ruby script.

Unfortunately there are three ways to configure Trifle::Docs. And that depends on the way you plan to use it. Please refer to usage documentation for configuration for your usecase.

Global configuration

Trifle::Docs.configure do |config|
  config.path = File.join(Rails.root, 'docs')
  config.templates = File.join(Rails.root, 'app', 'views', 'trifle', 'docs')
  config.register_harvester(Trifle::Docs::Harvester::Markdown)
  config.register_harvester(Trifle::Docs::Harvester::File)
end

You cannot register harvester once you call harvester on a configuration. It's gonna raise an exception. You've been warned.