gollum-site 0.0.1 → 0.0.2
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.
- data/README.md +12 -1
- data/bin/gollum-site +4 -4
- data/lib/gollum-site/site.rb +3 -1
- data/lib/gollum-site/version.rb +1 -1
- data/test/test_site.rb +19 -0
- metadata +3 -3
data/README.md
CHANGED
|
@@ -7,7 +7,9 @@ Generates a static site from a Gollum Wiki.
|
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The easiest way to install gollum-site is with RubyGems:
|
|
11
|
+
|
|
12
|
+
$ [sudo] gem install gollum-site
|
|
11
13
|
|
|
12
14
|
## Usage
|
|
13
15
|
|
|
@@ -42,6 +44,15 @@ generation with the following data made available to it:
|
|
|
42
44
|
* `page.author` The author of the last edit
|
|
43
45
|
* `page.date` The date of the last edit
|
|
44
46
|
|
|
47
|
+
## Default Layout
|
|
48
|
+
|
|
49
|
+
A default layout is applied to the root folder for wikis that do not define a
|
|
50
|
+
root layout. The default layout is the same used in gollum without the edit
|
|
51
|
+
features. It's possible to generate a site without the default template using
|
|
52
|
+
the "--no_default_layout" option:
|
|
53
|
+
|
|
54
|
+
$ gollum-site --no_default_layout generate
|
|
55
|
+
|
|
45
56
|
## Example
|
|
46
57
|
|
|
47
58
|
To see gollum-site in action, let's use it to generate a static site from a
|
data/bin/gollum-site
CHANGED
|
@@ -25,7 +25,7 @@ options = {
|
|
|
25
25
|
'base_path' => '/',
|
|
26
26
|
'output_path' => '_site',
|
|
27
27
|
'port' => 8000,
|
|
28
|
-
'
|
|
28
|
+
'default_layout' => true
|
|
29
29
|
}
|
|
30
30
|
opts = OptionParser.new do |opts|
|
|
31
31
|
opts.banner = help
|
|
@@ -46,8 +46,8 @@ opts = OptionParser.new do |opts|
|
|
|
46
46
|
options['port'] = port
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
opts.on("--
|
|
50
|
-
options['
|
|
49
|
+
opts.on("--no_default_layout", "Don't include a default layout") do |default_layout|
|
|
50
|
+
options['default_layout'] = !default_layout
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
opts.on_tail("--help", "Show this information") do
|
|
@@ -71,7 +71,7 @@ when 'generate'
|
|
|
71
71
|
wiki = Gollum::Wiki.new('.', {:base_path => options['base_path']})
|
|
72
72
|
site = Gollum::Site.new(wiki, {
|
|
73
73
|
:output_path => options['output_path'],
|
|
74
|
-
:include_default_layout => options['
|
|
74
|
+
:include_default_layout => options['default_layout']})
|
|
75
75
|
site.generate(options['ref'])
|
|
76
76
|
when 'serve'
|
|
77
77
|
require 'webrick'
|
data/lib/gollum-site/site.rb
CHANGED
|
@@ -5,7 +5,9 @@ module Gollum
|
|
|
5
5
|
def initialize(wiki, options = {})
|
|
6
6
|
@wiki = wiki
|
|
7
7
|
@output_path = options[:output_path] || "_site"
|
|
8
|
-
@include_default_layout = options[:include_default_layout]
|
|
8
|
+
if (@include_default_layout = options[:include_default_layout]).nil?
|
|
9
|
+
@include_default_layout = true
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
# Public: generate a static site
|
data/lib/gollum-site/version.rb
CHANGED
data/test/test_site.rb
CHANGED
|
@@ -55,3 +55,22 @@ context "Site inherits default layout" do
|
|
|
55
55
|
FileUtils.rm_r(@site.output_path)
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
|
+
|
|
59
|
+
context "Site does not inherit default layout" do
|
|
60
|
+
setup do
|
|
61
|
+
@wiki = Gollum::Wiki.new(testpath("examples/test_site_no_layout.git"))
|
|
62
|
+
@site = Gollum::Site.new(@wiki,
|
|
63
|
+
{:output_path => testpath("examples/site"),
|
|
64
|
+
:include_default_layout => false})
|
|
65
|
+
@site.generate("master")
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
test "check that default layout is used" do
|
|
69
|
+
assert !File.exists?(File.join(@site.output_path, "css"))
|
|
70
|
+
assert !File.exists?(File.join(@site.output_path, "javascript"))
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
teardown do
|
|
74
|
+
FileUtils.rm_r(@site.output_path)
|
|
75
|
+
end
|
|
76
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gollum-site
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 27
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.0.2
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Daniel Reverri
|