giraffesoft-webby 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +218 -0
- data/README.rdoc +92 -0
- data/Rakefile +62 -0
- data/bin/webby +41 -0
- data/bin/webby-gen +41 -0
- data/examples/blog/Sitefile +7 -0
- data/examples/blog/tasks/blog.rake +72 -0
- data/examples/blog/templates/atom_feed.erb +40 -0
- data/examples/blog/templates/blog/month.erb +22 -0
- data/examples/blog/templates/blog/post.erb +16 -0
- data/examples/blog/templates/blog/year.erb +22 -0
- data/examples/presentation/Sitefile +10 -0
- data/examples/presentation/content/css/uv/twilight.css +137 -0
- data/examples/presentation/content/presentation/_sample_code.txt +10 -0
- data/examples/presentation/content/presentation/index.txt +63 -0
- data/examples/presentation/content/presentation/s5/blank.gif +0 -0
- data/examples/presentation/content/presentation/s5/bodybg.gif +0 -0
- data/examples/presentation/content/presentation/s5/framing.css +23 -0
- data/examples/presentation/content/presentation/s5/iepngfix.htc +42 -0
- data/examples/presentation/content/presentation/s5/opera.css +7 -0
- data/examples/presentation/content/presentation/s5/outline.css +15 -0
- data/examples/presentation/content/presentation/s5/pretty.css +86 -0
- data/examples/presentation/content/presentation/s5/print.css +25 -0
- data/examples/presentation/content/presentation/s5/s5-core.css +9 -0
- data/examples/presentation/content/presentation/s5/slides.css +3 -0
- data/examples/presentation/content/presentation/s5/slides.js +553 -0
- data/examples/presentation/layouts/presentation.txt +43 -0
- data/examples/presentation/templates/_code_partial.erb +13 -0
- data/examples/presentation/templates/presentation.erb +40 -0
- data/examples/tumblog/Sitefile +9 -0
- data/examples/tumblog/content/css/tumblog.css +308 -0
- data/examples/tumblog/content/images/tumblog/permalink.gif +0 -0
- data/examples/tumblog/content/images/tumblog/rss.gif +0 -0
- data/examples/tumblog/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
- data/examples/tumblog/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
- data/examples/tumblog/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
- data/examples/tumblog/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
- data/examples/tumblog/content/tumblog/200807/up-a-tree/index.txt +13 -0
- data/examples/tumblog/content/tumblog/index.txt +37 -0
- data/examples/tumblog/content/tumblog/rss.txt +37 -0
- data/examples/tumblog/layouts/tumblog/default.txt +44 -0
- data/examples/tumblog/layouts/tumblog/post.txt +15 -0
- data/examples/tumblog/lib/tumblog_helper.rb +32 -0
- data/examples/tumblog/tasks/tumblog.rake +30 -0
- data/examples/tumblog/templates/atom_feed.erb +40 -0
- data/examples/tumblog/templates/tumblog/conversation.erb +12 -0
- data/examples/tumblog/templates/tumblog/link.erb +10 -0
- data/examples/tumblog/templates/tumblog/photo.erb +13 -0
- data/examples/tumblog/templates/tumblog/post.erb +12 -0
- data/examples/tumblog/templates/tumblog/quote.erb +11 -0
- data/examples/webby/Sitefile +19 -0
- data/examples/webby/content/communicate/index.txt +28 -0
- data/examples/webby/content/css/background.gif +0 -0
- data/examples/webby/content/css/blueprint/print.css +76 -0
- data/examples/webby/content/css/blueprint/screen.css +696 -0
- data/examples/webby/content/css/coderay.css +96 -0
- data/examples/webby/content/css/site.css +196 -0
- data/examples/webby/content/css/uv/twilight.css +137 -0
- data/examples/webby/content/index.txt +37 -0
- data/examples/webby/content/learn/index.txt +28 -0
- data/examples/webby/content/reference/index.txt +204 -0
- data/examples/webby/content/release-notes/index.txt +21 -0
- data/examples/webby/content/release-notes/rel-0-9-0/index.txt +74 -0
- data/examples/webby/content/release-notes/rel-0-9-1/index.txt +93 -0
- data/examples/webby/content/release-notes/rel-0-9-2/index.txt +14 -0
- data/examples/webby/content/release-notes/rel-0-9-3/index.txt +47 -0
- data/examples/webby/content/robots.txt +6 -0
- data/examples/webby/content/script/jquery.corner.js +152 -0
- data/examples/webby/content/script/jquery.js +31 -0
- data/examples/webby/content/sitemap.txt +31 -0
- data/examples/webby/content/tips_and_tricks/index.txt +97 -0
- data/examples/webby/content/tutorial/index.txt +135 -0
- data/examples/webby/content/user-manual/index.txt +419 -0
- data/examples/webby/layouts/default.txt +49 -0
- data/examples/webby/templates/page.erb +10 -0
- data/examples/website/Sitefile +7 -0
- data/examples/website/content/css/blueprint/ie.css +26 -0
- data/examples/website/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/examples/website/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
- data/examples/website/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/examples/website/content/css/blueprint/plugins/buttons/readme.txt +32 -0
- data/examples/website/content/css/blueprint/plugins/buttons/screen.css +97 -0
- data/examples/website/content/css/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/examples/website/content/css/blueprint/plugins/fancy-type/screen.css +71 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/readme.txt +18 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/screen.css +40 -0
- data/examples/website/content/css/blueprint/plugins/rtl/readme.txt +10 -0
- data/examples/website/content/css/blueprint/plugins/rtl/screen.css +109 -0
- data/examples/website/content/css/blueprint/print.css +30 -0
- data/examples/website/content/css/blueprint/screen.css +251 -0
- data/examples/website/content/css/blueprint/src/forms.css +49 -0
- data/examples/website/content/css/blueprint/src/grid.css +212 -0
- data/examples/website/content/css/blueprint/src/grid.png +0 -0
- data/examples/website/content/css/blueprint/src/ie.css +59 -0
- data/examples/website/content/css/blueprint/src/print.css +85 -0
- data/examples/website/content/css/blueprint/src/reset.css +38 -0
- data/examples/website/content/css/blueprint/src/typography.css +105 -0
- data/examples/website/content/css/coderay.css +111 -0
- data/examples/website/content/css/site.css +67 -0
- data/examples/website/content/index.txt +19 -0
- data/examples/website/layouts/default.txt +61 -0
- data/examples/website/lib/breadcrumbs.rb +28 -0
- data/examples/website/templates/_partial.erb +10 -0
- data/examples/website/templates/page.erb +18 -0
- data/lib/webby.rb +233 -0
- data/lib/webby/apps.rb +12 -0
- data/lib/webby/apps/generator.rb +276 -0
- data/lib/webby/apps/main.rb +258 -0
- data/lib/webby/auto_builder.rb +157 -0
- data/lib/webby/builder.rb +172 -0
- data/lib/webby/core_ext/enumerable.rb +11 -0
- data/lib/webby/core_ext/hash.rb +28 -0
- data/lib/webby/core_ext/kernel.rb +26 -0
- data/lib/webby/core_ext/string.rb +163 -0
- data/lib/webby/core_ext/time.rb +9 -0
- data/lib/webby/filters.rb +85 -0
- data/lib/webby/filters/basepath.rb +97 -0
- data/lib/webby/filters/erb.rb +9 -0
- data/lib/webby/filters/haml.rb +18 -0
- data/lib/webby/filters/markdown.rb +16 -0
- data/lib/webby/filters/maruku.rb +16 -0
- data/lib/webby/filters/outline.rb +309 -0
- data/lib/webby/filters/sass.rb +17 -0
- data/lib/webby/filters/slides.rb +56 -0
- data/lib/webby/filters/textile.rb +16 -0
- data/lib/webby/filters/tidy.rb +76 -0
- data/lib/webby/filters/wiki_words.rb +14 -0
- data/lib/webby/helpers.rb +30 -0
- data/lib/webby/helpers/capture_helper.rb +141 -0
- data/lib/webby/helpers/coderay_helper.rb +69 -0
- data/lib/webby/helpers/graphviz_helper.rb +136 -0
- data/lib/webby/helpers/tag_helper.rb +65 -0
- data/lib/webby/helpers/tex_img_helper.rb +133 -0
- data/lib/webby/helpers/ultraviolet_helper.rb +63 -0
- data/lib/webby/helpers/url_helper.rb +241 -0
- data/lib/webby/journal.rb +126 -0
- data/lib/webby/link_validator.rb +160 -0
- data/lib/webby/renderer.rb +389 -0
- data/lib/webby/resources.rb +137 -0
- data/lib/webby/resources/db.rb +251 -0
- data/lib/webby/resources/layout.rb +54 -0
- data/lib/webby/resources/meta_file.rb +211 -0
- data/lib/webby/resources/page.rb +81 -0
- data/lib/webby/resources/partial.rb +85 -0
- data/lib/webby/resources/resource.rb +201 -0
- data/lib/webby/resources/static.rb +36 -0
- data/lib/webby/stelan/mktemp.rb +135 -0
- data/lib/webby/stelan/paginator.rb +165 -0
- data/lib/webby/tasks/build.rake +27 -0
- data/lib/webby/tasks/create.rake +25 -0
- data/lib/webby/tasks/deploy.rake +22 -0
- data/lib/webby/tasks/growl.rake +16 -0
- data/lib/webby/tasks/validate.rake +19 -0
- data/spec/core_ext/hash_spec.rb +47 -0
- data/spec/core_ext/string_spec.rb +110 -0
- data/spec/core_ext/time_spec.rb +19 -0
- data/spec/data/hooligans/bad_meta_data_1.txt +34 -0
- data/spec/data/hooligans/bad_meta_data_2.txt +34 -0
- data/spec/data/html/anchor.html +11 -0
- data/spec/data/html/external.html +10 -0
- data/spec/data/html/invalid-relative.html +10 -0
- data/spec/data/html/relative-anchor.html +10 -0
- data/spec/data/html/relative-invalid-anchor.html +10 -0
- data/spec/data/html/relative.html +10 -0
- data/spec/data/outline/basic.out +81 -0
- data/spec/data/outline/basic.txt +25 -0
- data/spec/data/outline/no_clobber.out +86 -0
- data/spec/data/outline/numbering.out +81 -0
- data/spec/data/outline/numbering_only.out +21 -0
- data/spec/data/outline/toc_range_1.out +66 -0
- data/spec/data/outline/toc_range_2.out +55 -0
- data/spec/data/outline/toc_style.out +81 -0
- data/spec/data/site/Sitefile +9 -0
- data/spec/data/site/content/_partial.txt +10 -0
- data/spec/data/site/content/css/coderay.css +111 -0
- data/spec/data/site/content/css/site.css +67 -0
- data/spec/data/site/content/css/tumblog.css +308 -0
- data/spec/data/site/content/images/tumblog/permalink.gif +0 -0
- data/spec/data/site/content/images/tumblog/rss.gif +0 -0
- data/spec/data/site/content/index.txt +19 -0
- data/spec/data/site/content/photos.txt +21 -0
- data/spec/data/site/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
- data/spec/data/site/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
- data/spec/data/site/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
- data/spec/data/site/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
- data/spec/data/site/content/tumblog/200807/up-a-tree/index.txt +13 -0
- data/spec/data/site/content/tumblog/index.txt +37 -0
- data/spec/data/site/content/tumblog/rss.txt +37 -0
- data/spec/data/site/layouts/default.txt +58 -0
- data/spec/data/site/layouts/tumblog/default.txt +44 -0
- data/spec/data/site/layouts/tumblog/post.txt +15 -0
- data/spec/data/site/lib/breadcrumbs.rb +28 -0
- data/spec/data/site/lib/tumblog_helper.rb +32 -0
- data/spec/data/site/tasks/tumblog.rake +30 -0
- data/spec/data/site/templates/_partial.erb +10 -0
- data/spec/data/site/templates/atom_feed.erb +40 -0
- data/spec/data/site/templates/page.erb +18 -0
- data/spec/data/site/templates/presentation.erb +40 -0
- data/spec/data/site/templates/tumblog/conversation.erb +12 -0
- data/spec/data/site/templates/tumblog/link.erb +10 -0
- data/spec/data/site/templates/tumblog/photo.erb +13 -0
- data/spec/data/site/templates/tumblog/post.erb +12 -0
- data/spec/data/site/templates/tumblog/quote.erb +11 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +58 -0
- data/spec/webby/apps/generator_spec.rb +117 -0
- data/spec/webby/apps/main_spec.rb +88 -0
- data/spec/webby/filters/basepath_spec.rb +167 -0
- data/spec/webby/filters/maruku_spec.rb +31 -0
- data/spec/webby/filters/outline_spec.rb +92 -0
- data/spec/webby/filters/textile_spec.rb +31 -0
- data/spec/webby/helpers/capture_helper_spec.rb +56 -0
- data/spec/webby/link_validator_spec.rb +154 -0
- data/spec/webby/renderer_spec.rb +139 -0
- data/spec/webby/resources/db_spec.rb +250 -0
- data/spec/webby/resources/layout_spec.rb +83 -0
- data/spec/webby/resources/meta_file_spec.rb +171 -0
- data/spec/webby/resources/page_spec.rb +111 -0
- data/spec/webby/resources/partial_spec.rb +58 -0
- data/spec/webby/resources/resource_spec.rb +219 -0
- data/spec/webby/resources/static_spec.rb +49 -0
- data/spec/webby/resources_spec.rb +69 -0
- data/tasks/mswin32.rake +38 -0
- data/tasks/website.rake +37 -0
- metadata +372 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
title: <%= title %>
|
3
|
+
created_at: <%= Time.now.to_y %>
|
4
|
+
filter:
|
5
|
+
- erb
|
6
|
+
- textile
|
7
|
+
---
|
8
|
+
p(title). <%%= h(@page.title) %>
|
9
|
+
|
10
|
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est eu lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at metus.
|
11
|
+
|
12
|
+
h2. Litora Sociis
|
13
|
+
|
14
|
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi et risus. Aliquam nisl. Nulla facilisi. Cras accumsan vestibulum ante. Vestibulum sed tortor. Praesent tempus fringilla elit. Ut elit diam, sagittis in, nonummy in, gravida non, nunc. Ut orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam egestas, orci eu imperdiet malesuada, nisl purus fringilla odio, quis commodo est orci vitae justo. Aliquam placerat odio tincidunt nulla. Cras in libero. Aenean rutrum, magna non tristique posuere, erat odio eleifend nisl, non convallis est tortor blandit ligula. Nulla id augue.
|
15
|
+
|
16
|
+
bq. Nullam mattis, odio ut tempus facilisis, metus nisl facilisis metus, auctor consectetuer felis ligula nec mauris. Vestibulum odio erat, fermentum at, commodo vitae, ultrices et, urna. Mauris vulputate, mi pulvinar sagittis condimentum, sem nulla aliquam velit, sed imperdiet mi purus eu magna. Nulla varius metus ut eros. Aenean aliquet magna eget orci. Class aptent taciti sociosqu ad litora.
|
17
|
+
|
18
|
+
Vivamus euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse vel nibh ut turpis dictum sagittis. Aliquam vel velit a elit auctor sollicitudin. Nam vel dui vel neque lacinia pretium. Quisque nunc erat, venenatis id, volutpat ut, scelerisque sed, diam. Mauris ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec mattis. Morbi dignissim sollicitudin libero. Nulla lorem.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
title: <%= title %>
|
3
|
+
created_at: <%= Time.now.to_y %>
|
4
|
+
author: You
|
5
|
+
company: Company
|
6
|
+
copyright: Creative Commons
|
7
|
+
filter:
|
8
|
+
- erb
|
9
|
+
- textile
|
10
|
+
- slides
|
11
|
+
layout: presentation
|
12
|
+
---
|
13
|
+
h1. Presentation Title
|
14
|
+
|
15
|
+
Clever introductory text that will grab the audience's attention.
|
16
|
+
|
17
|
+
|
18
|
+
h1. Title of the First Slide
|
19
|
+
|
20
|
+
A little more build up before really getting into the meat of it.
|
21
|
+
|
22
|
+
|
23
|
+
h1. Title of the Second Slide
|
24
|
+
|
25
|
+
Finally, some code!
|
26
|
+
|
27
|
+
<%% uv :lang => 'ruby', :line_numbers => false do -%>
|
28
|
+
class EnglishMajor
|
29
|
+
def supercilious
|
30
|
+
'behaving or looking as though one thinks one is superior to others'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
<%% end -%>
|
34
|
+
|
35
|
+
|
36
|
+
h1. The Final Slide
|
37
|
+
|
38
|
+
And that about sums it up!
|
39
|
+
|
40
|
+
Thanks for visiting
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
title: <%= title %>
|
3
|
+
created_at: <%= Time.now.to_y %>
|
4
|
+
author: Your Name
|
5
|
+
filter:
|
6
|
+
- textile
|
7
|
+
layout: tumblog/post
|
8
|
+
tumblog_type: conversation
|
9
|
+
---
|
10
|
+
* %(label)me :% Why did the chicken cross the road?
|
11
|
+
* %(label)Buddha :% If you ask this question, you deny your own chicken nature.
|
12
|
+
* %(label)Darwin :% Chickens, over great periods of time, have been naturally selected in such a way that they are now genetically predisposed to cross roads.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
title: <%= title %>
|
3
|
+
created_at: <%= Time.now.to_y %>
|
4
|
+
author: Your Name
|
5
|
+
filter:
|
6
|
+
- erb
|
7
|
+
- textile
|
8
|
+
layout: tumblog/post
|
9
|
+
tumblog_type: photo
|
10
|
+
---
|
11
|
+
!http://www.madcitychickens.com/images/bttrcups_tree.jpg(<%%= h(@page.title) %>)!
|
12
|
+
|
13
|
+
p(caption). via "Mad City Chickens":http://www.madcitychickens.com/
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
title: <%= title %>
|
3
|
+
created_at: <%= Time.now.to_y %>
|
4
|
+
author: Your Name
|
5
|
+
filter:
|
6
|
+
- textile
|
7
|
+
layout: tumblog/post
|
8
|
+
tumblog_type: regular
|
9
|
+
---
|
10
|
+
The *chicken* (_Gallus gallus_, sometimes _G. gallus domesticus_) is a domesticated fowl likely descended from the wild Indian and southeast Asian Red Junglefowl (_Gallus gallus_) and the related Grey Junglefowl (_G. sonneratii_). Traditionally it has been widely accepted that the chicken was descended solely from the former, as hybrids of both wild types tended toward sterility; but recent genetic work has revealed that the genotype for yellow skin present in the domestic fowl is not present in what is otherwise its closest kin, the Red Junglefowl. It is deemed most likely, then, that the yellow skin trait in domestic birds originated in the Grey Junglefowl.
|
11
|
+
|
12
|
+
The chicken is one of the most common and widespread domestic animals. With a population of more than 24 billion in 2003, there are more chickens in the world than any other bird. Humans keep chickens primarily as a source of food, with both their meat and their eggs consumed.
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Equivalent to a header guard in C/C++
|
2
|
+
# Used to prevent the spec helper from being loaded more than once
|
3
|
+
unless defined? WEBBY_SPEC_HELPER
|
4
|
+
WEBBY_SPEC_HELPER = true
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'stringio'
|
9
|
+
|
10
|
+
begin
|
11
|
+
require 'fake_web'
|
12
|
+
$test_externals = true
|
13
|
+
rescue LoadError
|
14
|
+
$test_externals = false
|
15
|
+
end
|
16
|
+
|
17
|
+
require File.expand_path(
|
18
|
+
File.join(File.dirname(__FILE__), %w[.. lib webby]))
|
19
|
+
|
20
|
+
Spec::Runner.configure do |config|
|
21
|
+
config.before :all do
|
22
|
+
@pwd = Dir.pwd
|
23
|
+
Dir.chdir Webby.datapath('site')
|
24
|
+
FileUtils.mkdir_p Webby.datapath('site', ::Webby.site.output_dir)
|
25
|
+
end
|
26
|
+
|
27
|
+
config.after :all do
|
28
|
+
FileUtils.rm_rf(Webby.datapath('site', ::Webby.cairn))
|
29
|
+
FileUtils.rm_rf(Dir.glob(Webby.datapath(%w[site output *])))
|
30
|
+
Dir.chdir @pwd
|
31
|
+
end
|
32
|
+
|
33
|
+
# == Mock Framework
|
34
|
+
#
|
35
|
+
# RSpec uses it's own mocking framework by default. If you prefer to
|
36
|
+
# use mocha, flexmock or RR, uncomment the appropriate line:
|
37
|
+
#
|
38
|
+
# config.mock_with :mocha
|
39
|
+
# config.mock_with :flexmock
|
40
|
+
# config.mock_with :rr
|
41
|
+
end
|
42
|
+
|
43
|
+
module Webby
|
44
|
+
DATAPATH = ::Webby.path(%w[spec data])
|
45
|
+
def self.datapath( *args )
|
46
|
+
args.empty? ? DATAPATH : ::File.join(DATAPATH, args.flatten)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
$webby_log_output = StringIO.new
|
51
|
+
|
52
|
+
logger = Logging::Logger['Webby']
|
53
|
+
logger.clear_appenders
|
54
|
+
logger.add_appenders(Logging::Appenders::IO.new('stringio', $webby_log_output))
|
55
|
+
|
56
|
+
end # unless defined?
|
57
|
+
|
58
|
+
# EOF
|
@@ -0,0 +1,117 @@
|
|
1
|
+
|
2
|
+
require ::File.expand_path(
|
3
|
+
::File.join(::File.dirname(__FILE__), %w[.. .. spec_helper]))
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
describe Webby::Apps::Generator do
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
@generator = Webby::Apps::Generator.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return a list of available templates" do
|
13
|
+
ary = %w[blog presentation tumblog webby website].map {|t| Webby.path('examples', t)}
|
14
|
+
@generator.templates.should == ary
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should pretend to create a site" do
|
18
|
+
@generator.parse %w[-p website foo]
|
19
|
+
@generator.pretend?.should == true
|
20
|
+
|
21
|
+
@generator = Webby::Apps::Generator.new
|
22
|
+
@generator.parse %w[website foo]
|
23
|
+
@generator.pretend?.should == false
|
24
|
+
|
25
|
+
@generator = Webby::Apps::Generator.new
|
26
|
+
@generator.parse %w[--pretend website foo]
|
27
|
+
@generator.pretend?.should == true
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should return a list of all the site files from the template" do
|
31
|
+
@generator.parse %w[website foo]
|
32
|
+
|
33
|
+
h = @generator.site_files
|
34
|
+
h.keys.sort.should == [
|
35
|
+
"",
|
36
|
+
"content",
|
37
|
+
"content/css",
|
38
|
+
"content/css/blueprint",
|
39
|
+
"content/css/blueprint/plugins",
|
40
|
+
"content/css/blueprint/plugins/buttons",
|
41
|
+
"content/css/blueprint/plugins/buttons/icons",
|
42
|
+
"content/css/blueprint/plugins/fancy-type",
|
43
|
+
"content/css/blueprint/plugins/link-icons",
|
44
|
+
"content/css/blueprint/plugins/link-icons/icons",
|
45
|
+
"content/css/blueprint/plugins/rtl",
|
46
|
+
"content/css/blueprint/src",
|
47
|
+
"layouts",
|
48
|
+
"lib",
|
49
|
+
"templates"
|
50
|
+
]
|
51
|
+
h["content"].should == %w[content/index.txt]
|
52
|
+
h["layouts"].should == %w[layouts/default.txt]
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "when parsing command line arguments" do
|
56
|
+
|
57
|
+
before :each do
|
58
|
+
@strio = StringIO.new
|
59
|
+
::Logging::Logger['Webby::Journal'].appenders =
|
60
|
+
::Logging::Appenders::IO.new('test', @strio)
|
61
|
+
@generator = Webby::Apps::Generator.new(@strio)
|
62
|
+
|
63
|
+
class << @strio
|
64
|
+
def to_s
|
65
|
+
seek 0
|
66
|
+
str = read
|
67
|
+
truncate 0
|
68
|
+
return str
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should force the overwriting of files on collision" do
|
74
|
+
@generator.options[:collision].should be_nil
|
75
|
+
@generator.parse %w[-f website foo]
|
76
|
+
@generator.options[:collision].should == :force
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should skip files on collision" do
|
80
|
+
@generator.options[:collision].should be_nil
|
81
|
+
@generator.parse %w[-s website foo]
|
82
|
+
@generator.options[:collision].should == :skip
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should update only the rake files in the tasks folder" do
|
86
|
+
@generator.options[:update].should be_nil
|
87
|
+
@generator.parse %w[-u website foo]
|
88
|
+
@generator.options[:update].should == true
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should pretend to generate / alter files" do
|
92
|
+
@generator.options[:pretend].should be_nil
|
93
|
+
@generator.parse %w[-p website foo]
|
94
|
+
@generator.options[:pretend].should == true
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should exit if a site is not specified" do
|
98
|
+
# we need to force an error by changing directories back to the top
|
99
|
+
# level so we no longer have a Sitefile in the current directory
|
100
|
+
Dir.chdir @pwd
|
101
|
+
|
102
|
+
lambda{@generator.parse %w[website]}.
|
103
|
+
should raise_error(SystemExit, 'exit')
|
104
|
+
@strio.to_s.split("\n").first.
|
105
|
+
should == 'Usage: webby-gen [options] template site'
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should exit if an unknown template is given" do
|
109
|
+
lambda{@generator.parse %w[foo bar]}.
|
110
|
+
should raise_error(SystemExit, 'exit')
|
111
|
+
@strio.to_s.split("\n").last.
|
112
|
+
should == " Could not find template 'foo'"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# EOF
|
@@ -0,0 +1,88 @@
|
|
1
|
+
|
2
|
+
require ::File.expand_path(
|
3
|
+
::File.join(::File.dirname(__FILE__), %w[.. .. spec_helper]))
|
4
|
+
|
5
|
+
# ---------------------------------------------------------------------------
|
6
|
+
describe Webby::Apps::Main do
|
7
|
+
before do
|
8
|
+
@main = Webby::Apps::Main.new
|
9
|
+
end
|
10
|
+
|
11
|
+
describe ".capture_command_line_args" do
|
12
|
+
it "should set the raw arguments" do
|
13
|
+
raw = ["The Raw Arguments"]
|
14
|
+
args = @main.capture_command_line_args(raw)
|
15
|
+
args.raw.should == raw
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should set the page with one argument by downcasing" do
|
19
|
+
page = "This-is-a-page"
|
20
|
+
args = @main.capture_command_line_args([page])
|
21
|
+
args.page.should == page.downcase
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should set the page with two or more arguments by joining" do
|
25
|
+
page = %w(this is a page)
|
26
|
+
args = @main.capture_command_line_args(page)
|
27
|
+
args.page.should == page.join('-')
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should set the dir from the page's dirname" do
|
31
|
+
page = "foo/bar/this-is-a-page.txt"
|
32
|
+
args = @main.capture_command_line_args([page])
|
33
|
+
args.dir.should == "foo/bar"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should set the slug from the page's basename" do
|
37
|
+
page = "foo/bar/this-is-a-page.txt"
|
38
|
+
args = @main.capture_command_line_args([page])
|
39
|
+
args.slug.should == "this-is-a-page"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should turn the slug into a url" do
|
43
|
+
page = "10% Inspiration & 90% Perspiration"
|
44
|
+
args = @main.capture_command_line_args([page])
|
45
|
+
args.slug.should == "10-percent-inspiration-and-90-percent-perspiration"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should set the page by combining the dir and slug" do
|
49
|
+
page = "10% Inspiration & 90% Perspiration"
|
50
|
+
args = @main.capture_command_line_args([page])
|
51
|
+
args.page.should == "10-percent-inspiration-and-90-percent-perspiration"
|
52
|
+
|
53
|
+
page = "foo/bar/10% Inspiration & 90% Perspiration"
|
54
|
+
args = @main.capture_command_line_args([page])
|
55
|
+
args.page.should == "foo/bar/10-percent-inspiration-and-90-percent-perspiration"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should set the title by joining the raw args, getting the basename, and titlecasing" do
|
59
|
+
page = "foo/bar/this is a page.txt"
|
60
|
+
args = @main.capture_command_line_args([page])
|
61
|
+
args.title.should == "This Is a Page"
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should preserve any page extensions" do
|
65
|
+
page = "foo/bar/this is a page.txt"
|
66
|
+
args = @main.capture_command_line_args([page])
|
67
|
+
args.page.should == "foo/bar/this-is-a-page.txt"
|
68
|
+
|
69
|
+
page = "This is another page.haml"
|
70
|
+
args = @main.capture_command_line_args([page])
|
71
|
+
args.page.should == "this-is-another-page.haml"
|
72
|
+
|
73
|
+
page = "one/more/for the road"
|
74
|
+
args = @main.capture_command_line_args([page])
|
75
|
+
args.page.should == "one/more/for-the-road"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe ".parse" do
|
80
|
+
it "should pass environment variables to the rake application" do
|
81
|
+
ARGV = ary = []
|
82
|
+
args = %w[rebuild foo BASE=http://www.example.com bar]
|
83
|
+
@main.parse args
|
84
|
+
ary.should == %w[rebuild BASE=http://www.example.com]
|
85
|
+
args.should == %w[foo bar]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
|
2
|
+
require ::File.expand_path(
|
3
|
+
::File.join(::File.dirname(__FILE__), %w[.. .. spec_helper]))
|
4
|
+
|
5
|
+
# ---------------------------------------------------------------------------
|
6
|
+
describe Webby::Filters::BasePath do
|
7
|
+
|
8
|
+
before :all do
|
9
|
+
@input = <<-HTML
|
10
|
+
<html>
|
11
|
+
<head>
|
12
|
+
%s
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
%s
|
16
|
+
</body>
|
17
|
+
</html>
|
18
|
+
HTML
|
19
|
+
end
|
20
|
+
|
21
|
+
before :each do
|
22
|
+
Webby.site.base = nil
|
23
|
+
@xpaths = Webby.site.xpaths.dup
|
24
|
+
end
|
25
|
+
|
26
|
+
after :each do
|
27
|
+
Webby.site.xpaths = @xpaths
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'raises an exception if a new base has not been specified' do
|
31
|
+
input = @input % ['', '<img src="/foo/picture.jpg" />']
|
32
|
+
bp = Webby::Filters::BasePath.new(input, 'html')
|
33
|
+
|
34
|
+
lambda {bp.filter}.
|
35
|
+
should raise_error(TypeError, "can't convert nil into String")
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'changes nothing with an empty base path' do
|
39
|
+
Webby.site.base = ''
|
40
|
+
input = @input % ['', '<img src="/foo/picture.jpg" />']
|
41
|
+
|
42
|
+
bp = Webby::Filters::BasePath.new(input, 'html')
|
43
|
+
bp.filter.should == <<-HTML
|
44
|
+
<html>
|
45
|
+
<head>
|
46
|
+
|
47
|
+
</head>
|
48
|
+
<body>
|
49
|
+
<img src="/foo/picture.jpg" />
|
50
|
+
</body>
|
51
|
+
</html>
|
52
|
+
HTML
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'substitutes the base path for xpath values that have a leading slash' do
|
56
|
+
Webby.site.base = 'http://example.com'
|
57
|
+
input = @input % ['', '<img src="/foo/picture.jpg" />']
|
58
|
+
|
59
|
+
bp = Webby::Filters::BasePath.new(input, 'html')
|
60
|
+
bp.filter.should == <<-HTML
|
61
|
+
<html>
|
62
|
+
<head>
|
63
|
+
|
64
|
+
</head>
|
65
|
+
<body>
|
66
|
+
<img src="http://example.com/foo/picture.jpg" />
|
67
|
+
</body>
|
68
|
+
</html>
|
69
|
+
HTML
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'operates on all entities in the input string' do
|
73
|
+
Webby.site.base = 'http://webby.rubyforge.org'
|
74
|
+
input = @input % ['', %Q(<img src="/foo/picture.jpg" />\n<a href="/page.html">Page Title</a>)]
|
75
|
+
|
76
|
+
bp = Webby::Filters::BasePath.new(input, 'html')
|
77
|
+
bp.filter.should == <<-HTML
|
78
|
+
<html>
|
79
|
+
<head>
|
80
|
+
|
81
|
+
</head>
|
82
|
+
<body>
|
83
|
+
<img src="http://webby.rubyforge.org/foo/picture.jpg" />
|
84
|
+
<a href="http://webby.rubyforge.org/page.html">Page Title</a>
|
85
|
+
</body>
|
86
|
+
</html>
|
87
|
+
HTML
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'only operates on entities defined in the xpaths configuration' do
|
91
|
+
Webby.site.xpaths.delete '/html/body//a[@href]'
|
92
|
+
Webby.site.base = 'http://webby.rubyforge.org'
|
93
|
+
input = @input % ['', %Q(<img src="/foo/picture.jpg" />\n<a href="/page.html">Page Title</a>)]
|
94
|
+
|
95
|
+
bp = Webby::Filters::BasePath.new(input, 'html')
|
96
|
+
bp.filter.should == <<-HTML
|
97
|
+
<html>
|
98
|
+
<head>
|
99
|
+
|
100
|
+
</head>
|
101
|
+
<body>
|
102
|
+
<img src="http://webby.rubyforge.org/foo/picture.jpg" />
|
103
|
+
<a href="/page.html">Page Title</a>
|
104
|
+
</body>
|
105
|
+
</html>
|
106
|
+
HTML
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'is restrictive to the configured xpaths' do
|
110
|
+
Webby.site.base = 'not a real site'
|
111
|
+
input = @input % ['<img src="/foo/picture.jpg" />', '<a href="/page.html">Page Title</a>']
|
112
|
+
|
113
|
+
bp = Webby::Filters::BasePath.new(input, 'html')
|
114
|
+
bp.filter.should == <<-HTML
|
115
|
+
<html>
|
116
|
+
<head>
|
117
|
+
<img src="/foo/picture.jpg" />
|
118
|
+
</head>
|
119
|
+
<body>
|
120
|
+
<a href="not a real site/page.html">Page Title</a>
|
121
|
+
</body>
|
122
|
+
</html>
|
123
|
+
HTML
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'registers a "basepath" filter in the filters module' do
|
127
|
+
handler = Webby::Filters._handlers['basepath']
|
128
|
+
handler.should_not be_nil
|
129
|
+
handler.arity.should == 2
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'leaves the input text unchanged if a base path is not configured' do
|
133
|
+
cursor = mock("Cursor")
|
134
|
+
page = mock("Page")
|
135
|
+
cursor.stub!(:page).and_return(page)
|
136
|
+
page.stub!(:extension).and_return('html')
|
137
|
+
input = @input % ['', '<img src="/foo/picture.jpg" />']
|
138
|
+
|
139
|
+
handler = Webby::Filters._handlers['basepath']
|
140
|
+
output = handler.call(input, cursor)
|
141
|
+
|
142
|
+
output.should equal(input)
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'modifies text when a base path is configured' do
|
146
|
+
cursor = mock("Cursor")
|
147
|
+
page = mock("Page")
|
148
|
+
cursor.stub!(:page).and_return(page)
|
149
|
+
page.stub!(:extension).and_return('html')
|
150
|
+
Webby.site.base = 'http://example.com'
|
151
|
+
input = @input % ['', '<img src="/foo/picture.jpg" />']
|
152
|
+
|
153
|
+
handler = Webby::Filters._handlers['basepath']
|
154
|
+
handler.call(input, cursor).should == <<-HTML
|
155
|
+
<html>
|
156
|
+
<head>
|
157
|
+
|
158
|
+
</head>
|
159
|
+
<body>
|
160
|
+
<img src="http://example.com/foo/picture.jpg" />
|
161
|
+
</body>
|
162
|
+
</html>
|
163
|
+
HTML
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# EOF
|