webby 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/History.txt +7 -0
  2. data/Manifest.txt +30 -1
  3. data/Rakefile +6 -2
  4. data/bin/webby +1 -1
  5. data/data/Rakefile +6 -2
  6. data/data/content/{index.rhtml → index.txt} +0 -0
  7. data/data/tasks/create.rake +6 -1
  8. data/data/tasks/deploy.rake +22 -0
  9. data/data/tasks/heel.rake +26 -0
  10. data/data/tasks/setup.rb +27 -0
  11. data/lib/webby.rb +20 -12
  12. data/lib/webby/builder.rb +6 -19
  13. data/lib/webby/main.rb +85 -15
  14. data/lib/webby/pages_db.rb +24 -1
  15. data/lib/webby/renderer.rb +25 -3
  16. data/lib/webby/resource.rb +89 -13
  17. data/lib/webby/webby_task.rb +19 -41
  18. data/tasks/doc.rake +2 -19
  19. data/tasks/gem.rake +14 -41
  20. data/tasks/manifest.rake +1 -1
  21. data/tasks/rubyforge.rake +57 -0
  22. data/tasks/setup.rb +6 -5
  23. data/tasks/spec.rake +3 -3
  24. data/tasks/website.rake +38 -0
  25. data/website/Rakefile +13 -0
  26. data/website/content/css/blueprint/lib/buttons.css +112 -0
  27. data/website/content/css/blueprint/lib/compressed.css +127 -0
  28. data/website/content/css/blueprint/lib/grid.css +177 -0
  29. data/website/content/css/blueprint/lib/img/baseline-black.png +0 -0
  30. data/website/content/css/blueprint/lib/img/baseline.png +0 -0
  31. data/website/content/css/blueprint/lib/img/grid.png +0 -0
  32. data/website/content/css/blueprint/lib/img/icons/cross.png +0 -0
  33. data/website/content/css/blueprint/lib/img/icons/textfield_key.png +0 -0
  34. data/website/content/css/blueprint/lib/img/icons/tick.png +0 -0
  35. data/website/content/css/blueprint/lib/reset.css +37 -0
  36. data/website/content/css/blueprint/lib/typography.css +159 -0
  37. data/website/content/css/blueprint/print.css +75 -0
  38. data/website/content/css/blueprint/screen.css +34 -0
  39. data/website/content/css/site.css +22 -0
  40. data/website/content/download.txt +8 -0
  41. data/website/content/index.txt +28 -0
  42. data/website/content/tutorial.txt +130 -0
  43. data/website/layouts/default.rhtml +49 -0
  44. data/website/tasks/create.rake +11 -0
  45. data/website/tasks/deploy.rake +22 -0
  46. data/website/tasks/heel.rake +26 -0
  47. data/website/tasks/setup.rb +27 -0
  48. data/website/templates/page.erb +8 -0
  49. metadata +33 -14
@@ -0,0 +1,37 @@
1
+ /* --------------------------------------------------------------
2
+
3
+ Reset.css
4
+ * Resets default browser CSS styles.
5
+
6
+ Original by Erik Meyer:
7
+ * meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
8
+
9
+ -------------------------------------------------------------- */
10
+
11
+ html, body, div, span, applet, object, iframe,
12
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
13
+ a, abbr, acronym, address, big, cite, code,
14
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
15
+ small, strike, strong, sub, sup, tt, var,
16
+ dl, dt, dd, ol, ul, li,
17
+ fieldset, form, label, legend,
18
+ table, caption, tbody, tfoot, thead, tr, th, td {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-weight: inherit;
23
+ font-style: inherit;
24
+ font-size: 100%;
25
+ font-family: inherit;
26
+ vertical-align: baseline;
27
+ }
28
+
29
+ body { line-height: 1; color: #333; background: white; }
30
+
31
+ /* Tables still need 'cellspacing="0"' in the markup. */
32
+ table { border-collapse: separate; border-spacing: 0; }
33
+ caption, th, td { text-align: left; font-weight: normal; }
34
+
35
+ /* Remove possible quote marks (") from <q>, <blockquote>. */
36
+ blockquote:before, blockquote:after, q:before, q:after { content: ""; }
37
+ blockquote, q { quotes: "" ""; }
@@ -0,0 +1,159 @@
1
+ /* --------------------------------------------------------------
2
+
3
+ Typography.css
4
+ * Sets some default typography.
5
+
6
+ Based on work by:
7
+ * Nathan Borror [playgroundblues.com]
8
+ * Jeff Croft [jeffcroft.com]
9
+ * Christian Metts [mintchaos.com]
10
+ * Wilson Miner [wilsonminer.com]
11
+
12
+ Read more about using a baseline here:
13
+ * alistapart.com/articles/settingtypeontheweb
14
+
15
+ -------------------------------------------------------------- */
16
+
17
+ body {
18
+ font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
19
+ line-height: 1.5; /* Unitless for proper inheritance */
20
+ }
21
+
22
+ /* This is where you set your desired font size. The line-height
23
+ and vertical margins are automatically calculated from this.
24
+
25
+ You have to add an extra calculation here because of IE, so that
26
+ all users may resize text manually in their browsers.
27
+
28
+ The top one is for IE: The percentage is of 16px (default IE text size)
29
+ 10px is 62.5%, 12px is 75%, 13px is 81.25%, and so forth).
30
+ The second value is what all other browsers see (the wanted font size). */
31
+
32
+ body { font-size: 75%; } /* IE */
33
+ html > body { font-size: 12px; } /* Other browsers */
34
+
35
+
36
+ /* Headings
37
+ -------------------------------------------------------------- */
38
+
39
+ h1,h2,h3,h4,h5,h6 {
40
+ font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
41
+ color:#111;
42
+ clear:both;
43
+ }
44
+
45
+ h1 { font-size: 3em; }
46
+ h2 { font-size: 2em; }
47
+ h3 { font-size: 1.5em; line-height:2; }
48
+ h4 { font-size: 1.2em; line-height:1.25; font-weight:bold; }
49
+ h5 { font-size: 1em; font-weight:bold; }
50
+ h6 { font-size: 1em; }
51
+
52
+
53
+ /* Text elements
54
+ -------------------------------------------------------------- */
55
+
56
+ p { margin: 0 0 1.5em 0; text-align:justify; }
57
+ p.last { margin-bottom:0; }
58
+ p img { float: left; margin: 1.5em 1.5em 1.5em 0; padding:0; }
59
+ p img.top { margin-top:0; } /* Use this if the image is at the top of the <p>. */
60
+
61
+ ul, ol { margin: 0 0 1.5em 1.5em; }
62
+ ol { list-style-type: decimal; }
63
+ dl { margin: 1.5em 0; }
64
+ dl dt { font-weight: bold; }
65
+
66
+ a { color: #125AA7; text-decoration: underline; outline: none; }
67
+ a:hover { color: #000; }
68
+
69
+ blockquote { margin: 1.5em 0 1.5em 1.5em; color: #666; font-style: italic; }
70
+ strong { font-weight: bold; }
71
+ em { font-style: italic; }
72
+ pre { margin-bottom: 1.3em; background: #eee; border:0.1em solid #ddd; padding:1.5em; }
73
+ code { font:0.9em Monaco, monospace; }
74
+
75
+ /* Use this to create a horizontal ruler across a column. */
76
+ hr {
77
+ background: #B2CCFF;
78
+ color: #B2CCFF;
79
+ clear: both;
80
+ float: none;
81
+ width: 100%;
82
+ height: 0.1em;
83
+ margin: 0 0 1.4em 0;
84
+ border: none;
85
+ }
86
+ * html hr { margin: 0 0 1.2em 0; } /* IE6 fix */
87
+
88
+
89
+ /* Tables
90
+ -------------------------------------------------------------- */
91
+
92
+ table { margin-bottom: 1.4em; border-top:0.1em solid #ddd; border-left:0.1em solid #ddd; }
93
+ th,td { height: 1em; padding:0.2em 0.4em; border-bottom:0.1em solid #ddd; border-right:0.1em solid #ddd; }
94
+ th { font-weight:bold; }
95
+
96
+
97
+ /* Forms
98
+ -------------------------------------------------------------- */
99
+
100
+ label { font-weight: bold; }
101
+ textarea { height: 180px; width: 300px; }
102
+
103
+
104
+ /* Some default classes
105
+ -------------------------------------------------------------- */
106
+
107
+ p.small { font-size: 0.8em; margin-bottom: 1.875em; line-height: 1.875em; }
108
+ p.large { font-size: 1.2em; line-height: 2.5em; }
109
+ p.quiet { color: #666; }
110
+ .hide { display: none; }
111
+
112
+
113
+ /* Extra fancy typography
114
+ -------------------------------------------------------------- */
115
+
116
+ /* For great looking type, use this code instead of asdf:
117
+ <span class="alt">asdf</span>
118
+ Best used on prepositions and ampersands. */
119
+
120
+ .alt {
121
+ color: #666;
122
+ font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", serif;
123
+ font-size: 1.2em;
124
+ line-height: 1%; /* Maintain correct baseline */
125
+ font-style: italic;
126
+ }
127
+
128
+ /* For great looking quote marks in titles, replace "asdf" width:
129
+ <span class="dquo">&#8220;</span>asdf&#8221;
130
+ (That is, when the title starts with a quote mark).
131
+ (You may have to change this value depending on your font size). */
132
+
133
+ .dquo { margin-left: -.7em; }
134
+
135
+
136
+ /* Reduced size type with incremental leading
137
+ (http://www.markboulton.co.uk/journal/comments/incremental_leading/)
138
+
139
+ This could be used for side notes. For smaller type, you don't necessarily want to
140
+ follow the 1.5x vertical rhythm -- the line-height is too much.
141
+
142
+ Using this class, it reduces your font size and line-height so that for
143
+ every four lines of normal sized type, there is five lines of the sidenote. eg:
144
+
145
+ New type size in em's:
146
+ 10px (wanted side note size) / 12px (existing base size) = 0.8333 (new type size in ems)
147
+
148
+ New line-height value:
149
+ 12px x 1.5 = 18px (old line-height)
150
+ 18px x 4 = 72px
151
+ 60px / 5 = 14.4px (new line height)
152
+ 14.4px / 10px = 1.44 (new line height in em's) */
153
+
154
+ p.incr, .incr p {
155
+ font-size: 0.83333em; /* font size 10px */
156
+ line-height: 1.44em;
157
+ margin-bottom: 1.8em; /* Still 1.5 x normal font size as baseline */
158
+ }
159
+
@@ -0,0 +1,75 @@
1
+ /* --------------------------------------------------------------
2
+
3
+ Blueprint CSS Framework
4
+ [bjorkoy.com/blueprint]
5
+
6
+ * Print Styles *
7
+
8
+ This file creates CSS styles for printing documents.
9
+ Include this in the <head> of every page. See the
10
+ Readme file in this directory for further instructions.
11
+
12
+ Some additions you'll want to make,
13
+ customized to your markup:
14
+
15
+ #heder, #footer, #navigation { display:none; }
16
+
17
+ -------------------------------------------------------------- */
18
+
19
+ body {
20
+ font-family: Georgia, Times, serif;
21
+ line-height: 1.5;
22
+ color:#000;
23
+ background: none;
24
+ font-size: 11pt;
25
+ }
26
+
27
+ img {
28
+ float:left;
29
+ margin:1.5em 1.5em 1.5em 0;
30
+ }
31
+ p img.top {
32
+ margin-top: 0;
33
+ }
34
+
35
+ hr {
36
+ background:#ccc;
37
+ color:#ccc;
38
+ width:100%;
39
+ height:2px;
40
+ margin:2em 0;
41
+ padding:0;
42
+ border:none;
43
+ }
44
+ blockquote {
45
+ margin:1.5em 0;
46
+ padding:1em;
47
+ border:0.2em solid #ccc;
48
+ font-style:italic;
49
+ font-size:0.9em;
50
+ }
51
+
52
+ .small, .small p { font-size: 0.9em; }
53
+ .large, .large p { font-size: 1.1em; }
54
+ .quiet, .quiet p { color: #999; }
55
+ .hide { display:none; }
56
+
57
+ a:link, a:visited {
58
+ background: transparent;
59
+ font-weight: bold;
60
+ text-decoration: underline;
61
+ }
62
+
63
+ a:link:after, a:visited:after {
64
+ content: " (" attr(href) ") ";
65
+ font-size: 90%;
66
+ }
67
+
68
+ /* If you're having trouble printing relative links, uncomment and customize this:
69
+ (note: This is valid CSS3, but it still won't go through the W3C CSS Validator) */
70
+
71
+ /* a[href^="/"]:after {
72
+ content: " (http://www.yourdomain.com" attr(href) ") ";
73
+ } */
74
+
75
+
@@ -0,0 +1,34 @@
1
+ /* --------------------------------------------------------------
2
+
3
+ Blueprint CSS Framework
4
+ [bjorkoy.com/blueprint]
5
+
6
+ * Screen & Projection Styles *
7
+
8
+ This is the main CSS-file for the framework.
9
+ Include this in the <head> of every page. See the
10
+ Readme file in this directory for further instructions.
11
+
12
+ -------------------------------------------------------------- */
13
+
14
+ /* Import stylesheets and hide from IE/Mac \*/
15
+ @import "lib/reset.css";
16
+ @import "lib/typography.css";
17
+ @import "lib/grid.css";
18
+ @import "lib/buttons.css";
19
+ /* End import/hide */
20
+
21
+
22
+ /* Compressed version:
23
+ [http://teenage.cz/acidofil/tools/cssformat.php]
24
+
25
+ Comment out @import statements above, and add this
26
+ one when your site has launched (Ca 60% compressed):
27
+ @import "lib/compressed.css"; */
28
+
29
+
30
+ /* Uncomment the line below to see the grid and baseline.
31
+ (Assuming you've wrapped your columns in a container).
32
+
33
+ .container { background: url(lib/img/grid.png); }
34
+ .container { background: url(lib/img/baseline.png); } */
@@ -0,0 +1,22 @@
1
+
2
+
3
+ body { margin: 1.0em 0 }
4
+
5
+ #header hr { margin-bottom: 0.5em; height: 0.3em; }
6
+
7
+ #navigation { text-align: center; margin-left: 0; font-size: 1.5em; list-style-type: none; }
8
+ #navigation li { display:inline; padding-right: 0.5em; }
9
+ #navigation li a { padding-right: 0.5em; }
10
+
11
+
12
+ #footer hr { margin-bottom: 0.5em }
13
+ #footer p { text-align: right }
14
+
15
+ .code {
16
+ padding: 0.5em;
17
+ margin-bottom: 1.3em;
18
+ color: #fff;
19
+ background-color: #333;
20
+ border: 0.1em solid black;
21
+ font: 1.1em Monaco, monospace;
22
+ }
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Download
3
+ created_at: Wed Aug 22 08:36:50 -0600 2007
4
+ filter: textile
5
+ ---
6
+ h2. Download
7
+
8
+ You can read more about textile "here":http://whytheluckystiff.net/ruby/redcloth/
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: Home
3
+ created_at: Tue Aug 21 11:25:06 -0600 2007
4
+ filter: textile
5
+ ---
6
+ *Webby* is a super fantastic little website management system. It would be called a _content management system_ if it were a bigger kid. But, it's just a runt with a special knack for transforming text. And that's really all it does - manages the legwork of turning text into something else, an *ASCII Alchemist* if you will.
7
+
8
+ Webby works by combining the contents of a *page* with a *layout* to produce HTML. The layout contains everthing common to all the pages - HTML headers, navigation menu, footer, etc. - and the page contains just the information for that page. You can use your favorite markup language to write your pages; Webby supports quite a few.
9
+
10
+ Install Webby and try it out!
11
+
12
+ <pre class="code">
13
+ gem install webby
14
+ </pre>
15
+
16
+ h3. Features
17
+
18
+ * choose your templating language: *eRuby*, *Textile*, *Markdown*, *HAML*
19
+ * quick and speedy - only builds pages that have changed
20
+ * deploy anywhere - it's just HTML, no special server stuff required
21
+ * happy "rake":http://docs.rubyrake.org/ tasks for deploying your website to a server
22
+ * build new pages from templates for quicker blog posts and news items
23
+
24
+ h3. But Wait! There's More!
25
+
26
+ Webby is not limited to producing HTML. By no means! Do you ever get tired of repeating the same color code *#D3C4A2* in your CSS files? Webby can help. Need some customized JavaScript for your website. Webby can help. Anytime you find yourself repeating the same bit of text over and over, then you should be using Webby.
27
+
28
+ Read the "tutorial":tutorial.html section for a quick introduction to Webby, and enjoy the wonders of *ASCII Alchemy*.
@@ -0,0 +1,130 @@
1
+ ---
2
+ title: Tutorial
3
+ created_at: Tue Aug 21 17:02:40 -0600 2007
4
+ filter: textile
5
+ ---
6
+ h3. Require
7
+
8
+ Webby has a family of friends that help it get it's job done. The command-line is where Webby lives and works. You should be comfortable with your terminal if you're going to get serious with Webby. Webby is built on top of "Ruby":http://www.ruby-lang.org/, and many of the templates use Ruby in one way or another. Learning a little bit about Ruby will make Webby far less intimidating.
9
+
10
+ This tutorial requires *Ruby* to be installed as well as *Webby* and the "*RedCloth*":http://whytheluckystiff.net/ruby/redcloth/ templating engine. RedCloth provides support for the Textile markup language.
11
+
12
+ h3. Create a Site
13
+
14
+ You need a catchy name for your website to survive in this Web 2.0 world. Webby is distinctly Web 1.0 (or maybe Web 0.5) so we'll use the name *my_site*.
15
+
16
+ <pre class="code">
17
+ webby my_site
18
+ </pre>
19
+
20
+ This command creates a new folder named _my_site_, and the new Webby based website resides there. Change directories to the _my_site_ folder and do a listing. You will see the following files and folder:
21
+
22
+ <pre class="code">
23
+ Rakefile
24
+ content/
25
+ layouts/
26
+ lib/
27
+ output/
28
+ tasks/
29
+ templates/
30
+ </pre>
31
+
32
+ h3. Build Your Site
33
+
34
+ What? Didn't we just do that?
35
+
36
+ Webby creates a site template - the larval form of your new website. "Rake":http://docs.rubyrake.org/ (another command line tool) is used to generate the HTML files for your site - a unique, beautiful butterfly.
37
+
38
+ <pre class="code">
39
+ rake
40
+ </pre>
41
+
42
+ Again, you will see lots of output scrolling across the screen. This is the rake task copying files from the _content_ folder to the _output_ folder. Some files are copied "as is", while others are compiled into HTML using your markup language of choice.
43
+
44
+ Point your web browser to *my_site/output/index.html* to see what your new website looks like.
45
+
46
+ h3. Making Changes
47
+
48
+ Of course _Lorem Ipsum_ is some great content, but if everyone posted their site in such a state the web would be a monochromatic smurf blue. Let's change that into something more creative, more us. Open the *content/index.rhtml* file in your favorite editor.
49
+
50
+ <pre class="code">
51
+ ---
52
+ title: Home Page
53
+ filter:
54
+ - erb
55
+ - textile
56
+ ---
57
+ h2. <%= @page.title %>
58
+
59
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum
60
+ vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est
61
+ eu lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at
62
+ metus.
63
+
64
+ h3. Litora Sociis
65
+ ...
66
+ </pre>
67
+
68
+ This is not the entire contents of the file, just to enough to get a feel for how Webby operates. The text between the dashed lines "@---@" is information about the page, referred to as _meta-data_. Obviously one piece of information is the *title* of the page, "Home Page". The other is a little more cryptic and bears some explaining.
69
+
70
+ The content of this page is not HTML, but it ends up that way. How? Webby uses _filters_ on the page to transform the text into HTML. The *filter* item in the meta-data tells Webby which filters to apply to the page. Two filters will be applied, "erb" and "textile" - in that order. Each filter operates on the page text (everything after the meta-data).
71
+
72
+ The erb filter (erb stands for "embedded Ruby") allows Webby to process Ruby statements found in the page text and to substitue the output of those Ruby statements back into the page text. The Ruby statements appear between @<%= ruby_code %>@ delimiters. The meta-data found at the top of the page is made available through the @@page@ object. You can see from the index.rhtml file that the page title, "Home Page", will be substituted on the first line.
73
+
74
+ The textile filter operates on all page text. It is a human readable markup that gets converted into HTML. For example, the line @h3. Litora Sociis@ will be converted into @<h3>Litora Sociis</h3>@ by the textile filter. It is a powerful markup language that simplifies web publishing.
75
+
76
+ Okay, back to our regularly scheduled page changes. Go ahead and change the title of the page in the meta-data. Then run rake again.
77
+
78
+ <pre class="code">
79
+ rake
80
+ </pre>
81
+
82
+ You'll notice much less output than before. The rake task only builds those pages that you have modified. You'll also notice, after reloading the page in your browser, that the title has now changed.
83
+
84
+ Play around with making changes, running rake, and seeing your changes show up in the web browser. Done? All right! Let's go on to the next section.
85
+
86
+ bq. *TIP* You can simplify this whole process - modify content, rake, view in browser - by running @rake autobuild@ on the command line. This starts a build loop that compiles the content of your website as files change. All you need to do now is - modify content, view in browser.
87
+
88
+ h3. Creating a Page
89
+
90
+ Let's tell the world all about your new website. We'll create a new _about_ page that describes what this website is all about, who you are, and the answer to life, the universe, and everything.
91
+
92
+ <pre class="code">
93
+ rake create:page about
94
+ </pre>
95
+
96
+ The output from the command tells you that a new file has been created - @content/about.txt@. You can now edit this page, give it a title "About", and somewhere in there include _42_.
97
+
98
+ h3. Change the Layout
99
+
100
+ The next step is to change how the page looks. In fact, we want to change the appearance of all the pages in our website. This is easily by done by changing the website layout file in the _layouts_ folder. Open the *layouts/default.rhtml* file in your favorite editor.
101
+
102
+ <pre class="code">
103
+ ---
104
+ extension: html
105
+ filter: erb
106
+ ---
107
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
108
+ "DTD/xhtml1-strict.dtd">
109
+
110
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
111
+ <head>
112
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
113
+ <title><%= @page.title %></title>
114
+ <meta name="author" content="<%= @page.author %>" />
115
+ ...
116
+ </pre>
117
+
118
+ Ahhh, I love the smell of HTML in the morning!
119
+
120
+ You'll notice that the layout file has meta-data just like the content files we've been editing. The *extension* defines the filename extentions that will be appened to every file generated by this layout. Just like the content files, layouts are filtered to produce valid HTML. The current page being rendered is available in the layout using the @@page@ variable.
121
+
122
+ We can see in the HTML header data that the page title will be set to the value of the @@page.title@ from the meta-datalayouts are filtered to produce valid HTML. The current page being rendered is available in the layout using the @@page@ variable. The meta-data of the layout is not made available in the layout itself - just the meta-data of the content file being rendered.
123
+
124
+ Let's change the layout by removing the sidebar from every page. Find the sidebar div @<div class="column span-3 last">@. Delete that div, run rake to build the webiste again, and take a look at the site in your browser. You'll notice that both pages have been updated since both depend upon the default layout.
125
+
126
+ h3. What Now?
127
+
128
+ Let your creativity run wild!
129
+
130
+ You can read more about the features of Webby in the "manual":manual.html. There you'll discover how to reference layouts other than the default, how to create page templates for simplifying blog posts. Take a look at the "tips &amp; tricks":tips_and_tricks.html for more ideas on simplying your web development work cycle.