webby 0.9.3-x86-mswin32 → 0.9.4-x86-mswin32
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/History.txt +20 -0
- data/{README.txt → README.rdoc} +9 -9
- data/Rakefile +19 -6
- data/examples/blog/content/css/blueprint/ie.css +26 -0
- data/examples/blog/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/examples/{website/content/css/blueprint/plugins/buttons/Readme → blog/content/css/blueprint/plugins/buttons/readme.txt} +3 -2
- data/examples/{website/content/css/blueprint/plugins/buttons/buttons.css → blog/content/css/blueprint/plugins/buttons/screen.css} +1 -1
- data/examples/blog/content/css/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/examples/{website/content/css/blueprint/plugins/fancy-type/fancy-type.css → blog/content/css/blueprint/plugins/fancy-type/screen.css} +2 -5
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/readme.txt +18 -0
- data/examples/blog/content/css/blueprint/plugins/link-icons/screen.css +40 -0
- data/examples/blog/content/css/blueprint/plugins/rtl/readme.txt +10 -0
- data/examples/blog/content/css/blueprint/plugins/rtl/screen.css +109 -0
- data/examples/blog/content/css/blueprint/print.css +30 -0
- data/examples/blog/content/css/blueprint/screen.css +251 -0
- data/examples/blog/content/css/blueprint/src/forms.css +49 -0
- data/examples/blog/content/css/blueprint/src/grid.css +212 -0
- data/examples/{website/content/css/blueprint/lib → blog/content/css/blueprint/src}/grid.png +0 -0
- data/examples/blog/content/css/blueprint/src/ie.css +59 -0
- data/examples/blog/content/css/blueprint/src/print.css +85 -0
- data/examples/{website/content/css/blueprint/lib → blog/content/css/blueprint/src}/reset.css +14 -15
- data/examples/blog/content/css/blueprint/src/typography.css +105 -0
- data/examples/blog/content/css/coderay.css +111 -0
- data/examples/blog/content/css/site.css +67 -0
- data/examples/blog/layouts/default.txt +61 -0
- data/examples/blog/tasks/blog.rake +5 -1
- data/examples/presentation/Sitefile +2 -2
- data/examples/tumblog/tasks/tumblog.rake +5 -1
- data/examples/webby/Sitefile +2 -2
- data/examples/webby/content/communicate/index.txt +2 -2
- data/examples/webby/content/index.txt +1 -1
- data/examples/webby/content/release-notes/rel-0-9-3/index.txt +0 -2
- data/examples/webby/content/release-notes/rel-0-9-4/index.txt +33 -0
- data/examples/webby/content/sitemap.txt +2 -2
- data/examples/webby/content/user-manual/index.txt +3 -3
- data/examples/website/content/css/blueprint/ie.css +26 -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 -68
- data/examples/website/content/css/blueprint/screen.css +251 -22
- 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/layouts/default.txt +5 -2
- data/lib/webby.rb +36 -102
- data/lib/webby/apps/generator.rb +2 -2
- data/lib/webby/apps/main.rb +36 -62
- data/lib/webby/auto_builder.rb +3 -3
- data/lib/webby/builder.rb +5 -13
- data/lib/webby/config.rb +172 -0
- data/lib/webby/filters.rb +2 -0
- data/lib/webby/filters/haml.rb +13 -0
- data/lib/webby/filters/maruku.rb +16 -0
- data/lib/webby/filters/outline.rb +1 -1
- data/lib/webby/filters/sass.rb +14 -0
- data/lib/webby/filters/slides.rb +2 -2
- data/lib/webby/filters/tidy.rb +5 -0
- data/lib/webby/helpers/coderay_helper.rb +27 -3
- data/lib/webby/helpers/graphviz_helper.rb +20 -3
- data/lib/webby/helpers/tex_img_helper.rb +25 -5
- data/lib/webby/helpers/ultraviolet_helper.rb +19 -5
- data/lib/webby/link_validator.rb +59 -51
- data/lib/webby/renderer.rb +9 -6
- data/lib/webby/resources.rb +2 -1
- data/lib/webby/resources/page.rb +4 -1
- data/lib/webby/tasks/create.rake +1 -1
- data/lib/webby/tasks/validate.rake +1 -1
- 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/site/tasks/tumblog.rake +5 -1
- data/spec/spec_helper.rb +8 -1
- data/spec/webby/apps/generator_spec.rb +36 -3
- data/spec/webby/apps/main_spec.rb +2 -1
- data/spec/webby/filters/basepath_spec.rb +2 -2
- data/spec/webby/filters/maruku_spec.rb +31 -0
- data/spec/webby/filters/textile_spec.rb +15 -4
- data/spec/webby/helpers/capture_helper_spec.rb +1 -1
- data/spec/webby/link_validator_spec.rb +154 -0
- data/spec/webby/resources/db_spec.rb +24 -24
- data/spec/webby/resources/layout_spec.rb +1 -1
- data/spec/webby/resources/page_spec.rb +8 -2
- data/spec/webby/resources/resource_spec.rb +1 -1
- data/spec/webby/resources_spec.rb +1 -1
- data/tasks/ann.rake +1 -2
- data/tasks/bones.rake +0 -1
- data/tasks/gem.rake +48 -34
- data/tasks/git.rake +0 -1
- data/tasks/mswin32.rake +38 -0
- data/tasks/notes.rake +0 -1
- data/tasks/post_load.rake +4 -9
- data/tasks/rdoc.rake +4 -4
- data/tasks/setup.rb +50 -26
- data/tasks/spec.rake +1 -2
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- data/tasks/website.rake +0 -1
- data/tasks/zentest.rake +36 -0
- metadata +104 -33
- data/Manifest.txt +0 -228
- data/examples/website/content/css/blueprint/License.txt +0 -21
- data/examples/website/content/css/blueprint/Readme.txt +0 -100
- data/examples/website/content/css/blueprint/compressed/print.css +0 -76
- data/examples/website/content/css/blueprint/compressed/screen.css +0 -696
- data/examples/website/content/css/blueprint/lib/forms.css +0 -45
- data/examples/website/content/css/blueprint/lib/grid.css +0 -193
- data/examples/website/content/css/blueprint/lib/ie.css +0 -30
- data/examples/website/content/css/blueprint/lib/typography.css +0 -116
- data/examples/website/content/css/blueprint/plugins/css-classes/Readme +0 -14
- data/examples/website/content/css/blueprint/plugins/css-classes/css-classes.css +0 -24
- data/examples/website/content/css/blueprint/plugins/fancy-type/Readme +0 -22
- data/examples/website/content/css/blueprint/plugins/fancy-type/fancy-type-compressed.css +0 -5
- data/lib/webby/stelan/spawner.rb +0 -339
- data/tasks/manifest.rake +0 -48
@@ -0,0 +1,105 @@
|
|
1
|
+
/* --------------------------------------------------------------
|
2
|
+
|
3
|
+
typography.css
|
4
|
+
* Sets up some sensible default typography.
|
5
|
+
|
6
|
+
-------------------------------------------------------------- */
|
7
|
+
|
8
|
+
/* Default font settings.
|
9
|
+
The font-size percentage is of 16px. (0.75 * 16px = 12px) */
|
10
|
+
body {
|
11
|
+
font-size: 75%;
|
12
|
+
color: #222;
|
13
|
+
background: #fff;
|
14
|
+
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
/* Headings
|
19
|
+
-------------------------------------------------------------- */
|
20
|
+
|
21
|
+
h1,h2,h3,h4,h5,h6 { font-weight: normal; color: #111; }
|
22
|
+
|
23
|
+
h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; }
|
24
|
+
h2 { font-size: 2em; margin-bottom: 0.75em; }
|
25
|
+
h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; }
|
26
|
+
h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; }
|
27
|
+
h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.5em; }
|
28
|
+
h6 { font-size: 1em; font-weight: bold; }
|
29
|
+
|
30
|
+
h1 img, h2 img, h3 img,
|
31
|
+
h4 img, h5 img, h6 img {
|
32
|
+
margin: 0;
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
/* Text elements
|
37
|
+
-------------------------------------------------------------- */
|
38
|
+
|
39
|
+
p { margin: 0 0 1.5em; }
|
40
|
+
p img.left { float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; }
|
41
|
+
p img.right { float: right; margin: 1.5em 0 1.5em 1.5em; }
|
42
|
+
|
43
|
+
a:focus,
|
44
|
+
a:hover { color: #000; }
|
45
|
+
a { color: #009; text-decoration: underline; }
|
46
|
+
|
47
|
+
blockquote { margin: 1.5em; color: #666; font-style: italic; }
|
48
|
+
strong { font-weight: bold; }
|
49
|
+
em,dfn { font-style: italic; }
|
50
|
+
dfn { font-weight: bold; }
|
51
|
+
sup, sub { line-height: 0; }
|
52
|
+
|
53
|
+
abbr,
|
54
|
+
acronym { border-bottom: 1px dotted #666; }
|
55
|
+
address { margin: 0 0 1.5em; font-style: italic; }
|
56
|
+
del { color:#666; }
|
57
|
+
|
58
|
+
pre { margin: 1.5em 0; white-space: pre; }
|
59
|
+
pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; }
|
60
|
+
|
61
|
+
|
62
|
+
/* Lists
|
63
|
+
-------------------------------------------------------------- */
|
64
|
+
|
65
|
+
li ul,
|
66
|
+
li ol { margin:0 1.5em; }
|
67
|
+
ul, ol { margin: 0 1.5em 1.5em 1.5em; }
|
68
|
+
|
69
|
+
ul { list-style-type: disc; }
|
70
|
+
ol { list-style-type: decimal; }
|
71
|
+
|
72
|
+
dl { margin: 0 0 1.5em 0; }
|
73
|
+
dl dt { font-weight: bold; }
|
74
|
+
dd { margin-left: 1.5em;}
|
75
|
+
|
76
|
+
|
77
|
+
/* Tables
|
78
|
+
-------------------------------------------------------------- */
|
79
|
+
|
80
|
+
table { margin-bottom: 1.4em; width:100%; }
|
81
|
+
th { font-weight: bold; }
|
82
|
+
thead th { background: #c3d9ff; }
|
83
|
+
th,td,caption { padding: 4px 10px 4px 5px; }
|
84
|
+
tr.even td { background: #e5ecf9; }
|
85
|
+
tfoot { font-style: italic; }
|
86
|
+
caption { background: #eee; }
|
87
|
+
|
88
|
+
|
89
|
+
/* Misc classes
|
90
|
+
-------------------------------------------------------------- */
|
91
|
+
|
92
|
+
.small { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; }
|
93
|
+
.large { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; }
|
94
|
+
.hide { display: none; }
|
95
|
+
|
96
|
+
.quiet { color: #666; }
|
97
|
+
.loud { color: #000; }
|
98
|
+
.highlight { background:#ff0; }
|
99
|
+
.added { background:#060; color: #fff; }
|
100
|
+
.removed { background:#900; color: #fff; }
|
101
|
+
|
102
|
+
.first { margin-left:0; padding-left:0; }
|
103
|
+
.last { margin-right:0; padding-right:0; }
|
104
|
+
.top { margin-top:0; padding-top:0; }
|
105
|
+
.bottom { margin-bottom:0; padding-bottom:0; }
|
@@ -12,8 +12,11 @@ filter: erb
|
|
12
12
|
<meta name="author" content="<%= @page.author %>" />
|
13
13
|
|
14
14
|
<!--- Blueprint CSS Framework -->
|
15
|
-
<link rel="stylesheet" href="/css/blueprint/screen.css" type="text/css" media="screen, projection"
|
16
|
-
<link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" media="print"
|
15
|
+
<link rel="stylesheet" href="/css/blueprint/screen.css" type="text/css" media="screen, projection">
|
16
|
+
<link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" media="print">
|
17
|
+
<!--[if IE]>
|
18
|
+
<link rel="stylesheet" href="/css/blueprint/ie.css" type="text/css" media="screen, projection">
|
19
|
+
<![endif]-->
|
17
20
|
|
18
21
|
<!-- CodeRay syntax highlighting CSS -->
|
19
22
|
<link rel="stylesheet" href="/css/coderay.css" type="text/css" />
|
data/lib/webby.rb
CHANGED
@@ -2,15 +2,19 @@
|
|
2
2
|
# Used to prevent the spec helper from being loaded more than once
|
3
3
|
unless defined? ::Webby
|
4
4
|
|
5
|
-
|
6
|
-
require 'logging'
|
7
|
-
require '
|
5
|
+
begin
|
6
|
+
require 'logging'
|
7
|
+
require 'loquacious'
|
8
|
+
rescue LoadError
|
9
|
+
retry if require 'rubygems'
|
10
|
+
raise
|
11
|
+
end
|
8
12
|
require 'date'
|
9
13
|
|
10
14
|
module Webby
|
11
15
|
|
12
16
|
# :stopdoc:
|
13
|
-
VERSION = '0.9.
|
17
|
+
VERSION = '0.9.4' # :nodoc:
|
14
18
|
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
15
19
|
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
16
20
|
YAML_SEP = '---'
|
@@ -19,99 +23,13 @@ module Webby
|
|
19
23
|
class Error < StandardError; end # :nodoc:
|
20
24
|
|
21
25
|
# call-seq:
|
22
|
-
# Webby.site =>
|
26
|
+
# Webby.site => configuration
|
23
27
|
#
|
24
|
-
# Returns
|
25
|
-
#
|
26
|
-
# site specific Rakefile.
|
28
|
+
# Returns the configuration parameters for the Webby site. These defaults
|
29
|
+
# should be overridden as needed in the site specific Rakefile.
|
27
30
|
#
|
28
31
|
def self.site
|
29
|
-
|
30
|
-
@site = OpenStruct.new(
|
31
|
-
:output_dir => 'output',
|
32
|
-
:content_dir => 'content',
|
33
|
-
:layout_dir => 'layouts',
|
34
|
-
:template_dir => 'templates',
|
35
|
-
:exclude => %w(tmp$ bak$ ~$ CVS \.svn),
|
36
|
-
:page_defaults => {
|
37
|
-
'layout' => 'default'
|
38
|
-
},
|
39
|
-
:find_by => 'title',
|
40
|
-
:base => nil,
|
41
|
-
:create_mode => 'page',
|
42
|
-
:blog_dir => 'blog',
|
43
|
-
:tumblog_dir => 'tumblog',
|
44
|
-
|
45
|
-
# Items for running the heel webserver
|
46
|
-
:use_web_server => true,
|
47
|
-
:heel_port => 4331,
|
48
|
-
|
49
|
-
# Items used to deploy the website
|
50
|
-
:user => ENV['USER'] || ENV['USERNAME'],
|
51
|
-
:host => 'example.com',
|
52
|
-
:remote_dir => '/not/a/valid/dir',
|
53
|
-
:rsync_args => %w(-av),
|
54
|
-
|
55
|
-
# Global options for HAML and SASS
|
56
|
-
:haml_options => {},
|
57
|
-
:sass_options => {},
|
58
|
-
|
59
|
-
# Options passed to the 'tidy' program when the tidy filter is used
|
60
|
-
:tidy_options => '-indent -wrap 80',
|
61
|
-
|
62
|
-
# List of valid URIs (these automatically pass validation)
|
63
|
-
:valid_uris => [],
|
64
|
-
|
65
|
-
# Options for coderay processing
|
66
|
-
:coderay => {
|
67
|
-
:lang => :ruby,
|
68
|
-
:line_numbers => nil,
|
69
|
-
:line_number_start => 1,
|
70
|
-
:bold_every => 10,
|
71
|
-
:tab_width => 8
|
72
|
-
},
|
73
|
-
|
74
|
-
# Options for graphviz processing
|
75
|
-
:graphviz => {
|
76
|
-
:path => nil,
|
77
|
-
:cmd => 'dot',
|
78
|
-
:type => 'png'
|
79
|
-
},
|
80
|
-
|
81
|
-
# Options for tex2img processing
|
82
|
-
:tex2img => {
|
83
|
-
:path => nil,
|
84
|
-
:type => 'png',
|
85
|
-
:bg => 'white',
|
86
|
-
:fg => 'black',
|
87
|
-
:resolution => '150x150'
|
88
|
-
},
|
89
|
-
|
90
|
-
# Options for ultraviolet syntax highlighting
|
91
|
-
:uv => {
|
92
|
-
:lang => 'ruby',
|
93
|
-
:line_numbers => false,
|
94
|
-
:theme => 'mac_classic'
|
95
|
-
},
|
96
|
-
|
97
|
-
# XPath identifiers used by the basepath filter
|
98
|
-
:xpaths => %w(
|
99
|
-
/html/head//base[@href]
|
100
|
-
/html/head//link[@href]
|
101
|
-
//script[@src]
|
102
|
-
/html/body[@background]
|
103
|
-
/html/body//a[@href]
|
104
|
-
/html/body//object[@data]
|
105
|
-
/html/body//img[@src]
|
106
|
-
/html/body//area[@href]
|
107
|
-
/html/body//form[@action]
|
108
|
-
/html/body//input[@src]
|
109
|
-
)
|
110
|
-
# other possible XPaths to include for base path substitution
|
111
|
-
# /html/body//object[@usemap]
|
112
|
-
# /html/body//img[@usemap]
|
113
|
-
# /html/body//input[@usemap]
|
114
|
-
)
|
32
|
+
Loquacious.configuration_for :webby
|
115
33
|
end
|
116
34
|
|
117
35
|
# call-seq
|
@@ -126,16 +44,21 @@ module Webby
|
|
126
44
|
end
|
127
45
|
|
128
46
|
# call-seq:
|
129
|
-
# Webby.
|
47
|
+
# Webby.exec_editor( *args )
|
130
48
|
#
|
131
|
-
#
|
132
|
-
#
|
49
|
+
# Calls the editor set in the Sitefile or in the environment variables
|
50
|
+
# WEBBY_EDITOR or EDITOR (in that order). This method will do nothing if
|
51
|
+
# the editor has not been set.
|
133
52
|
#
|
134
|
-
def self.
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
53
|
+
def self.exec_editor( *args )
|
54
|
+
unless defined? @editor
|
55
|
+
@editor = (site.editor.nil? or site.editor.empty?) ? nil : site.editor
|
56
|
+
@editor = @editor.split if @editor
|
57
|
+
end
|
58
|
+
return if @editor.nil?
|
59
|
+
|
60
|
+
args = [@editor, args].flatten
|
61
|
+
exec(*args)
|
139
62
|
end
|
140
63
|
|
141
64
|
# call-seq:
|
@@ -192,6 +115,17 @@ module Webby
|
|
192
115
|
Logging::Logger['Webby'].warn msg
|
193
116
|
end
|
194
117
|
|
118
|
+
# Scan the <code>layouts/</code> folder and the <code>content/</code>
|
119
|
+
# folder and create a new Resource object for each file found there.
|
120
|
+
#
|
121
|
+
def self.load_files
|
122
|
+
::Find.find(site.layout_dir, site.content_dir) do |path|
|
123
|
+
next unless test ?f, path
|
124
|
+
next if path =~ ::Webby.exclude
|
125
|
+
Resources.new path
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
195
129
|
end # module Webby
|
196
130
|
|
197
131
|
|
data/lib/webby/apps/generator.rb
CHANGED
@@ -190,7 +190,7 @@ class Generator
|
|
190
190
|
src = template / file
|
191
191
|
dst = site / file
|
192
192
|
|
193
|
-
if test(?e, dst)
|
193
|
+
if test(?e, dst)
|
194
194
|
if identical?(src, dst)
|
195
195
|
identical(dst)
|
196
196
|
return
|
@@ -229,7 +229,7 @@ class Generator
|
|
229
229
|
def site_files
|
230
230
|
exclude = %r/tmp$|bak$|~$|CVS|\.svn/o
|
231
231
|
|
232
|
-
rgxp = %r/\A#{template}\/?/
|
232
|
+
rgxp = %r/\A#{template}\/?/
|
233
233
|
paths = Hash.new {|h,k| h[k] = []}
|
234
234
|
|
235
235
|
Find.find(template) do |p|
|
data/lib/webby/apps/main.rb
CHANGED
@@ -19,6 +19,7 @@ class Main
|
|
19
19
|
def initialize
|
20
20
|
@stdout = $stdout
|
21
21
|
@cmd_line_options = {}
|
22
|
+
@command = %w[rake]
|
22
23
|
end
|
23
24
|
|
24
25
|
# Runs the main webby application. The command line arguments are passed
|
@@ -30,7 +31,7 @@ class Main
|
|
30
31
|
|
31
32
|
parse args
|
32
33
|
init args
|
33
|
-
|
34
|
+
self.__send__(*@command)
|
34
35
|
end
|
35
36
|
|
36
37
|
# Parse the command line _args_ for options and commands to invoke.
|
@@ -46,6 +47,10 @@ class Main
|
|
46
47
|
next unless desired_opts.include?(options.first)
|
47
48
|
opts.on(*options)
|
48
49
|
end
|
50
|
+
opts.on('-o', '--options [PATTERN]',
|
51
|
+
'Show configuration options (matching optional pattern), then exit.') { |value|
|
52
|
+
@command = [:show_options, value]
|
53
|
+
}
|
49
54
|
|
50
55
|
opts.separator ''
|
51
56
|
opts.separator 'autobuild options:'
|
@@ -115,6 +120,32 @@ class Main
|
|
115
120
|
app.top_level
|
116
121
|
end
|
117
122
|
|
123
|
+
# Print the available configuration options.
|
124
|
+
#
|
125
|
+
def show_options( attribute = nil )
|
126
|
+
app.init 'webby'
|
127
|
+
app.load_rakefile
|
128
|
+
|
129
|
+
desc = <<-__
|
130
|
+
The following options can be used to control Webby functionality.
|
131
|
+
Options are configured in the 'Sitefile'. A few examples are shown below:
|
132
|
+
|
|
133
|
+
| SITE.create_mode = 'directory'
|
134
|
+
| SITE.base = 'http://www.example.com'
|
135
|
+
| SITE.uv.theme = 'twilight'
|
136
|
+
|
|
137
|
+
=======< OPTIONS >=======
|
138
|
+
|
|
139
|
+
__
|
140
|
+
|
141
|
+
@stdout.puts desc.gutter!
|
142
|
+
help = Loquacious.help_for(
|
143
|
+
:webby, :io => @stdout, :colorize => ENV.key?('TERM')
|
144
|
+
)
|
145
|
+
help.show attribute, :values => true
|
146
|
+
@stdout.puts
|
147
|
+
end
|
148
|
+
|
118
149
|
# Return the Rake application object.
|
119
150
|
#
|
120
151
|
def app
|
@@ -155,7 +186,10 @@ class Main
|
|
155
186
|
end
|
156
187
|
|
157
188
|
def capture_command_line_args(args)
|
158
|
-
args = OpenStruct.new(
|
189
|
+
args = OpenStruct.new(
|
190
|
+
:raw => args,
|
191
|
+
:rake => ARGV.dup
|
192
|
+
)
|
159
193
|
|
160
194
|
if args.raw.size > 1
|
161
195
|
::Webby.deprecated "multiple arguments used for page title",
|
@@ -192,64 +226,4 @@ class Main
|
|
192
226
|
end # class Main
|
193
227
|
end # module Webby::Apps
|
194
228
|
|
195
|
-
# :stopdoc:
|
196
|
-
# Monkey patches so that rake displays the correct application name in the
|
197
|
-
# help messages.
|
198
|
-
#
|
199
|
-
class Rake::Application
|
200
|
-
def display_prerequisites
|
201
|
-
tasks.each do |t|
|
202
|
-
puts "#{name} #{t.name}"
|
203
|
-
t.prerequisites.each { |pre| puts " #{pre}" }
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
def display_tasks_and_comments
|
208
|
-
displayable_tasks = tasks.select { |t|
|
209
|
-
t.comment && t.name =~ options.show_task_pattern
|
210
|
-
}
|
211
|
-
if options.full_description
|
212
|
-
displayable_tasks.each do |t|
|
213
|
-
puts "#{name} #{t.name_with_args}"
|
214
|
-
t.full_comment.split("\n").each do |line|
|
215
|
-
puts " #{line}"
|
216
|
-
end
|
217
|
-
puts
|
218
|
-
end
|
219
|
-
else
|
220
|
-
width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10
|
221
|
-
max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil
|
222
|
-
displayable_tasks.each do |t|
|
223
|
-
printf "#{name} %-#{width}s # %s\n",
|
224
|
-
t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
# Provide standard execption handling for the given block.
|
230
|
-
def standard_exception_handling
|
231
|
-
begin
|
232
|
-
yield
|
233
|
-
rescue SystemExit => ex
|
234
|
-
# Exit silently with current status
|
235
|
-
exit(ex.status)
|
236
|
-
rescue SystemExit, OptionParser::InvalidOption => ex
|
237
|
-
# Exit silently
|
238
|
-
exit(1)
|
239
|
-
rescue Exception => ex
|
240
|
-
# Exit with error message
|
241
|
-
$stderr.puts "#{name} aborted!"
|
242
|
-
$stderr.puts ex.message
|
243
|
-
if options.trace
|
244
|
-
$stderr.puts ex.backtrace.join("\n")
|
245
|
-
else
|
246
|
-
$stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
|
247
|
-
$stderr.puts "(See full trace by running task with --trace)"
|
248
|
-
end
|
249
|
-
exit(1)
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end # class Rake::Application
|
253
|
-
# :startdoc:
|
254
|
-
|
255
229
|
# EOF
|
data/lib/webby/auto_builder.rb
CHANGED
@@ -34,7 +34,7 @@ class AutoBuilder
|
|
34
34
|
@logger = Logging::Logger[self]
|
35
35
|
|
36
36
|
@builder = Builder.new
|
37
|
-
|
37
|
+
::Webby.load_files
|
38
38
|
|
39
39
|
@watcher = DirectoryWatcher.new '.', :interval => 2
|
40
40
|
@watcher.add_observer self
|
@@ -89,7 +89,7 @@ class AutoBuilder
|
|
89
89
|
if @web_server
|
90
90
|
@web_server.start
|
91
91
|
sleep 0.25
|
92
|
-
Launchy.open("http://localhost:#{::Webby.site.
|
92
|
+
Launchy.open("http://localhost:#{::Webby.site.web_port}")
|
93
93
|
end
|
94
94
|
|
95
95
|
@watcher.join
|
@@ -111,7 +111,7 @@ class AutoBuilder
|
|
111
111
|
@running = false
|
112
112
|
@server = WEBrick::HTTPServer.new(
|
113
113
|
:BindAddress => 'localhost',
|
114
|
-
:Port => ::Webby.site.
|
114
|
+
:Port => ::Webby.site.web_port,
|
115
115
|
:DocumentRoot => ::Webby.site.output_dir,
|
116
116
|
:FancyIndexing => true,
|
117
117
|
:Logger => logger,
|