Module: DocumentationSupport

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/documentation_support.rb

Constant Summary collapse

BULLET_TRAIN_BASE_PATH =
`bundle show bullet_train`.chomp

Instance Method Summary collapse

Instance Method Details

#docsObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/concerns/documentation_support.rb', line 6

def docs
  target = params[:page].presence || "index"

  # TODO For some reason this didn't work on Heroku.
  # all_paths = ([Rails.root.to_s] + `bundle show --paths`.lines.map(&:chomp))
  # @path = all_paths.map { |path| path + "/docs/#{target}.md" }.detect { |path| File.exist?(path) }

  @path = "#{BULLET_TRAIN_BASE_PATH}/docs/#{target}.md"

  render :docs, layout: "docs"
end