RTFMd 0.10301.13 → 0.10301.14

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.13'
7
+ s.version = '0.10301.14'
8
8
  s.date = '2011-12-16'
9
9
 
10
10
  s.summary = "A simple, Markdown documentation helper."
data/bin/rtfmd CHANGED
@@ -1,17 +1,4 @@
1
1
  #!/bin/bash -e
2
2
 
3
- RTFMd_BASE_PATH="/"
4
- RTFMd_WIKI=$(pwd)
5
-
6
- export RTFMd_WIKI RTFMd_BASE_PATH
7
-
8
- if [[ -n $1 ]]; then
9
- RTFMd_WIKI=$1; shift
10
- fi
11
-
12
- if [[ -n $1 ]]; then
13
- RTFMd_BASE_PATH=$1; shift
14
- fi
15
-
16
3
  bundle check 2>&- || { bundle install --local && bundle check; }
17
4
  exec bundle exec thin start -R config/rtfmd.ru
@@ -1,6 +1,8 @@
1
1
  require 'sinatra/base'
2
- require 'gollum'
3
2
  require 'gollum/frontend/app'
3
+ require 'gollum/frontend/indexapp'
4
+
5
+ rtfm_root = "/"
4
6
 
5
7
  Precious::App.set(:roots => {})
6
8
 
@@ -8,14 +10,22 @@ ENV['RTFMd_WIKI'].split(/[\s*,]+/).zip(ENV['RTFMd_BASE_PATH'].split(/[\s*,]+/)).
8
10
  Precious::App.settings.roots[base_path] = {
9
11
  :gollum_path => wiki_path,
10
12
  :wiki_options => {
11
- :base_path => base_path == "/" ? "/" : "#{base_path}/"
13
+ :base_path => "#{rtfm_root}/#{base_path}/".gsub(/\/{2,}/, "/"),
14
+ :rtfm_root => rtfm_root
12
15
  }
13
16
  }
17
+ end
18
+
19
+ require 'pp'
20
+ pp Precious::App.settings.roots
14
21
 
15
- require 'pp'
16
- pp Precious::App.settings.roots[base_path]
17
-
18
- map base_path do
22
+ Precious::App.settings.roots.keys.each do |base_path|
23
+ map "#{rtfm_root}/#{base_path}".gsub(/\/{2,}/, "/") do
19
24
  run Precious::App
20
25
  end
21
26
  end
27
+
28
+ map rtfm_root do
29
+ run Precious::IndexApp
30
+ end
31
+
@@ -52,6 +52,7 @@ module Precious
52
52
  @name = name
53
53
  @content = page.formatted_data
54
54
  @base_path = wiki.base_path
55
+ @rtfm_root = settings.roots[request.script_name][:wiki_options][:rtfm_root]
55
56
  mustache :page
56
57
  else
57
58
  halt 404
@@ -78,6 +79,7 @@ module Precious
78
79
  @name = name
79
80
  @content = page.formatted_data
80
81
  @base_path = wiki.base_path
82
+ @rtfm_root = settings.roots[request.script_name][:wiki_options][:rtfm_root]
81
83
  mustache :page
82
84
  elsif file = wiki.file(name)
83
85
  content_type file.mime_type
@@ -0,0 +1,17 @@
1
+ require 'cgi'
2
+ require 'sinatra'
3
+ require 'gollum'
4
+ require 'mustache/sinatra'
5
+
6
+ require 'gollum/frontend/views/layout'
7
+
8
+ module Precious
9
+ class IndexApp < App
10
+ get '/' do
11
+ @roots = settings.roots.collect {|bp,ele| { :root => bp, :wiki => ele[:gollum_path] } }
12
+ @base_path = "/"
13
+ mustache :index
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,25 @@
1
+ <div id="wiki-wrapper" class="results">
2
+ <div id="head">
3
+ <h1>{{title}}</h1>
4
+ </div>
5
+ <div id="results">
6
+
7
+ {{#has_roots}}
8
+ <ul>
9
+ {{#roots}}
10
+ <li>
11
+ <a href="{{root}}">{{wiki}}</a>
12
+ </li>
13
+ {{/roots}}
14
+ </ul>
15
+ {{/has_roots}}
16
+
17
+ {{#no_roots}}
18
+ <p id="no-results">
19
+ There are no wikis.
20
+ </p>
21
+ {{/no_roots}}
22
+
23
+ </div>
24
+ </div>
25
+
@@ -5,6 +5,8 @@
5
5
  class="action-home-page">Home</a></li>
6
6
  <li class="minibutton"><a href="{{base_path}}pages"
7
7
  class="action-all-pages">All Pages</a></li>
8
+ <li class="minibutton"><a href="{{rtfm_root}}"
9
+ class="action-all-projects">All Projects</a></li>
8
10
  </ul>
9
11
  </div>
10
12
  <div id="wiki-content">
@@ -0,0 +1,21 @@
1
+ require 'cgi'
2
+
3
+ module Precious
4
+ module Views
5
+ class Index < Layout
6
+ attr_reader :roots
7
+
8
+ def title
9
+ "Index"
10
+ end
11
+
12
+ def has_roots
13
+ !@roots.empty?
14
+ end
15
+
16
+ def no_roots
17
+ @roots.empty?
18
+ end
19
+ end
20
+ end
21
+ end
@@ -19,6 +19,10 @@ module Precious
19
19
  def base_path
20
20
  @base_path
21
21
  end
22
+
23
+ def rtfm_root
24
+ @rtfm_root
25
+ end
22
26
  end
23
27
  end
24
28
  end
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: 41201
5
- prerelease: false
4
+ hash: 41207
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10301
9
- - 13
10
- version: 0.10301.13
9
+ - 14
10
+ version: 0.10301.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Bombadil
@@ -17,8 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-12-16 00:00:00 -08:00
21
- default_executable:
20
+ date: 2011-12-16 00:00:00 Z
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
23
  name: grit
@@ -227,6 +226,7 @@ files:
227
226
  - lib/gollum/committer.rb
228
227
  - lib/gollum/file.rb
229
228
  - lib/gollum/frontend/app.rb
229
+ - lib/gollum/frontend/indexapp.rb
230
230
  - lib/gollum/frontend/public/css/gollum.css
231
231
  - lib/gollum/frontend/public/css/ie7.css
232
232
  - lib/gollum/frontend/public/css/ronn.css
@@ -237,10 +237,12 @@ files:
237
237
  - lib/gollum/frontend/public/javascript/jquery.color.js
238
238
  - lib/gollum/frontend/public/javascript/jquery.js
239
239
  - lib/gollum/frontend/templates/error.mustache
240
+ - lib/gollum/frontend/templates/index.mustache
240
241
  - lib/gollum/frontend/templates/layout.mustache
241
242
  - lib/gollum/frontend/templates/page.mustache
242
243
  - lib/gollum/frontend/templates/pages.mustache
243
244
  - lib/gollum/frontend/views/error.rb
245
+ - lib/gollum/frontend/views/index.rb
244
246
  - lib/gollum/frontend/views/layout.rb
245
247
  - lib/gollum/frontend/views/page.rb
246
248
  - lib/gollum/frontend/views/pages.rb
@@ -250,7 +252,6 @@ files:
250
252
  - lib/gollum/pagination.rb
251
253
  - lib/gollum/sanitization.rb
252
254
  - lib/gollum/wiki.rb
253
- has_rdoc: true
254
255
  homepage: https://github.com/HeSYINUvSBZfxqA/RTFMd
255
256
  licenses: []
256
257
 
@@ -280,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
281
  requirements: []
281
282
 
282
283
  rubyforge_project:
283
- rubygems_version: 1.3.7
284
+ rubygems_version: 1.8.10
284
285
  signing_key:
285
286
  specification_version: 2
286
287
  summary: A simple, Markdown documentation helper.