RTFMd 0.10301.11 → 0.10301.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'RTFMd'
7
- s.version = '0.10301.11'
7
+ s.version = '0.10301.12'
8
8
  s.date = '2011-12-16'
9
9
 
10
10
  s.summary = "A simple, Markdown documentation helper."
@@ -2,12 +2,20 @@ require 'sinatra/base'
2
2
  require 'gollum'
3
3
  require 'gollum/frontend/app'
4
4
 
5
- Precious::App.set(:gollum_path, ENV['RTFMd_WIKI'])
6
- Precious::App.set(:wiki_options, {
7
- :base_path => ENV['RTFMd_BASE_PATH'] == "/" ? "/" : "#{ENV['RTFMd_BASE_PATH']}/"
8
- })
5
+ Precious::App.set(:roots => {})
9
6
 
10
- map ENV['RTFMd_BASE_PATH'] do
11
- run Precious::App
12
- end
7
+ ENV['RTFMd_WIKI'].split(/\s*,\s*/).zip(ENV['RTFMd_BASE_PATH'].split(/\s*,\s*/)).each do |wiki_path, base_path|
8
+ Precious::App.settings.roots[base_path] = {
9
+ :gollum_path => wiki_path,
10
+ :wiki_options => {
11
+ :base_path => base_path == "/" ? "/" : "#{base_path}/"
12
+ }
13
+ }
13
14
 
15
+ require 'pp'
16
+ pp Precious::App.settings.roots[base_path]
17
+
18
+ map base_path do
19
+ run Precious::App
20
+ end
21
+ end
@@ -46,7 +46,7 @@ module Precious
46
46
 
47
47
  get %r{/(.+?)/([0-9a-f]{40})} do
48
48
  name = params[:captures][0]
49
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
49
+ wiki = Gollum::Wiki.new(settings.roots[request.script_name][:gollum_path], settings.roots[request.script_name][:wiki_options])
50
50
  if page = wiki.page(name, params[:captures][1])
51
51
  @page = page
52
52
  @name = name
@@ -59,7 +59,7 @@ module Precious
59
59
  end
60
60
 
61
61
  get '/pages' do
62
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
62
+ wiki = Gollum::Wiki.new(settings.roots[request.script_name][:gollum_path], settings.roots[request.script_name][:wiki_options])
63
63
  @results = wiki.pages
64
64
  @ref = wiki.ref
65
65
  @base_path = wiki.base_path
@@ -72,7 +72,7 @@ module Precious
72
72
 
73
73
  def show_page_or_file(*names)
74
74
  ps = names.collect do |name|
75
- wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
75
+ wiki = Gollum::Wiki.new(settings.roots[request.script_name][:gollum_path], settings.roots[request.script_name][:wiki_options])
76
76
  if page = wiki.page(name)
77
77
  @page = page
78
78
  @name = name
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RTFMd
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41213
4
+ hash: 41203
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10301
9
- - 11
10
- version: 0.10301.11
9
+ - 12
10
+ version: 0.10301.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Bombadil