bonsai 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/bin/bonsai +20 -16
- data/bonsai.gemspec +24 -5
- data/lib/bonsai/navigation.rb +1 -1
- data/lib/bonsai/page.rb +6 -7
- data/lib/bonsai/templates/content/1.varieties/1.fig/default.yml +3 -0
- data/lib/bonsai/templates/content/1.varieties/2.maple/default.yml +3 -0
- data/lib/bonsai/templates/content/1.varieties/products.yml +2 -0
- data/lib/bonsai/templates/content/2.cultivation/default.yml +3 -0
- data/lib/bonsai/templates/content/3.history/default.yml +3 -0
- data/lib/bonsai/templates/content/index/default.yml +2 -2
- data/lib/bonsai/templates/output/.htaccess +28 -0
- data/lib/bonsai/templates/output/docs/css/base.css +60 -0
- data/lib/bonsai/templates/output/robots.txt +2 -0
- data/lib/bonsai/templates/public/docs/css/base.css +60 -0
- data/lib/bonsai/templates/public/docs/css/base.less +44 -1
- data/lib/bonsai/templates/templates/default.mustache +5 -8
- data/lib/bonsai/templates/templates/products.mustache +18 -0
- data/lib/bonsai/templates/templates/shared/breadcrumbs.mustache +9 -0
- data/lib/bonsai/templates/templates/shared/footer.mustache +3 -0
- data/lib/bonsai/templates/templates/shared/head.mustache +8 -0
- data/lib/bonsai/templates/templates/shared/header.mustache +13 -0
- data/lib/bonsai/templates/templates/shared/nav.mustache +7 -0
- data/lib/bonsai/webserver/error.erb +10 -0
- data/lib/bonsai/webserver.rb +8 -1
- data/spec/bonsai/generate_spec.rb +4 -4
- data/spec/bonsai/navigation_spec.rb +6 -1
- data/spec/bonsai/page_spec.rb +2 -2
- metadata +38 -12
data/Rakefile
CHANGED
@@ -18,11 +18,12 @@ begin
|
|
18
18
|
gem.add_dependency "tilt", ">= 0.4"
|
19
19
|
gem.add_dependency "mustache", ">= 0.5.0"
|
20
20
|
gem.add_dependency "builder", ">= 2.1.2"
|
21
|
-
gem.add_dependency "thin", ">= 1.0.0"
|
22
21
|
gem.add_dependency "watch", ">= 0.1.0"
|
23
22
|
gem.add_dependency "sinatra", ">= 0.9.4"
|
24
23
|
gem.add_dependency "rdiscount", ">= 1.5.5"
|
25
24
|
gem.add_dependency "less", ">= 1.2.17"
|
25
|
+
gem.add_dependency "rack", ">= 1.1.0"
|
26
|
+
gem.add_dependency "launchy", ">= 0.3.3"
|
26
27
|
|
27
28
|
gem.post_install_message = %q{
|
28
29
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
data/bin/bonsai
CHANGED
@@ -23,28 +23,32 @@ opts = OptionParser.new do |opts|
|
|
23
23
|
end
|
24
24
|
|
25
25
|
opts.on("--cultivate", "run a local web server and process your files on save") do
|
26
|
-
|
26
|
+
begin
|
27
|
+
Bonsai.log banner
|
28
|
+
Bonsai.log "Press Control+C to quit"
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
require 'rack'
|
31
|
+
require 'sinatra'
|
32
|
+
require 'watch'
|
33
|
+
require 'launchy'
|
31
34
|
|
32
|
-
|
35
|
+
Bonsai.root_dir = Dir.pwd
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
server = fork {
|
38
|
+
app = Rack::Builder.app {
|
39
|
+
use Bonsai::StaticPassThrough, :root => Bonsai.root_dir + "/output", :urls => ["/"]
|
40
|
+
run Bonsai::DevelopmentServer
|
41
|
+
}
|
42
|
+
Rack::Handler.default.run(app, :Port => 5000) do
|
43
|
+
Launchy.open("http://localhost:5000/")
|
44
|
+
end
|
45
|
+
}
|
46
|
+
Watch.new("{content,templates,public}/**/*") { Bonsai::Exporter.process! }
|
47
|
+
rescue Interrupt
|
43
48
|
Process.kill("QUIT", server)
|
49
|
+
Process.wait(server)
|
44
50
|
exit
|
45
51
|
end
|
46
|
-
|
47
|
-
Watch.new("{content,templates,public}/**/*") { Bonsai::Exporter.process! }
|
48
52
|
end
|
49
53
|
|
50
54
|
opts.on("--repot", "export your site to #{Dir.pwd}/output") do
|
data/bonsai.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bonsai}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Schwarz"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-10}
|
13
13
|
s.default_executable = %q{bonsai}
|
14
14
|
s.description = %q{A static site generator that uses the best toolset available}
|
15
15
|
s.email = %q{ben.schwarz@gmail.com}
|
@@ -37,13 +37,29 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/bonsai/page.rb",
|
38
38
|
"lib/bonsai/sitemap.rb",
|
39
39
|
"lib/bonsai/template.rb",
|
40
|
+
"lib/bonsai/templates/content/1.varieties/1.fig/default.yml",
|
41
|
+
"lib/bonsai/templates/content/1.varieties/2.maple/default.yml",
|
42
|
+
"lib/bonsai/templates/content/1.varieties/products.yml",
|
43
|
+
"lib/bonsai/templates/content/2.cultivation/default.yml",
|
44
|
+
"lib/bonsai/templates/content/3.history/default.yml",
|
40
45
|
"lib/bonsai/templates/content/index/default.yml",
|
46
|
+
"lib/bonsai/templates/output/.htaccess",
|
47
|
+
"lib/bonsai/templates/output/docs/css/base.css",
|
48
|
+
"lib/bonsai/templates/output/robots.txt",
|
41
49
|
"lib/bonsai/templates/public/.htaccess",
|
50
|
+
"lib/bonsai/templates/public/docs/css/base.css",
|
42
51
|
"lib/bonsai/templates/public/docs/css/base.less",
|
43
52
|
"lib/bonsai/templates/public/robots.txt",
|
44
53
|
"lib/bonsai/templates/site.yml",
|
45
54
|
"lib/bonsai/templates/templates/default.mustache",
|
55
|
+
"lib/bonsai/templates/templates/products.mustache",
|
56
|
+
"lib/bonsai/templates/templates/shared/breadcrumbs.mustache",
|
57
|
+
"lib/bonsai/templates/templates/shared/footer.mustache",
|
58
|
+
"lib/bonsai/templates/templates/shared/head.mustache",
|
59
|
+
"lib/bonsai/templates/templates/shared/header.mustache",
|
60
|
+
"lib/bonsai/templates/templates/shared/nav.mustache",
|
46
61
|
"lib/bonsai/webserver.rb",
|
62
|
+
"lib/bonsai/webserver/error.erb",
|
47
63
|
"spec/bonsai/console_spec.rb",
|
48
64
|
"spec/bonsai/exporter_spec.rb",
|
49
65
|
"spec/bonsai/generate_spec.rb",
|
@@ -127,22 +143,24 @@ Gem::Specification.new do |s|
|
|
127
143
|
s.add_runtime_dependency(%q<tilt>, [">= 0.4"])
|
128
144
|
s.add_runtime_dependency(%q<mustache>, [">= 0.5.0"])
|
129
145
|
s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
|
130
|
-
s.add_runtime_dependency(%q<thin>, [">= 1.0.0"])
|
131
146
|
s.add_runtime_dependency(%q<watch>, [">= 0.1.0"])
|
132
147
|
s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
|
133
148
|
s.add_runtime_dependency(%q<rdiscount>, [">= 1.5.5"])
|
134
149
|
s.add_runtime_dependency(%q<less>, [">= 1.2.17"])
|
150
|
+
s.add_runtime_dependency(%q<rack>, [">= 1.1.0"])
|
151
|
+
s.add_runtime_dependency(%q<launchy>, [">= 0.3.3"])
|
135
152
|
else
|
136
153
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
137
154
|
s.add_dependency(%q<yard>, [">= 0"])
|
138
155
|
s.add_dependency(%q<tilt>, [">= 0.4"])
|
139
156
|
s.add_dependency(%q<mustache>, [">= 0.5.0"])
|
140
157
|
s.add_dependency(%q<builder>, [">= 2.1.2"])
|
141
|
-
s.add_dependency(%q<thin>, [">= 1.0.0"])
|
142
158
|
s.add_dependency(%q<watch>, [">= 0.1.0"])
|
143
159
|
s.add_dependency(%q<sinatra>, [">= 0.9.4"])
|
144
160
|
s.add_dependency(%q<rdiscount>, [">= 1.5.5"])
|
145
161
|
s.add_dependency(%q<less>, [">= 1.2.17"])
|
162
|
+
s.add_dependency(%q<rack>, [">= 1.1.0"])
|
163
|
+
s.add_dependency(%q<launchy>, [">= 0.3.3"])
|
146
164
|
end
|
147
165
|
else
|
148
166
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
@@ -150,11 +168,12 @@ Gem::Specification.new do |s|
|
|
150
168
|
s.add_dependency(%q<tilt>, [">= 0.4"])
|
151
169
|
s.add_dependency(%q<mustache>, [">= 0.5.0"])
|
152
170
|
s.add_dependency(%q<builder>, [">= 2.1.2"])
|
153
|
-
s.add_dependency(%q<thin>, [">= 1.0.0"])
|
154
171
|
s.add_dependency(%q<watch>, [">= 0.1.0"])
|
155
172
|
s.add_dependency(%q<sinatra>, [">= 0.9.4"])
|
156
173
|
s.add_dependency(%q<rdiscount>, [">= 1.5.5"])
|
157
174
|
s.add_dependency(%q<less>, [">= 1.2.17"])
|
175
|
+
s.add_dependency(%q<rack>, [">= 1.1.0"])
|
176
|
+
s.add_dependency(%q<launchy>, [">= 0.3.3"])
|
158
177
|
end
|
159
178
|
end
|
160
179
|
|
data/lib/bonsai/navigation.rb
CHANGED
data/lib/bonsai/page.rb
CHANGED
@@ -5,7 +5,6 @@ require 'tilt'
|
|
5
5
|
module Bonsai
|
6
6
|
class Page
|
7
7
|
class NotFound < StandardError; end;
|
8
|
-
class PropertyNotFound < StandardError; end
|
9
8
|
@@pages = {}
|
10
9
|
|
11
10
|
class << self
|
@@ -22,7 +21,7 @@ module Bonsai
|
|
22
21
|
|
23
22
|
private
|
24
23
|
def find!(permalink)
|
25
|
-
search_path = permalink.gsub(
|
24
|
+
search_path = permalink.gsub(/\//, "/*")
|
26
25
|
disk_path = Dir["#{path}/*#{search_path}/*.yml"]
|
27
26
|
if disk_path.any?
|
28
27
|
return new disk_path.first
|
@@ -104,7 +103,7 @@ module Bonsai
|
|
104
103
|
# Find pages up the permalink tree if possible
|
105
104
|
while(page_ref) do
|
106
105
|
page_ref = page_ref[/(.+)\/[^\/]*$/, 1]
|
107
|
-
ancestors << self.class.find(page_ref) rescue
|
106
|
+
ancestors << self.class.find(page_ref) rescue NotFound
|
108
107
|
end
|
109
108
|
|
110
109
|
ancestors.compact.reverse
|
@@ -121,7 +120,7 @@ module Bonsai
|
|
121
120
|
end
|
122
121
|
|
123
122
|
def content
|
124
|
-
YAML::load(File.read(
|
123
|
+
YAML::load(File.read(disk_path)) || {}
|
125
124
|
rescue ArgumentError
|
126
125
|
Bonsai.log "Page '#{permalink}' has badly formatted content"
|
127
126
|
end
|
@@ -181,15 +180,15 @@ module Bonsai
|
|
181
180
|
end
|
182
181
|
|
183
182
|
def directory
|
184
|
-
|
183
|
+
disk_path.split("/")[0..-2].join("/")
|
185
184
|
end
|
186
185
|
|
187
186
|
def template_name
|
188
|
-
File.basename(
|
187
|
+
File.basename(disk_path, '.*')
|
189
188
|
end
|
190
189
|
|
191
190
|
def web_path(path)
|
192
|
-
path.gsub(
|
191
|
+
path.gsub(@@path, '').gsub(/\/\d+\./, '/')
|
193
192
|
end
|
194
193
|
end
|
195
194
|
end
|
@@ -0,0 +1,3 @@
|
|
1
|
+
:headline: Tasty fruit!
|
2
|
+
:body: |
|
3
|
+
Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante. Maecenas tellus. Maecenas erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
|
@@ -0,0 +1,3 @@
|
|
1
|
+
:headline: Japanese maple
|
2
|
+
:body: |
|
3
|
+
Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante. Maecenas tellus. Maecenas erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
|
@@ -0,0 +1,3 @@
|
|
1
|
+
:headline: Cultivation techniques
|
2
|
+
:body: |
|
3
|
+
Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante. Maecenas tellus. Maecenas erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas
|
@@ -0,0 +1,3 @@
|
|
1
|
+
:headline: History of the Bonsai
|
2
|
+
:body: |
|
3
|
+
Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante. Maecenas tellus. Maecenas erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas
|
@@ -1,3 +1,3 @@
|
|
1
|
-
headline: Welcome to Bonsai
|
2
|
-
body: |
|
1
|
+
:headline: Welcome to Bonsai
|
2
|
+
:body: |
|
3
3
|
A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
DirectoryIndex index.html
|
2
|
+
FileETag All
|
3
|
+
|
4
|
+
# Compress all static assets
|
5
|
+
<IfModule mod_deflate.c>
|
6
|
+
# compress content with type html, text, and css
|
7
|
+
AddOutputFilterByType DEFLATE text/css text/html text/javascript application/javascript application/x-javascript text/js text/plain text/xml
|
8
|
+
|
9
|
+
<IfModule mod_headers.c>
|
10
|
+
# properly handle requests coming from behind proxies
|
11
|
+
Header append Vary User-Agent
|
12
|
+
</IfModule>
|
13
|
+
</IfModule>
|
14
|
+
|
15
|
+
# Cache, aggressively
|
16
|
+
<IfModule mod_expires.c>
|
17
|
+
ExpiresActive On
|
18
|
+
ExpiresDefault "access plus 10 days"
|
19
|
+
|
20
|
+
<FilesMatch "\.(eot|ttf|otf)$">
|
21
|
+
ExpiresDefault "access plus 10 years"
|
22
|
+
</filesMatch>
|
23
|
+
</IfModule>
|
24
|
+
|
25
|
+
# Mime-types
|
26
|
+
AddType application/vnd.ms-fontobject .eot
|
27
|
+
AddType font/ttf .ttf
|
28
|
+
AddType font/otf .otf
|
@@ -0,0 +1,60 @@
|
|
1
|
+
h1, h2, h3, h4, h5, h6, p, ol, ul {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
font-weight: normal;
|
5
|
+
}
|
6
|
+
header, section, article, footer, aside, nav { display: block; }
|
7
|
+
#wrapper {
|
8
|
+
margin: 0 auto;
|
9
|
+
width: 660px;
|
10
|
+
}
|
11
|
+
header {
|
12
|
+
position: relative;
|
13
|
+
margin-top: 5em;
|
14
|
+
}
|
15
|
+
header span { display: block; }
|
16
|
+
header #logo {
|
17
|
+
width: 145px;
|
18
|
+
height: 145px;
|
19
|
+
-moz-border-radius: 72px;
|
20
|
+
-webkit-border-radius: 72px;
|
21
|
+
border-radius: 72px;
|
22
|
+
background-color: black;
|
23
|
+
color: white;
|
24
|
+
position: relative;
|
25
|
+
margin: 0 auto;
|
26
|
+
}
|
27
|
+
header #logo a {
|
28
|
+
color: white;
|
29
|
+
text-decoration: none;
|
30
|
+
position: absolute;
|
31
|
+
margin: 1em 0 0 1.5em;
|
32
|
+
text-align: center;
|
33
|
+
text-transform: lowercase;
|
34
|
+
}
|
35
|
+
header #navigation {
|
36
|
+
margin: 5em 0;
|
37
|
+
text-transform: lowercase;
|
38
|
+
text-align: center;
|
39
|
+
font-style: italic;
|
40
|
+
font-size: 0.8em;
|
41
|
+
}
|
42
|
+
header #navigation li:not(:last-child):after { content: " /"; }
|
43
|
+
header #navigation a {
|
44
|
+
color: black;
|
45
|
+
text-decoration: none;
|
46
|
+
}
|
47
|
+
header #navigation a:hover { text-decoration: underline; }
|
48
|
+
nav li {
|
49
|
+
display: inline;
|
50
|
+
list-style-type: none;
|
51
|
+
}
|
52
|
+
#breadcrumbs, footer {
|
53
|
+
color: #666666;
|
54
|
+
font-size: 0.7em;
|
55
|
+
}
|
56
|
+
#breadcrumbs { margin: 3em 0 0 0; }
|
57
|
+
#breadcrumbs li:not(:last-child):after { content: " →"; }
|
58
|
+
#breadcrumbs a { color: inherit; }
|
59
|
+
nav, footer { margin: 1em 0; }
|
60
|
+
h1, h2, h3, h4, h5, h6 { margin: 1.25em 0; }
|
@@ -0,0 +1,60 @@
|
|
1
|
+
h1, h2, h3, h4, h5, h6, p, ol, ul {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
font-weight: normal;
|
5
|
+
}
|
6
|
+
header, section, article, footer, aside, nav { display: block; }
|
7
|
+
#wrapper {
|
8
|
+
margin: 0 auto;
|
9
|
+
width: 660px;
|
10
|
+
}
|
11
|
+
header {
|
12
|
+
position: relative;
|
13
|
+
margin-top: 5em;
|
14
|
+
}
|
15
|
+
header span { display: block; }
|
16
|
+
header #logo {
|
17
|
+
width: 145px;
|
18
|
+
height: 145px;
|
19
|
+
-moz-border-radius: 72px;
|
20
|
+
-webkit-border-radius: 72px;
|
21
|
+
border-radius: 72px;
|
22
|
+
background-color: black;
|
23
|
+
color: white;
|
24
|
+
position: relative;
|
25
|
+
margin: 0 auto;
|
26
|
+
}
|
27
|
+
header #logo a {
|
28
|
+
color: white;
|
29
|
+
text-decoration: none;
|
30
|
+
position: absolute;
|
31
|
+
margin: 1em 0 0 1.5em;
|
32
|
+
text-align: center;
|
33
|
+
text-transform: lowercase;
|
34
|
+
}
|
35
|
+
header #navigation {
|
36
|
+
margin: 5em 0;
|
37
|
+
text-transform: lowercase;
|
38
|
+
text-align: center;
|
39
|
+
font-style: italic;
|
40
|
+
font-size: 0.8em;
|
41
|
+
}
|
42
|
+
header #navigation li:not(:last-child):after { content: " /"; }
|
43
|
+
header #navigation a {
|
44
|
+
color: black;
|
45
|
+
text-decoration: none;
|
46
|
+
}
|
47
|
+
header #navigation a:hover { text-decoration: underline; }
|
48
|
+
nav li {
|
49
|
+
display: inline;
|
50
|
+
list-style-type: none;
|
51
|
+
}
|
52
|
+
#breadcrumbs, footer {
|
53
|
+
color: #666666;
|
54
|
+
font-size: 0.7em;
|
55
|
+
}
|
56
|
+
#breadcrumbs { margin: 3em 0 0 0; }
|
57
|
+
#breadcrumbs li:not(:last-child):after { content: " →"; }
|
58
|
+
#breadcrumbs a { color: inherit; }
|
59
|
+
nav, footer { margin: 1em 0; }
|
60
|
+
h1, h2, h3, h4, h5, h6 { margin: 1.25em 0; }
|
@@ -1 +1,44 @@
|
|
1
|
-
/*
|
1
|
+
/* HTML resets */
|
2
|
+
h1, h2, h3, h4, h5, h6, p, ol, ul { margin: 0; padding: 0; font-weight: normal; }
|
3
|
+
|
4
|
+
/* HTML5 block elements */
|
5
|
+
header, section, article, footer, aside, nav { display: block; }
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
/* Put your styles here */
|
12
|
+
#wrapper { margin: 0 auto; width: 660px; }
|
13
|
+
|
14
|
+
header {
|
15
|
+
position: relative; margin-top: 5em;
|
16
|
+
|
17
|
+
span { display: block; }
|
18
|
+
|
19
|
+
#logo {
|
20
|
+
width: 145px; height: 145px; -moz-border-radius: 72px; -webkit-border-radius: 72px; border-radius: 72px; background-color: black; color: white; position: relative; margin: 0 auto;
|
21
|
+
a { color: white; text-decoration: none; position: absolute; margin: 1em 0 0 1.5em; text-align: center; text-transform: lowercase; }
|
22
|
+
}
|
23
|
+
|
24
|
+
#navigation {
|
25
|
+
margin: 5em 0; text-transform: lowercase; text-align: center; font-style: italic; font-size: 0.8em;
|
26
|
+
|
27
|
+
li:not(:last-child):after { content: " /"; }
|
28
|
+
a { color: black; text-decoration: none; }
|
29
|
+
a:hover { text-decoration: underline; }
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
nav li { display: inline; list-style-type: none; }
|
34
|
+
|
35
|
+
#breadcrumbs, footer { color: #666; font-size: 0.7em; }
|
36
|
+
|
37
|
+
#breadcrumbs {
|
38
|
+
margin: 3em 0 0 0;
|
39
|
+
li:not(:last-child):after { content: " →"; }
|
40
|
+
a { color: inherit; }
|
41
|
+
}
|
42
|
+
|
43
|
+
nav, footer { margin: 1em 0; }
|
44
|
+
h1, h2, h3, h4, h5, h6 { margin: 1.25em 0; }
|
@@ -1,14 +1,11 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
|
-
|
4
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
5
|
-
<title>{{name}}</title>
|
6
|
-
<link rel="stylesheet" href="/css/base.css" type="text/css">
|
7
|
-
</head>
|
3
|
+
{{> shared/head}}
|
8
4
|
<body id="{{slug}}" class="default">
|
9
|
-
<
|
10
|
-
|
5
|
+
<section id="wrapper">
|
6
|
+
{{> shared/header}}
|
11
7
|
{{{body}}}
|
12
|
-
|
8
|
+
{{> shared/footer}}
|
9
|
+
</section>
|
13
10
|
</body>
|
14
11
|
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
{{> shared/head}}
|
4
|
+
<body id="{{slug}}" class="default">
|
5
|
+
<section id="wrapper">
|
6
|
+
{{> shared/header}}
|
7
|
+
|
8
|
+
<ul id="sub-navigation">
|
9
|
+
{{# children}}
|
10
|
+
<li><a href="{{permalink}}">{{name}}</a></li>
|
11
|
+
{{/ children}}
|
12
|
+
</ul>
|
13
|
+
{{{body}}}
|
14
|
+
|
15
|
+
{{> shared/footer}}
|
16
|
+
</section>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<head>
|
2
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
3
|
+
<title>{{headline}}</title>
|
4
|
+
<link rel="stylesheet" href="/docs/css/base.css" type="text/css">
|
5
|
+
<!--[if IE]>
|
6
|
+
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
7
|
+
<![endif]-->
|
8
|
+
</head>
|
data/lib/bonsai/webserver.rb
CHANGED
@@ -8,12 +8,19 @@ module Bonsai
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class DevelopmentServer < Sinatra::Base
|
11
|
+
set :views, "#{File.dirname(__FILE__)}/webserver"
|
12
|
+
|
11
13
|
get '/' do
|
12
14
|
Page.find("index").render
|
13
15
|
end
|
14
16
|
|
15
17
|
get '/*' do
|
16
|
-
|
18
|
+
begin
|
19
|
+
Page.find(params[:splat].to_s).render
|
20
|
+
rescue Bonsai::Page::NotFound => e
|
21
|
+
@error = e.message
|
22
|
+
erb :error
|
23
|
+
end
|
17
24
|
end
|
18
25
|
end
|
19
26
|
end
|
@@ -37,12 +37,12 @@ describe Bonsai::Generate do
|
|
37
37
|
File.exists?("#{@path}/site.yml").should be_true
|
38
38
|
end
|
39
39
|
|
40
|
-
it "should generate
|
41
|
-
Dir.glob("#{@path}/**/*", File::FNM_DOTMATCH).select{|f| File.file?(f) }.size.should ==
|
40
|
+
it "should generate 21 files" do
|
41
|
+
Dir.glob("#{@path}/**/*", File::FNM_DOTMATCH).select{|f| File.file?(f) }.size.should == 21
|
42
42
|
end
|
43
43
|
|
44
|
-
it "should generate
|
45
|
-
Dir.glob("#{@path}/**/*").select{|f| File.directory?(f) }.size.should ==
|
44
|
+
it "should generate 16 directories" do
|
45
|
+
Dir.glob("#{@path}/**/*").select{|f| File.directory?(f) }.size.should == 16
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -7,11 +7,12 @@ describe Bonsai::Navigation do
|
|
7
7
|
|
8
8
|
before do
|
9
9
|
@tree = Bonsai::Navigation.tree
|
10
|
+
@index = Bonsai::Page.find("index")
|
10
11
|
@about = Bonsai::Page.find("about-us")
|
11
12
|
@products = Bonsai::Page.find("products")
|
12
13
|
end
|
13
14
|
|
14
|
-
it "should contain
|
15
|
+
it "should contain 3 items" do
|
15
16
|
@tree.should be_an_instance_of(Array)
|
16
17
|
@tree.size.should == 3
|
17
18
|
end
|
@@ -21,6 +22,10 @@ describe Bonsai::Navigation do
|
|
21
22
|
@tree.should include @products
|
22
23
|
end
|
23
24
|
|
25
|
+
it "should not contain index" do
|
26
|
+
@tree.should_not include @index
|
27
|
+
end
|
28
|
+
|
24
29
|
it "should be ordered" do
|
25
30
|
@tree.first.should == @about
|
26
31
|
@tree.last.should == @products
|
data/spec/bonsai/page_spec.rb
CHANGED
@@ -25,7 +25,7 @@ describe Bonsai::Page do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should have a permalink" do
|
28
|
-
@page.permalink.should == "/about-us/history"
|
28
|
+
@page.permalink.should == "/about-us/history/"
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should have a ctime" do
|
@@ -38,7 +38,7 @@ describe Bonsai::Page do
|
|
38
38
|
@page.mtime.should be_an_instance_of(Time)
|
39
39
|
end
|
40
40
|
it "should remove numbers over 10 from the permalink" do
|
41
|
-
Bonsai::Page.find("many-pages").permalink.should == "/many-pages"
|
41
|
+
Bonsai::Page.find("many-pages").permalink.should == "/many-pages/"
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should have a write_path" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bonsai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Schwarz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-10 00:00:00 +11:00
|
13
13
|
default_executable: bonsai
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -62,16 +62,6 @@ dependencies:
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 2.1.2
|
64
64
|
version:
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: thin
|
67
|
-
type: :runtime
|
68
|
-
version_requirement:
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: 1.0.0
|
74
|
-
version:
|
75
65
|
- !ruby/object:Gem::Dependency
|
76
66
|
name: watch
|
77
67
|
type: :runtime
|
@@ -112,6 +102,26 @@ dependencies:
|
|
112
102
|
- !ruby/object:Gem::Version
|
113
103
|
version: 1.2.17
|
114
104
|
version:
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: rack
|
107
|
+
type: :runtime
|
108
|
+
version_requirement:
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 1.1.0
|
114
|
+
version:
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: launchy
|
117
|
+
type: :runtime
|
118
|
+
version_requirement:
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.3.3
|
124
|
+
version:
|
115
125
|
description: A static site generator that uses the best toolset available
|
116
126
|
email: ben.schwarz@gmail.com
|
117
127
|
executables:
|
@@ -140,13 +150,29 @@ files:
|
|
140
150
|
- lib/bonsai/page.rb
|
141
151
|
- lib/bonsai/sitemap.rb
|
142
152
|
- lib/bonsai/template.rb
|
153
|
+
- lib/bonsai/templates/content/1.varieties/1.fig/default.yml
|
154
|
+
- lib/bonsai/templates/content/1.varieties/2.maple/default.yml
|
155
|
+
- lib/bonsai/templates/content/1.varieties/products.yml
|
156
|
+
- lib/bonsai/templates/content/2.cultivation/default.yml
|
157
|
+
- lib/bonsai/templates/content/3.history/default.yml
|
143
158
|
- lib/bonsai/templates/content/index/default.yml
|
159
|
+
- lib/bonsai/templates/output/.htaccess
|
160
|
+
- lib/bonsai/templates/output/docs/css/base.css
|
161
|
+
- lib/bonsai/templates/output/robots.txt
|
144
162
|
- lib/bonsai/templates/public/.htaccess
|
163
|
+
- lib/bonsai/templates/public/docs/css/base.css
|
145
164
|
- lib/bonsai/templates/public/docs/css/base.less
|
146
165
|
- lib/bonsai/templates/public/robots.txt
|
147
166
|
- lib/bonsai/templates/site.yml
|
148
167
|
- lib/bonsai/templates/templates/default.mustache
|
168
|
+
- lib/bonsai/templates/templates/products.mustache
|
169
|
+
- lib/bonsai/templates/templates/shared/breadcrumbs.mustache
|
170
|
+
- lib/bonsai/templates/templates/shared/footer.mustache
|
171
|
+
- lib/bonsai/templates/templates/shared/head.mustache
|
172
|
+
- lib/bonsai/templates/templates/shared/header.mustache
|
173
|
+
- lib/bonsai/templates/templates/shared/nav.mustache
|
149
174
|
- lib/bonsai/webserver.rb
|
175
|
+
- lib/bonsai/webserver/error.erb
|
150
176
|
- spec/bonsai/console_spec.rb
|
151
177
|
- spec/bonsai/exporter_spec.rb
|
152
178
|
- spec/bonsai/generate_spec.rb
|