rubyworks / smeagol

Read-Only Gollum Server
http://rubyworks.github.com/smeagol
Other
92 stars 5 forks source link

Add settings.mount_path so Smeagol can be mounted on a sub-uri. #33

Closed fnichol closed 12 years ago

fnichol commented 13 years ago

Smeagol can be configured to run as a regular rack application and can be hosted on unicorn, passenger, etc. This patch accomodates the situation where Smeagol needs to be mounted on a path under the root of a domain. For example:

# config.ru
require 'smeagol'

def resolve_git_binary
  # ...
end

Smeagol::App.set(:repositories, [{:path => Dir.pwd}.to_ostruct])
Smeagol::App.set(:git, resolve_git_binary)
Smeagol::App.set(:cache_enabled, true)
Smeagol::App.set(:mount_path, '/wiki')

map '/wiki' do
  run Smeagol::App
end

Thanks again for a great way to publish micro wiki apps.

trans commented 12 years ago

Could we do this without the trailing / on base path instead? So, e.g. we'd use:

<link rel="stylesheet" href="{{base_path}}/smeagol/main.css" type="text/css"/>

Would there be a problem with that?

trans commented 12 years ago

Ok. I'll go ahead and merge this as is, and then we'll reconsider the trailing slash before next release.