bijou 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.txt +4 -0
- data/LICENSE.txt +58 -0
- data/README.txt +48 -0
- data/Rakefile +105 -0
- data/doc/INSTALL.rdoc +260 -0
- data/doc/README.rdoc +314 -0
- data/doc/releases/bijou-0.1.0.rdoc +60 -0
- data/examples/birthday/birthday.rb +34 -0
- data/examples/holiday/holiday.rb +61 -0
- data/examples/holiday/letterhead.txt +4 -0
- data/examples/holiday/signature.txt +9 -0
- data/examples/phishing/letter.txt +29 -0
- data/examples/phishing/letterhead.txt +4 -0
- data/examples/phishing/phishing.rb +21 -0
- data/examples/phishing/signature.txt +9 -0
- data/examples/profile/profile.rb +46 -0
- data/lib/bijou.rb +15 -0
- data/lib/bijou/backend.rb +542 -0
- data/lib/bijou/cgi/adapter.rb +201 -0
- data/lib/bijou/cgi/handler.rb +5 -0
- data/lib/bijou/cgi/request.rb +37 -0
- data/lib/bijou/common.rb +12 -0
- data/lib/bijou/component.rb +108 -0
- data/lib/bijou/config.rb +60 -0
- data/lib/bijou/console/adapter.rb +167 -0
- data/lib/bijou/console/handler.rb +4 -0
- data/lib/bijou/console/request.rb +26 -0
- data/lib/bijou/context.rb +431 -0
- data/lib/bijou/diagnostics.rb +87 -0
- data/lib/bijou/errorformatter.rb +322 -0
- data/lib/bijou/exception.rb +39 -0
- data/lib/bijou/filters.rb +107 -0
- data/lib/bijou/httprequest.rb +108 -0
- data/lib/bijou/httpresponse.rb +268 -0
- data/lib/bijou/lexer.rb +513 -0
- data/lib/bijou/minicgi.rb +159 -0
- data/lib/bijou/parser.rb +1026 -0
- data/lib/bijou/processor.rb +404 -0
- data/lib/bijou/prstringio.rb +400 -0
- data/lib/bijou/webrick/adapter.rb +174 -0
- data/lib/bijou/webrick/handler.rb +32 -0
- data/lib/bijou/webrick/request.rb +45 -0
- data/script/cgi.rb +25 -0
- data/script/console.rb +7 -0
- data/script/server.rb +7 -0
- data/test/t1.cfg +5 -0
- data/test/tc_config.rb +26 -0
- data/test/tc_filter.rb +25 -0
- data/test/tc_lexer.rb +120 -0
- data/test/tc_response.rb +103 -0
- data/test/tc_ruby.rb +62 -0
- data/test/tc_stack.rb +50 -0
- metadata +121 -0
data/ChangeLog.txt
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.co.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the GPL
|
3
|
+
(see COPYING.txt file), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a) place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b) use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c) rename any non-standard executables so the names do not conflict
|
21
|
+
with standard executables, which must also be provided.
|
22
|
+
|
23
|
+
d) make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or executable
|
26
|
+
form, provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a) distribute the executables and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b) accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c) give non-standard executables non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d) make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under this terms.
|
43
|
+
|
44
|
+
They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
|
45
|
+
files under the ./missing directory. See each file for the copying
|
46
|
+
condition.
|
47
|
+
|
48
|
+
5. The scripts and library files supplied as input to or produced as
|
49
|
+
output from the software do not automatically fall under the
|
50
|
+
copyright of the software, but belong to whomever generated them,
|
51
|
+
and may be sold commercially, and may be aggregated with this
|
52
|
+
software.
|
53
|
+
|
54
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
55
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
56
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
57
|
+
PURPOSE.
|
58
|
+
|
data/README.txt
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
README.txt
|
3
|
+
|
4
|
+
Bijou is a templating system for Ruby. It was inspired by Perl's HTML::Mason.
|
5
|
+
Bijou files are text or HTML files that support in-line Ruby. Bijou also
|
6
|
+
supports the inclusion of text and code from other sources, called methods
|
7
|
+
and components. Components may be shared between files. They may also be used
|
8
|
+
as containers (sometimes called templates or layouts in other environments).
|
9
|
+
By chaining together components and containers, an arbitrarily sophisticated
|
10
|
+
system may be developed.
|
11
|
+
|
12
|
+
The Bijou home page is at
|
13
|
+
|
14
|
+
http://bijou.rubyforge.org/
|
15
|
+
|
16
|
+
The source code, Ruby Gem, etc. is available here
|
17
|
+
|
18
|
+
https://rubyforge.org/frs/?group_id=4980
|
19
|
+
|
20
|
+
The directory structure is as follows
|
21
|
+
|
22
|
+
lib/
|
23
|
+
Contains the Ruby source code for Bijou.
|
24
|
+
|
25
|
+
doc/
|
26
|
+
Contains the reference documentation in HTML format, courtesy of
|
27
|
+
RDoc. To get started, open doc/rdoc/index.html and go from there.
|
28
|
+
|
29
|
+
tests/
|
30
|
+
A basic suite of unit tests.
|
31
|
+
|
32
|
+
examples/
|
33
|
+
Several examples of how to use Bijou. Some of these are stand-alone
|
34
|
+
and do not require a web server.
|
35
|
+
|
36
|
+
Contact
|
37
|
+
|
38
|
+
Todd Lucas <tl@dogandponyshow.org>
|
39
|
+
|
40
|
+
License
|
41
|
+
|
42
|
+
Released under the same license as Ruby.
|
43
|
+
|
44
|
+
Warranty
|
45
|
+
|
46
|
+
This software is provided "as is" and without any express or implied
|
47
|
+
warranties, including, without limitation, the implied warranties of
|
48
|
+
merchantibility and fitness for a particular purpose.
|
data/Rakefile
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#
|
3
|
+
# Copyright (c) 2007-2008 by Todd Lucas
|
4
|
+
#
|
5
|
+
# Rakefile for Bijou
|
6
|
+
#
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rake'
|
9
|
+
require 'rake/clean'
|
10
|
+
require 'rake/testtask'
|
11
|
+
require 'rake/gempackagetask'
|
12
|
+
require 'rake/rdoctask'
|
13
|
+
require 'rake/contrib/sshpublisher'
|
14
|
+
|
15
|
+
PKG_VERSION = "0.1.0"
|
16
|
+
|
17
|
+
desc "Default Task"
|
18
|
+
task :default => [ :clean, :test, :package ]
|
19
|
+
|
20
|
+
CLEAN.include('pkg', 'examples/**/*.obj')
|
21
|
+
|
22
|
+
# Run the unit tests
|
23
|
+
Rake::TestTask.new { |t|
|
24
|
+
t.libs << "test"
|
25
|
+
t.pattern = 'test/tc_*.rb'
|
26
|
+
t.verbose = true
|
27
|
+
t.warning = false
|
28
|
+
}
|
29
|
+
|
30
|
+
PKG_FILES = FileList[
|
31
|
+
'Rakefile',
|
32
|
+
'README.txt',
|
33
|
+
'LICENSE.txt',
|
34
|
+
'ChangeLog.txt',
|
35
|
+
'doc/*',
|
36
|
+
'doc/releases/*',
|
37
|
+
'lib/**/*',
|
38
|
+
'examples/**/*',
|
39
|
+
'script/*.rb',
|
40
|
+
'test/*'
|
41
|
+
]
|
42
|
+
|
43
|
+
#------ Gem ----------------------------------------------------------
|
44
|
+
|
45
|
+
spec = Gem::Specification.new do |s|
|
46
|
+
s.name = "bijou"
|
47
|
+
s.version = PKG_VERSION
|
48
|
+
s.author = "Todd Lucas"
|
49
|
+
s.email = "tl@dogandponyshow.org"
|
50
|
+
s.homepage = "http://bijou.rubyforge.org/"
|
51
|
+
s.platform = Gem::Platform::RUBY
|
52
|
+
s.summary = "Bijou is a web templating system for Ruby."
|
53
|
+
s.description = <<EOS
|
54
|
+
Bijou is a web templating system in the style of Perl\'s HTML::Mason project.
|
55
|
+
It is a flexible system that allows HTML to be mixed with Ruby code, and to
|
56
|
+
allow page fragments to be shared and combined in a number of ways. It is
|
57
|
+
written in pure Ruby with minimal dependencies and is designed to be run in
|
58
|
+
a number of configurations, including as a CGI script, using the lightweight
|
59
|
+
WEBrick server, or stand-alone via the stdio console.
|
60
|
+
EOS
|
61
|
+
s.files = PKG_FILES.to_a
|
62
|
+
s.require_path = "lib" # make the default explicit
|
63
|
+
|
64
|
+
s.test_files = FileList["test/tc_*.rb"]
|
65
|
+
|
66
|
+
s.required_ruby_version = '>= 1.8.4'
|
67
|
+
s.rubyforge_project = 'bijou'
|
68
|
+
|
69
|
+
# NOTE: Only applies to Gems
|
70
|
+
# s.add_dependency('digest/sha1')
|
71
|
+
|
72
|
+
s.has_rdoc = true # Advisory
|
73
|
+
|
74
|
+
# We must duplicate rdoc directives here because this controls how the RDoc
|
75
|
+
# gets built during Gem installation (distinct from rake rdoc task).
|
76
|
+
s.rdoc_options << '--main' << 'lib/bijou.rb'
|
77
|
+
s.rdoc_options << "--inline-source" << "--line-numbers"
|
78
|
+
end
|
79
|
+
|
80
|
+
# Rake task to build the package
|
81
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
82
|
+
pkg.need_tar = true
|
83
|
+
pkg.need_zip = true
|
84
|
+
end
|
85
|
+
|
86
|
+
#------ RDoc Documentation -------------------------------------------
|
87
|
+
|
88
|
+
desc "Generate rdoc documentation"
|
89
|
+
Rake::RDocTask.new("rdoc") do |rdoc|
|
90
|
+
rdoc.rdoc_dir = 'doc/rdoc'
|
91
|
+
rdoc.title = "Bijou - Web templates for Ruby"
|
92
|
+
|
93
|
+
# Make the readme file the start page for the generated html
|
94
|
+
rdoc.options << '--main' << 'doc/README.rdoc'
|
95
|
+
|
96
|
+
# Show source inline with line numbers
|
97
|
+
rdoc.options << "--inline-source" << "--line-numbers"
|
98
|
+
|
99
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
100
|
+
|
101
|
+
rdoc.rdoc_files.include('doc/*.rdoc',
|
102
|
+
'lib/**/*.rb',
|
103
|
+
'doc/releases/*.rdoc')
|
104
|
+
rdoc.rdoc_files.exclude(/\btest\b/)
|
105
|
+
end
|
data/doc/INSTALL.rdoc
ADDED
@@ -0,0 +1,260 @@
|
|
1
|
+
= Bijou - Installation instructions
|
2
|
+
|
3
|
+
== Overview
|
4
|
+
|
5
|
+
This first release of Bijou is intended as a technology demonstration (i.e.,
|
6
|
+
alpha). For this reason, it only supports basic web server configurations.
|
7
|
+
|
8
|
+
CGI script:: tested with Apache
|
9
|
+
WEBrick:: for running a light-weight, stand-alone server
|
10
|
+
Standard I/O console:: primarily for testing and debugging
|
11
|
+
|
12
|
+
This guide will show you how to run under these configurations, so that you
|
13
|
+
can give Bijou a try. If you like it and would like to see continued
|
14
|
+
development, please register your interest by commenting in the project
|
15
|
+
forums[https://rubyforge.org/forum/?group_id=4980] at rubyforge or by
|
16
|
+
sending email.
|
17
|
+
|
18
|
+
We hope to add to the supported list of web servers and environments soon.
|
19
|
+
In particular, a FastCGI or SCGI handler, as well as Mongrel support.
|
20
|
+
|
21
|
+
=== Install
|
22
|
+
|
23
|
+
First, install the gem file. On *nix machines, you'll need root, so running
|
24
|
+
|
25
|
+
sudo gem install bijou
|
26
|
+
|
27
|
+
should suffice. On other platforms, such as Windows, you can just run
|
28
|
+
|
29
|
+
gem install bijou
|
30
|
+
|
31
|
+
This will download the gem from rubyforge and install it. If you're installing
|
32
|
+
from a local gem file, you must specify the filename itself.
|
33
|
+
|
34
|
+
[sudo] gem install bijou-0.1.0.gem
|
35
|
+
|
36
|
+
=== Uninstall
|
37
|
+
|
38
|
+
To uninstall the gem, just run
|
39
|
+
|
40
|
+
[sudo] gem uninstall bijou
|
41
|
+
|
42
|
+
regardless of whether you installed from rubyforge or from a local file.
|
43
|
+
|
44
|
+
== Setup
|
45
|
+
|
46
|
+
All of the simple entry points to the Bijou processor are provided in the
|
47
|
+
<tt>scripts</tt> subdirectory of the package.
|
48
|
+
|
49
|
+
The package location will depend on the platform used and how it was installed.
|
50
|
+
On a *nix system, if the package were installed as root, the path would be
|
51
|
+
similar to
|
52
|
+
|
53
|
+
/usr/local/lib/ruby/gems/1.8
|
54
|
+
|
55
|
+
On Windows, it would be similar to
|
56
|
+
|
57
|
+
C:\Program Files\Ruby\lib\ruby\gems\1.8\gems\bijou-0.1.0\script
|
58
|
+
|
59
|
+
or
|
60
|
+
|
61
|
+
C:\ruby\lib\ruby\gems\1.8\gems\bijou-0.1.0\script
|
62
|
+
|
63
|
+
The three files we'll be dealing with are
|
64
|
+
|
65
|
+
- console.rb
|
66
|
+
- server.rb
|
67
|
+
- cgi.rb
|
68
|
+
|
69
|
+
=== Console
|
70
|
+
|
71
|
+
First, go to the scripts subdirectory under the installation directory.
|
72
|
+
From the command line, run
|
73
|
+
|
74
|
+
ruby console.rb [flags] <filename>
|
75
|
+
|
76
|
+
This will invoke the Bijou processor as if it were a web server serving up the
|
77
|
+
page specified by <tt>filename</tt>. To pass query string arguments, use the
|
78
|
+
-q or --query flag.
|
79
|
+
|
80
|
+
ruby console.rb --query "user=bill&pass=twinkies" login.rbb
|
81
|
+
|
82
|
+
The file extension is unimportant in this case. It becomes more important when
|
83
|
+
running CGI under Apache.
|
84
|
+
|
85
|
+
The results are rendered to standard out, so it might be a little
|
86
|
+
disappointing--especially if you've constructed a complex page with HTML.
|
87
|
+
We suggest using plain text and simple pages when testing via the console.
|
88
|
+
|
89
|
+
This can be especially helpful if you get an Internal Server Error later on
|
90
|
+
when running under Apache. Apache is very sensitive to extraneous output while
|
91
|
+
HTTP headers are being generated (as it should be). This is a first version,
|
92
|
+
and there are still cases where an exception will be triggered that will
|
93
|
+
result in text choking the Apache header parser. Running your page at
|
94
|
+
the console will give you a better idea of what caused the error.
|
95
|
+
|
96
|
+
Also, if you see such an error, please post a bug to the rubyforge project
|
97
|
+
tracker--preferably with a reproduction case (like a simple Bijou page that
|
98
|
+
demonstrates the problem). That way it'll be more likely to be fixed in the
|
99
|
+
next release.
|
100
|
+
|
101
|
+
Note: the console.rb file can be copied to another directory, such as the
|
102
|
+
location of your web project, and be run from there. This can be handy for
|
103
|
+
customizing the script to suit your needs.
|
104
|
+
|
105
|
+
=== WEBrick
|
106
|
+
|
107
|
+
This is a nice little server that can be used to get a real taste of writing
|
108
|
+
web pages using Bijou, without the hassle of setting up Apache. WEBrick is
|
109
|
+
very straightforward to use, at the cost of some missing features. In
|
110
|
+
particular, you cannot POST forms using WEBrick. So any test pages you
|
111
|
+
have containing forms should specifiy:
|
112
|
+
|
113
|
+
<form method="GET">...
|
114
|
+
|
115
|
+
This will pass the form parameters via the query-string channel and will
|
116
|
+
be good enough to get you started.
|
117
|
+
|
118
|
+
To run WEBrick, just go to to the bijou <tt>scripts</tt> directory and type
|
119
|
+
|
120
|
+
ruby server.rb
|
121
|
+
|
122
|
+
This will run WEBrick at the default port location of 2000. By default, the
|
123
|
+
WEBrick server assumes that the current directory is the web server's root
|
124
|
+
directory. To change that, you may set the environment variable DOCUMENT_ROOT
|
125
|
+
to an absolute path prior to calling WEBbrick.
|
126
|
+
|
127
|
+
You may also specify a config file by setting the environment variable
|
128
|
+
BIJOU_CONFIG to point to a config file (e.g., www.cfg), that conforms to the
|
129
|
+
Bijou config file format (see the Configuration section).
|
130
|
+
|
131
|
+
Note: currently, the only extensions recognized as Bijou files are (.rbb, .htm,
|
132
|
+
and .html). A feature for a future release is a matching regex that may be
|
133
|
+
specified via the config file. This limitation is specific to WEBrick since
|
134
|
+
Apache has a built-in mechanism for handling file types.
|
135
|
+
|
136
|
+
To test, let's assume you have a file in the current directory called
|
137
|
+
<tt>hello.rbb</tt>. To access this file, go to your browser and type the URL:
|
138
|
+
|
139
|
+
http://localhost:2000/hello.rbb
|
140
|
+
|
141
|
+
You should see the result in your browser.
|
142
|
+
|
143
|
+
=== CGI
|
144
|
+
|
145
|
+
The CGI handler should be able to be run under any web server that supports
|
146
|
+
CGI. To date, it has only been tested under Apache (and only version 2.2, at
|
147
|
+
that).
|
148
|
+
|
149
|
+
==== Apache
|
150
|
+
|
151
|
+
First, the <tt>cgi.rb</tt> file in the <tt>scripts</tt> directory should
|
152
|
+
be copied to the CGI directory, specified in the Apache <tt>http.conf</tt> file,
|
153
|
+
and given an appropriate name. For example, <tt>bijoucgi.rb</tt> or
|
154
|
+
<tt>bijou.cgi</tt>.
|
155
|
+
|
156
|
+
The cgi-bin directory may be defined by <tt>ScriptAlias</tt> (part of
|
157
|
+
mod_alias). For example, on Windows:
|
158
|
+
|
159
|
+
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
|
160
|
+
|
161
|
+
In this case, copy <tt>cgi.rb</tt> to this directory. If Bijou has been
|
162
|
+
installed, <tt>cgi.rb</tt> will be able to invoke the Bijou CGI handler.
|
163
|
+
|
164
|
+
After copying the file, be sure to update the <tt>#!</tt> line at the top of
|
165
|
+
the file to refer to the installed Ruby path. Apache requires this directive--
|
166
|
+
even on systems, such as Windows, which have shells that do not recognize it.
|
167
|
+
|
168
|
+
Finally, Apache will need to be configured. This requires editing the
|
169
|
+
configuration file, typically called <tt>http.conf</tt>. The following is an
|
170
|
+
example VirtualHost section, showing Windows file paths.
|
171
|
+
|
172
|
+
<VirtualHost *:80>
|
173
|
+
ServerName localhost
|
174
|
+
ServerAdmin webmaster@example.com
|
175
|
+
DocumentRoot "C:/projects/mysite/www"
|
176
|
+
|
177
|
+
SetEnv BIJOU_CACHE "C:/projects/mysite/www_cache"
|
178
|
+
SetEnv BIJOU_CONFIG "C:/projects/mysite/www.cfg"
|
179
|
+
|
180
|
+
Action bijou-cgi /cgi-bin/bijoucgi.rb
|
181
|
+
|
182
|
+
<LocationMatch "\.(rbb|html|htm|xml)$">
|
183
|
+
Options +ExecCGI
|
184
|
+
</LocationMatch>
|
185
|
+
|
186
|
+
DirectoryIndex "index.html"
|
187
|
+
|
188
|
+
<Directory "C:/projects/mysite/www">
|
189
|
+
AddHandler bijou-cgi .htm .html .rbb .xml
|
190
|
+
Options Includes FollowSymLinks
|
191
|
+
AllowOverride None
|
192
|
+
Order allow,deny
|
193
|
+
Allow from all
|
194
|
+
</Directory>
|
195
|
+
</VirtualHost>
|
196
|
+
|
197
|
+
There are many different ways to set up your Apache config file. This example
|
198
|
+
contains the key options for running Bijou. Namely:
|
199
|
+
|
200
|
+
DocumentRoot "C:/projects/mysite/www"
|
201
|
+
|
202
|
+
SetEnv BIJOU_CACHE "C:/projects/mysite/www_cache"
|
203
|
+
SetEnv BIJOU_CONFIG "C:/projects/mysite/www.cfg"
|
204
|
+
|
205
|
+
Action bijou-cgi /cgi-bin/bijoucgi.rb
|
206
|
+
|
207
|
+
AddHandler bijou-cgi .htm .html .rbb .xml
|
208
|
+
|
209
|
+
This results in the expected environment variables being set and the
|
210
|
+
<tt>bijoucgi.rb</tt> file being called when particular file types are
|
211
|
+
requested.
|
212
|
+
|
213
|
+
Two final points remain. First, Apache requires the action handler to support
|
214
|
+
the <tt>Action</tt> directive:
|
215
|
+
|
216
|
+
LoadModule actions_module modules/mod_actions.so
|
217
|
+
|
218
|
+
Second, Apache support for CGI requires the cgi module, which is usually
|
219
|
+
enabled:
|
220
|
+
|
221
|
+
LoadModule cgi_module modules/mod_cgi.so
|
222
|
+
|
223
|
+
If you have any problems or suggestions, please let us know in the
|
224
|
+
Bijou Forums[https://rubyforge.org/forum/?group_id=4980].
|
225
|
+
|
226
|
+
--
|
227
|
+
==== .htaccess
|
228
|
+
|
229
|
+
TBD
|
230
|
+
++
|
231
|
+
|
232
|
+
== Reference
|
233
|
+
|
234
|
+
=== Configuration
|
235
|
+
|
236
|
+
A configuration file can be specified to control how Bijou operates. This file
|
237
|
+
is usually specified via the environment variable BIJOU_CONFIG. If the variable
|
238
|
+
is defined, the server adapter will load the file at that location and use it
|
239
|
+
to tailor the operation of the Bijou processor and runtime environment.
|
240
|
+
|
241
|
+
[<b>@document_root</b>] String - The location to search when loading a requested file. This should be an absolute path to the top-level directory containing your web pages.
|
242
|
+
|
243
|
+
[<b>@cache_root</b>] String - The name of a directory to use as a cache for parsed Bijou files. This is often <web-directory>_cache (e.g., www_cache) located parallel to the web directory.
|
244
|
+
|
245
|
+
[<b>@cache_ext</b>] String - If the cache files are to be located in the same directory as the source files, an extension must be specified. For example, ".obj" would cause the cached file for index.rbb to be named index.rbb.obj.
|
246
|
+
|
247
|
+
[<b>@includes</b>] String - An array containing any additional paths to include during the request. This can simplify <tt>require</tt> calls. Absolute paths are recommended. For example <tt>@includes=['/home/me/proj/app', '/home/me/proj/lib']</tt>.
|
248
|
+
|
249
|
+
[<b>@component_base</b>] String - The class to use for the base of all components. By default, this is <tt>Bijou::Component</tt>. However, if you derive a customized class from <tt>Bijou::Component</tt> and you would like to use it everywhere, it may be specified here as a string. To use a different base on a case-by-case basis, use the base directive (e.g., <%! base="MyComponent" %>).
|
250
|
+
|
251
|
+
[<b>@require_list</b>] Array - Like the @includes parameter, this is an array. Any requires that should be automatically included in the generated component files. This is particularly useful if a customized base is being used. For example, to use <tt>MyComponent</tt> as the default base (which should derive from <tt>Bijou::Component</tt>), the path to this file should be included here.
|
252
|
+
|
253
|
+
[<b>@cache</b>] Boolean - The cache value is true by default. To disable caching, set it to false. Caching should normally be used to avoid parsing components on every request. When caching is enabled, if a component is modified, the processor will parse the file and update the cache. This is primarily useful when hacking on the framework.
|
254
|
+
|
255
|
+
[<b>@debug</b>] Boolean - Can be used to add diagnostics
|
256
|
+
|
257
|
+
[<b>@trace_level</b>] Bijou::Log or integer - A number from 0 - 3 or a constant to indicate the trace level. By default it is 0 (or Bijou::Log::None), which disables tracing.
|
258
|
+
|
259
|
+
[<b>@trace_buffer</b>] Boolean - Causes trace output to be buffered instead of beging rendered inline. Rendering inline is discouraged because it can cause output to precede the HTTP headers, yielding, for example, an internal server error on Apache. True by default.
|
260
|
+
|