ruby-web 1.1.1
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/ChangeLog +474 -0
- data/INSTALL.txt +9 -0
- data/InstalledFiles +180 -0
- data/LICENSE.txt +74 -0
- data/Rakefile +529 -0
- data/TODO +65 -0
- data/doc/additional.xml +149 -0
- data/doc/core.xml +652 -0
- data/doc/credits/index.xml +52 -0
- data/doc/credits/php.contributors.xml +118 -0
- data/doc/credits/php.language-snippets.ent +622 -0
- data/doc/install/index.xml +136 -0
- data/doc/install/mac/index.xml +21 -0
- data/doc/install/ruby-web.install.rb.instructions.xml +7 -0
- data/doc/install/unix/index.xml +46 -0
- data/doc/install/win/apache1.xml +166 -0
- data/doc/install/win/apache2.xml +141 -0
- data/doc/install/win/iis.xml +162 -0
- data/doc/install/win/index.xml +24 -0
- data/doc/install/win/installer.xml +31 -0
- data/doc/install/win/manual.xml +43 -0
- data/doc/manual.xml +69 -0
- data/doc/old/apache_cgi.txt +23 -0
- data/doc/old/fastcgi.txt +23 -0
- data/doc/old/mod_ruby.txt +21 -0
- data/doc/old/snippets.rdoc +183 -0
- data/doc/old/webrick.txt +23 -0
- data/doc/old/windows_cgi.txt +9 -0
- data/doc/tutorial.xml +14 -0
- data/doc/xsl/manual-multi.xsl +10 -0
- data/doc/xsl/manual-pdf.xsl +6 -0
- data/doc/xsl/manual-single.xsl +6 -0
- data/doc/xsl/manual.css +22 -0
- data/install.rb +1022 -0
- data/lib/formatter.rb +314 -0
- data/lib/html-parser.rb +429 -0
- data/lib/htmlrepair.rb +113 -0
- data/lib/htmlsplit.rb +842 -0
- data/lib/sgml-parser.rb +332 -0
- data/lib/web.rb +68 -0
- data/lib/web/assertinclude.rb +129 -0
- data/lib/web/config.rb +50 -0
- data/lib/web/connection.rb +1070 -0
- data/lib/web/convenience.rb +154 -0
- data/lib/web/formreader.rb +318 -0
- data/lib/web/htmlparser/html-parser.rb +429 -0
- data/lib/web/htmlparser/sgml-parser.rb +332 -0
- data/lib/web/htmltools/element.rb +296 -0
- data/lib/web/htmltools/stparser.rb +276 -0
- data/lib/web/htmltools/tags.rb +286 -0
- data/lib/web/htmltools/tree.rb +139 -0
- data/lib/web/htmltools/xmltree.rb +160 -0
- data/lib/web/htmltools/xpath.rb +71 -0
- data/lib/web/info.rb +63 -0
- data/lib/web/load.rb +210 -0
- data/lib/web/mime.rb +87 -0
- data/lib/web/phprb.rb +340 -0
- data/lib/web/resources/test/cookie.rb +33 -0
- data/lib/web/resources/test/counter.rb +20 -0
- data/lib/web/resources/test/multipart.rb +14 -0
- data/lib/web/resources/test/redirect.rb +8 -0
- data/lib/web/resources/test/stock.rb +33 -0
- data/lib/web/sapi/apache.rb +129 -0
- data/lib/web/sapi/fastcgi.rb +22 -0
- data/lib/web/sapi/install/apache.rb +180 -0
- data/lib/web/sapi/install/iis.rb +93 -0
- data/lib/web/sapi/install/macosx.rb +90 -0
- data/lib/web/sapi/webrick.rb +86 -0
- data/lib/web/session.rb +83 -0
- data/lib/web/shim/cgi.rb +129 -0
- data/lib/web/shim/rails.rb +175 -0
- data/lib/web/stringio.rb +78 -0
- data/lib/web/strscanparser.rb +24 -0
- data/lib/web/tagparser.rb +96 -0
- data/lib/web/testing.rb +666 -0
- data/lib/web/traceoutput.rb +75 -0
- data/lib/web/unit.rb +56 -0
- data/lib/web/upload.rb +59 -0
- data/lib/web/validate.rb +52 -0
- data/lib/web/wiki.rb +557 -0
- data/lib/web/wiki/linker.rb +72 -0
- data/lib/web/wiki/page.rb +201 -0
- data/lib/webunit.rb +27 -0
- data/lib/webunit/assert.rb +152 -0
- data/lib/webunit/converter.rb +154 -0
- data/lib/webunit/cookie.rb +118 -0
- data/lib/webunit/domwalker.rb +185 -0
- data/lib/webunit/exception.rb +14 -0
- data/lib/webunit/form.rb +116 -0
- data/lib/webunit/frame.rb +37 -0
- data/lib/webunit/htmlelem.rb +122 -0
- data/lib/webunit/image.rb +26 -0
- data/lib/webunit/jscript.rb +31 -0
- data/lib/webunit/link.rb +33 -0
- data/lib/webunit/params.rb +321 -0
- data/lib/webunit/parser.rb +229 -0
- data/lib/webunit/response.rb +464 -0
- data/lib/webunit/runtest.rb +41 -0
- data/lib/webunit/table.rb +148 -0
- data/lib/webunit/testcase.rb +45 -0
- data/lib/webunit/ui/cui/testrunner.rb +50 -0
- data/lib/webunit/utils.rb +68 -0
- data/lib/webunit/webunit.rb +28 -0
- data/test/dev/action.rb +83 -0
- data/test/dev/forms.rb +104 -0
- data/test/dev/forms2.rb +104 -0
- data/test/dev/parser.rb +17 -0
- data/test/dev/scripts/dump.rb +24 -0
- data/test/dev/scripts/makedist.rb +62 -0
- data/test/dev/scripts/uri.rb +41 -0
- data/test/dev/scripts/uri/common.rb +432 -0
- data/test/dev/scripts/uri/ftp.rb +149 -0
- data/test/dev/scripts/uri/generic.rb +1106 -0
- data/test/dev/scripts/uri/http.rb +76 -0
- data/test/dev/scripts/uri/https.rb +26 -0
- data/test/dev/scripts/uri/ldap.rb +238 -0
- data/test/dev/scripts/uri/mailto.rb +260 -0
- data/test/dev/scripts/urireg.rb +174 -0
- data/test/dev/simpledispatcher.rb +156 -0
- data/test/dev/test.action.rb +146 -0
- data/test/dev/test.formreader.rb +463 -0
- data/test/dev/test.simpledispatcher.rb +186 -0
- data/test/dev/webunit/conv/digit-0.rb +21 -0
- data/test/dev/webunit/conv/digit-1.rb +17 -0
- data/test/dev/webunit/conv/digit.rb +23 -0
- data/test/dev/webunit/conv/test_digit-0.rb +16 -0
- data/test/dev/webunit/conv/test_digit-1.rb +19 -0
- data/test/dev/webunit/conv/test_digit.rb +26 -0
- data/test/dev/webunit/conv/test_digit_view-0.rb +76 -0
- data/test/dev/webunit/conv/test_digit_view-1.rb +102 -0
- data/test/dev/webunit/conv/test_digit_view.rb +134 -0
- data/test/installation/htdocs/cgi_test.rb +296 -0
- data/test/installation/htdocs/test_install.rb +4 -0
- data/test/installation/runwebtest.rb +5 -0
- data/test/installation/test_cookie.rb +128 -0
- data/test/installation/test_form.rb +47 -0
- data/test/installation/test_multipart.rb +51 -0
- data/test/installation/test_request.rb +24 -0
- data/test/installation/test_response.rb +35 -0
- data/test/unit/htdocs/cookie.rb +32 -0
- data/test/unit/htdocs/multipart.rb +28 -0
- data/test/unit/htdocs/redirect.rb +12 -0
- data/test/unit/htdocs/simple.rb +13 -0
- data/test/unit/htdocs/stock.rb +33 -0
- data/test/unit/test_assert.rb +162 -0
- data/test/unit/test_cookie.rb +114 -0
- data/test/unit/test_domwalker.rb +77 -0
- data/test/unit/test_form.rb +42 -0
- data/test/unit/test_frame.rb +40 -0
- data/test/unit/test_htmlelem.rb +74 -0
- data/test/unit/test_image.rb +45 -0
- data/test/unit/test_jscript.rb +57 -0
- data/test/unit/test_link.rb +85 -0
- data/test/unit/test_multipart.rb +51 -0
- data/test/unit/test_params.rb +210 -0
- data/test/unit/test_parser.rb +53 -0
- data/test/unit/test_response.rb +150 -0
- data/test/unit/test_table.rb +70 -0
- data/test/unit/test_utils.rb +106 -0
- data/test/unit/test_webunit.rb +28 -0
- data/test/web/mod_ruby_stub.rb +39 -0
- data/test/web/test.assertinclude.rb +109 -0
- data/test/web/test.buffer.rb +182 -0
- data/test/web/test.code.loader.rb +78 -0
- data/test/web/test.config.rb +31 -0
- data/test/web/test.error.handling.rb +91 -0
- data/test/web/test.formreader-2.0.rb +352 -0
- data/test/web/test.load.rb +125 -0
- data/test/web/test.mime-type.rb +23 -0
- data/test/web/test.narf.cgi.rb +106 -0
- data/test/web/test.phprb.rb +239 -0
- data/test/web/test.request.rb +368 -0
- data/test/web/test.response.rb +637 -0
- data/test/web/test.ruby-web.rb +10 -0
- data/test/web/test.session.rb +50 -0
- data/test/web/test.shim.cgi.rb +96 -0
- data/test/web/test.tagparser.rb +65 -0
- data/test/web/test.template2.rb +297 -0
- data/test/web/test.testing2.rb +318 -0
- data/test/web/test.upload.rb +45 -0
- data/test/web/test.validate.rb +46 -0
- data/test/web/test.web.test.rb +495 -0
- data/test/wiki/test.history.rb +297 -0
- data/test/wiki/test.illustration_page.rb +287 -0
- data/test/wiki/test.linker.rb +197 -0
- data/test/wiki/test.tarpit.rb +56 -0
- data/test/wiki/test.wiki.rb +300 -0
- data/test/wikitestroot/admin.rb +7 -0
- data/test/wikitestroot/wiki.rb +6 -0
- metadata +234 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!-- $Revision: 1.17 $ -->
|
|
3
|
+
<sect1 id="install.windows.iis">
|
|
4
|
+
<title>Microsoft IIS</title>
|
|
5
|
+
<para>
|
|
6
|
+
This section contains notes and hints specific to IIS (Microsoft
|
|
7
|
+
Internet Information Server).
|
|
8
|
+
</para>
|
|
9
|
+
|
|
10
|
+
<sect2 id="install.windows.iis.general">
|
|
11
|
+
<title>General considerations for all installations of ruby-web with IIS</title>
|
|
12
|
+
<para>
|
|
13
|
+
<itemizedlist>
|
|
14
|
+
<listitem>
|
|
15
|
+
<simpara>
|
|
16
|
+
First, read the <link linkend="install.windows.manual">Manual
|
|
17
|
+
Installation Instructions</link>. Do not skip this step as it
|
|
18
|
+
provides crucial information for installing ruby-web on Windows.
|
|
19
|
+
</simpara>
|
|
20
|
+
</listitem>
|
|
21
|
+
<listitem>
|
|
22
|
+
<simpara>
|
|
23
|
+
The &rubyweb; CGI is named <filename>ruby-web.exe</filename>
|
|
24
|
+
</simpara>
|
|
25
|
+
</listitem>
|
|
26
|
+
<listitem>
|
|
27
|
+
<simpara>
|
|
28
|
+
The IIS user (usually IUSR_MACHINENAME) needs permission to
|
|
29
|
+
read various files and directories, including c:/ruby/bin, c:/ruby/lib, docroot, and the
|
|
30
|
+
session tmp directory.
|
|
31
|
+
</simpara>
|
|
32
|
+
</listitem>
|
|
33
|
+
<listitem>
|
|
34
|
+
<simpara>
|
|
35
|
+
When defining the executable, the 'check that file exists' box may also
|
|
36
|
+
be checked. For a small performance penalty, the IIS (or PWS) will check
|
|
37
|
+
that the script file exists and sort out authentication before firing up
|
|
38
|
+
ruby-web. <!--This means that the web server will provide sensible 404 style
|
|
39
|
+
error messages instead of CGI errors complaining that ruby-web did not output
|
|
40
|
+
any data.-->
|
|
41
|
+
</simpara>
|
|
42
|
+
</listitem>
|
|
43
|
+
</itemizedlist>
|
|
44
|
+
</para>
|
|
45
|
+
</sect2>
|
|
46
|
+
|
|
47
|
+
<sect2 id="install.windows.iis.iis4">
|
|
48
|
+
<title>Windows NT/200x/XP and IIS 4 or newer</title>
|
|
49
|
+
|
|
50
|
+
<simpara>
|
|
51
|
+
&rubyweb; may be installed as a CGI or Fast CGI script.
|
|
52
|
+
In either case, you need to start the Microsoft Management
|
|
53
|
+
Console (may appear as 'Internet Services Manager', either
|
|
54
|
+
in your Windows NT 4.0 Option Pack branch or the Control
|
|
55
|
+
Panel=>Administrative Tools under Windows 2000/XP). Then
|
|
56
|
+
right click on your Web server node (this will most probably
|
|
57
|
+
appear as 'Default Web Server'), and select 'Properties'.
|
|
58
|
+
</simpara>
|
|
59
|
+
|
|
60
|
+
<para>
|
|
61
|
+
If you want to install &rubyweb; as a CGI, do the following:
|
|
62
|
+
<itemizedlist>
|
|
63
|
+
<listitem>
|
|
64
|
+
<simpara>
|
|
65
|
+
Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
|
|
66
|
+
following:
|
|
67
|
+
</simpara>
|
|
68
|
+
</listitem>
|
|
69
|
+
<listitem>
|
|
70
|
+
<simpara>
|
|
71
|
+
Change the Execute Permissions to 'Scripts only'
|
|
72
|
+
</simpara>
|
|
73
|
+
</listitem>
|
|
74
|
+
<listitem>
|
|
75
|
+
<simpara>
|
|
76
|
+
Click on the 'Configuration' button, and choose the Application Mappings
|
|
77
|
+
tab. Click Add and set the Executable path to the
|
|
78
|
+
<filename>ruby-web.exe</filename> file.
|
|
79
|
+
An example value is: <filename>C:\ruby\bin\ruby-web.exe</filename>
|
|
80
|
+
Supply <literal>.rb</literal> or <literal>.rhtml</literal> as the extension.
|
|
81
|
+
Leave 'Method exclusions' blank, and check the 'Script engine' checkbox.
|
|
82
|
+
Now, click OK a few times.
|
|
83
|
+
</simpara>
|
|
84
|
+
</listitem>
|
|
85
|
+
<listitem>
|
|
86
|
+
<simpara>
|
|
87
|
+
Set up the appropriate security. (This is done in Internet
|
|
88
|
+
Service Manager), and if your NT Server uses NTFS file system,
|
|
89
|
+
add execute rights for I_USR_ to the <filename>c:\ruby\bin</filename>
|
|
90
|
+
and read rights for I_USR_ to the <filename>c:\ruby\lib</filename> directories.
|
|
91
|
+
</simpara>
|
|
92
|
+
</listitem>
|
|
93
|
+
</itemizedlist>
|
|
94
|
+
</para>
|
|
95
|
+
|
|
96
|
+
<para>
|
|
97
|
+
To install ruby-web.exe as a FastCGI script, do the following:
|
|
98
|
+
<itemizedlist>
|
|
99
|
+
<!--listitem>
|
|
100
|
+
<simpara>
|
|
101
|
+
If you don't want to perform HTTP Authentication using ruby-web,
|
|
102
|
+
you can (and should) skip this step. Under ISAPI Filters,
|
|
103
|
+
add a new ISAPI filter. Use RB as the filter name, and
|
|
104
|
+
supply a path to the <filename>ruby-web1isapi.dll</filename> /
|
|
105
|
+
<filename>ruby-web1isapi.dll</filename>.
|
|
106
|
+
</simpara>
|
|
107
|
+
</listitem-->
|
|
108
|
+
<listitem>
|
|
109
|
+
<simpara>
|
|
110
|
+
Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
|
|
111
|
+
following:
|
|
112
|
+
</simpara>
|
|
113
|
+
</listitem>
|
|
114
|
+
<listitem>
|
|
115
|
+
<simpara>
|
|
116
|
+
Change the Execute Permissions to 'Scripts only'
|
|
117
|
+
</simpara>
|
|
118
|
+
</listitem>
|
|
119
|
+
<listitem>
|
|
120
|
+
<simpara>
|
|
121
|
+
Click on the 'Configuration' button, and choose the Application Mappings
|
|
122
|
+
tab. Click Add and set the Executable path to the isapi_fastcgi.dll.
|
|
123
|
+
The ruby-web windows installer will drop this file into:
|
|
124
|
+
<filename>C:\ruby\lib\isapi_fastcgi.dll</filename>
|
|
125
|
+
Supply <literal>.rb</literal> / <literal>.rhtml</literal> as the extension. Leave 'Method
|
|
126
|
+
exclusions' blank, and check the 'Script engine' checkbox. Now, click
|
|
127
|
+
OK a few times.
|
|
128
|
+
</simpara>
|
|
129
|
+
</listitem>
|
|
130
|
+
<listitem>
|
|
131
|
+
<simpara>
|
|
132
|
+
Stop IIS completely (NET STOP iisadmin)
|
|
133
|
+
</simpara>
|
|
134
|
+
</listitem>
|
|
135
|
+
<listitem>
|
|
136
|
+
<simpara>
|
|
137
|
+
Start IIS again (NET START w3svc)
|
|
138
|
+
</simpara>
|
|
139
|
+
</listitem>
|
|
140
|
+
</itemizedlist>
|
|
141
|
+
</para>
|
|
142
|
+
<!--para>
|
|
143
|
+
With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service
|
|
144
|
+
Extensions, choose "Add a new Web service extension", enter in a name such
|
|
145
|
+
as ruby-web, choose the Add button and for the value browse to either the ISAPI
|
|
146
|
+
file (<filename>ruby-web1isapi.dll</filename> or
|
|
147
|
+
<filename>ruby-web1isapi.dll</filename>) or CGI (<filename>ruby-web.exe</filename>) then check "Set extension status to
|
|
148
|
+
Allowed" and click OK.
|
|
149
|
+
</para-->
|
|
150
|
+
<para>
|
|
151
|
+
In order to use <filename>index.rhtml</filename> as a default content page,
|
|
152
|
+
do the following: From within the Documents tab, choose Add. Type in
|
|
153
|
+
<filename>index.rhtml</filename> and click OK. Adjust the order by choosing
|
|
154
|
+
Move Up or Move Down. This is similar to setting DirectoryIndex with
|
|
155
|
+
Apache.
|
|
156
|
+
</para>
|
|
157
|
+
<!--para>
|
|
158
|
+
If you experience 100% CPU usage after some time, turn off the IIS
|
|
159
|
+
setting <literal>Cache ISAPI Application</literal>.
|
|
160
|
+
</para-->
|
|
161
|
+
</sect2>
|
|
162
|
+
</sect1>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<chapter id="install.windows">
|
|
2
|
+
<title>Installation on Windows systems</title>
|
|
3
|
+
<para>
|
|
4
|
+
There are two main ways to install ruby-web for Windows: either
|
|
5
|
+
<link linkend="install.windows.manual">manually</link>
|
|
6
|
+
or by using the <link linkend="install.windows.installer">installer</link>.
|
|
7
|
+
</para>
|
|
8
|
+
<!--para>
|
|
9
|
+
If you have Microsoft Visual Studio, you can also
|
|
10
|
+
<link linkend="install.windows.building">build</link>
|
|
11
|
+
ruby-web from the original source code.
|
|
12
|
+
</para-->
|
|
13
|
+
|
|
14
|
+
&install.windows.installer;
|
|
15
|
+
&install.windows.manual;
|
|
16
|
+
&install.windows.iis;
|
|
17
|
+
<!--
|
|
18
|
+
&install.windows.apache1;
|
|
19
|
+
&install.windows.apache2;
|
|
20
|
+
-->
|
|
21
|
+
|
|
22
|
+
<!--&install.windows.building; -->
|
|
23
|
+
|
|
24
|
+
</chapter>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<sect1 id="install.windows.installer">
|
|
2
|
+
<title>Windows Installer</title>
|
|
3
|
+
|
|
4
|
+
<para>
|
|
5
|
+
The Windows ruby-web installer is available from the downloads page at
|
|
6
|
+
<ulink url="&url.ruby-web.downloads;">&url.ruby-web.downloads;</ulink>. This
|
|
7
|
+
installs ruby-web and for IIS, Apache 1.x,
|
|
8
|
+
and Apache 2.x, it also configures the web server to run .rb and .rhtml
|
|
9
|
+
scripts using the CGI version of ruby-web.
|
|
10
|
+
</para>
|
|
11
|
+
|
|
12
|
+
<simpara>
|
|
13
|
+
First, install your selected <acronym>HTTP</acronym> (web) server on your
|
|
14
|
+
system, and make sure that it works.
|
|
15
|
+
</simpara>
|
|
16
|
+
|
|
17
|
+
<simpara>
|
|
18
|
+
The installation wizard gathers enough information to set up the ruby-web,
|
|
19
|
+
and configure certain web servers to use ruby-web.
|
|
20
|
+
</simpara>
|
|
21
|
+
|
|
22
|
+
<simpara>
|
|
23
|
+
Once the installation has completed, the installer will restart the server,
|
|
24
|
+
and you should be ready to just start using ruby-web.
|
|
25
|
+
</simpara>
|
|
26
|
+
|
|
27
|
+
<!--simpara>
|
|
28
|
+
Once the installation has completed, the installer will inform you if you
|
|
29
|
+
need to restart your system, restart the server, or just start using ruby-web.
|
|
30
|
+
</simpara-->
|
|
31
|
+
</sect1>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<sect1 id="install.windows.manual">
|
|
2
|
+
<title>Manual Installation Steps</title>
|
|
3
|
+
|
|
4
|
+
<para>
|
|
5
|
+
This install guide will help you manually install and configure ruby-web with
|
|
6
|
+
a web server on Microsoft Windows. Although we distribute a ruby-web
|
|
7
|
+
installer for Microsoft Windows, you might want to take to setup ruby-web
|
|
8
|
+
yourself as this will provide you with a better understanding of the system.
|
|
9
|
+
</para>
|
|
10
|
+
|
|
11
|
+
<para>
|
|
12
|
+
To get started you'll need to download
|
|
13
|
+
the tar.gz distribution from the downloads page at
|
|
14
|
+
<ulink url="&url.ruby-web.downloads;">&url.ruby-web.downloads;</ulink>.
|
|
15
|
+
If you have not already done so, you will need to install the
|
|
16
|
+
<ulink url="&url.ruby.windows.installer;">Ruby One Click installer</ulink>
|
|
17
|
+
in the directory of your choice. You may choose
|
|
18
|
+
a different location but do not have spaces in the
|
|
19
|
+
path (like <filename class="directory">C:\Program Files\Ruby</filename>)
|
|
20
|
+
as some web servers will crash properly if you do.
|
|
21
|
+
</para>
|
|
22
|
+
|
|
23
|
+
<para>Extract the archive (using a program like Winzip) . From the command line, execute these commands:</para>
|
|
24
|
+
|
|
25
|
+
<programlisting>
|
|
26
|
+
ruby.exe install.rb config
|
|
27
|
+
ruby.exe install.rb setup
|
|
28
|
+
ruby.exe install.rb install
|
|
29
|
+
</programlisting>
|
|
30
|
+
|
|
31
|
+
<para>
|
|
32
|
+
If you're using NTFS on Windows NT, 2000, XP or 2003, make sure that the
|
|
33
|
+
user running the web server has read permissions to your ruby lib directories (e.g.
|
|
34
|
+
make c:/ruby/bin and c:/ruby/lib readable by Everyone).
|
|
35
|
+
</para>
|
|
36
|
+
|
|
37
|
+
<para>
|
|
38
|
+
Ruby-web is now setup on your system. The next step is to choose a web
|
|
39
|
+
server, and enable it to run Ruby-web. FastCGI will provide significantly
|
|
40
|
+
better performance compared to CGI. However, CGI can be easier to setup.
|
|
41
|
+
Choose a webserver from the table of contents.
|
|
42
|
+
</para>
|
|
43
|
+
</sect1>
|
data/doc/manual.xml
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
|
3
|
+
"http://www.docbook.org/xml/4.3/docbookx.dtd"
|
|
4
|
+
[
|
|
5
|
+
<!ENTITY rubyweb "<emphasis>ruby-web</emphasis>">
|
|
6
|
+
<!ENTITY url.ruby.windows.installer "http://rubyforge.org/frs/?group_id=167">
|
|
7
|
+
<!ENTITY url.ruby-web.downloads "http://rubyforge.org/frs/?group_id=873">
|
|
8
|
+
<!ENTITY url.ruby-web.subscribe "http://lists.sourceforge.net/lists/listinfo/narf-lib-devel">
|
|
9
|
+
<!ENTITY httpd.conf "httpd.conf">
|
|
10
|
+
<!ENTITY email.ruby-web "narf-devel@sourceforge.net">
|
|
11
|
+
<!ENTITY url.ruby-web.bugs "http://rubyforge.org/tracker/?group_id=873">
|
|
12
|
+
<!ENTITY url.apache2.docs "url.apache2.docs">
|
|
13
|
+
<!ENTITY url.apache2.windows "url.apache2.windows">
|
|
14
|
+
<!ENTITY url.apache "url.apache">
|
|
15
|
+
<!ENTITY install SYSTEM "install/index.xml">
|
|
16
|
+
<!ENTITY install.windows SYSTEM "install/win/index.xml">
|
|
17
|
+
<!ENTITY install.windows.installer SYSTEM "install/win/installer.xml">
|
|
18
|
+
<!ENTITY install.windows.manual SYSTEM "install/win/manual.xml">
|
|
19
|
+
<!ENTITY install.windows.iis SYSTEM "install/win/iis.xml">
|
|
20
|
+
<!ENTITY install.windows.apache1 SYSTEM "install/win/apache1.xml">
|
|
21
|
+
<!ENTITY install.windows.apache2 SYSTEM "install/win/apache2.xml">
|
|
22
|
+
|
|
23
|
+
<!ENTITY install.macos SYSTEM "install/mac/index.xml">
|
|
24
|
+
|
|
25
|
+
<!ENTITY install.unix SYSTEM "install/unix/index.xml">
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<!ENTITY core.reference SYSTEM "core.xml">
|
|
29
|
+
<!ENTITY additional.reference SYSTEM "additional.xml">
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<!ENTITY % php.snippets SYSTEM "credits/php.language-snippets.ent">
|
|
33
|
+
%php.snippets;
|
|
34
|
+
<!ENTITY php.credits SYSTEM "credits/php.contributors.xml">
|
|
35
|
+
<!ENTITY credits SYSTEM "credits/index.xml"> ] >
|
|
36
|
+
|
|
37
|
+
<book>
|
|
38
|
+
<bookinfo>
|
|
39
|
+
<title><emphasis>ruby-web</emphasis></title>
|
|
40
|
+
</bookinfo>
|
|
41
|
+
|
|
42
|
+
<part id="install">
|
|
43
|
+
<title>Installation</title>
|
|
44
|
+
&install;
|
|
45
|
+
</part>
|
|
46
|
+
|
|
47
|
+
<!--
|
|
48
|
+
<part id="tutorial">
|
|
49
|
+
<title>Tutorial</title>
|
|
50
|
+
&tutorial;
|
|
51
|
+
</part>
|
|
52
|
+
-->
|
|
53
|
+
|
|
54
|
+
<part id="core">
|
|
55
|
+
<title>Core Reference</title>
|
|
56
|
+
&core.reference;
|
|
57
|
+
</part>
|
|
58
|
+
|
|
59
|
+
<part id="additional">
|
|
60
|
+
<title>Additional Libraries</title>
|
|
61
|
+
&additional.reference;
|
|
62
|
+
</part>
|
|
63
|
+
|
|
64
|
+
<part id="credits">
|
|
65
|
+
<title>Credits</title>
|
|
66
|
+
&credits;
|
|
67
|
+
</part>
|
|
68
|
+
|
|
69
|
+
</book>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The narf executable is quite useful. It can parse .narf files:
|
|
2
|
+
|
|
3
|
+
<? puts "hello world" ?>
|
|
4
|
+
|
|
5
|
+
Also, it will print syntax errors to the screen. To compile, run this from the project root (./narf):
|
|
6
|
+
|
|
7
|
+
ruby build.rb compile
|
|
8
|
+
|
|
9
|
+
The compiled binary will be in
|
|
10
|
+
|
|
11
|
+
./narf/bin/narf
|
|
12
|
+
|
|
13
|
+
Copy this file where ever you like, make it executable, and tell apache to run it with a shebang:
|
|
14
|
+
|
|
15
|
+
#!/usr/local/bin/narf
|
|
16
|
+
|
|
17
|
+
Mac OS X Note: If you get this message with compiling:
|
|
18
|
+
|
|
19
|
+
ld: Undefined symbols:
|
|
20
|
+
|
|
21
|
+
You may need to re-compile ruby with --enable-shared:
|
|
22
|
+
|
|
23
|
+
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/47248
|
data/doc/old/fastcgi.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
== FastCGI
|
|
2
|
+
|
|
3
|
+
FastCGI support for narf requires the 'fcgi' libary:
|
|
4
|
+
|
|
5
|
+
http://raa.ruby-lang.org/list.rhtml?name=fcgi
|
|
6
|
+
|
|
7
|
+
You can find a list of FastCGI servers here:
|
|
8
|
+
|
|
9
|
+
http://www.fastcgi.com
|
|
10
|
+
|
|
11
|
+
After installing and configuring the appropriate fastcgi libraries for your server, run .narf files with the Narf runner:
|
|
12
|
+
|
|
13
|
+
#!/usr/local/bin/narf
|
|
14
|
+
|
|
15
|
+
<? Web::puts "Hello World" ?>
|
|
16
|
+
|
|
17
|
+
or, run .rb files:
|
|
18
|
+
|
|
19
|
+
#!/usr/local/bin/narf
|
|
20
|
+
|
|
21
|
+
Web::puts "Hello World"
|
|
22
|
+
|
|
23
|
+
Please note that fcgi.rb does not run on windows, thus the narf runner will not run with isapi_fastcgi.dll.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
== mod_ruby
|
|
2
|
+
|
|
3
|
+
Configure mod_ruby:
|
|
4
|
+
|
|
5
|
+
http://modruby.net/en/index.rbx/mod_ruby/install.html
|
|
6
|
+
|
|
7
|
+
But use the narf runner, instead of the default apache runner:
|
|
8
|
+
|
|
9
|
+
<IfModule mod_ruby.c>
|
|
10
|
+
RubySafeLevel 0
|
|
11
|
+
# for Apache::RubyRun
|
|
12
|
+
RubyRequire web/sapi/apache
|
|
13
|
+
|
|
14
|
+
<Location / >
|
|
15
|
+
Options Indexes FollowSymLinks ExecCGI
|
|
16
|
+
AddHandler ruby-object cgi rb narf
|
|
17
|
+
RubyHandler Web::ModNarf.instance
|
|
18
|
+
</Location>
|
|
19
|
+
</IfModule>
|
|
20
|
+
|
|
21
|
+
Narf will detect that mod_ruby is running and use the proper apis.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# == Purpose
|
|
2
|
+
# Web provides an infrastructure for building and testing
|
|
3
|
+
# web applications.
|
|
4
|
+
#
|
|
5
|
+
# == Usage
|
|
6
|
+
# Use the Web module to interact with the client. The module
|
|
7
|
+
# delegates to a Web::CGI object, which does the actual work.
|
|
8
|
+
#
|
|
9
|
+
# #!/usr/bin/ruby
|
|
10
|
+
# require 'web'
|
|
11
|
+
# Web::process do
|
|
12
|
+
# Web["field"] # access parameters
|
|
13
|
+
# Web.cookies["muppet"] # access cookies
|
|
14
|
+
# Web.session["key"] ||= "value" # get and set session values
|
|
15
|
+
# Web.set_cookie( "muppet", "cookie monster" ) # set cookies
|
|
16
|
+
# Web.puts "something" # print 'something' out
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# If the request contained multipart/form-data, uploaded files are returned as
|
|
20
|
+
# Web::Upload objects. Other parameters are treated as strings.
|
|
21
|
+
#
|
|
22
|
+
# == Output
|
|
23
|
+
#
|
|
24
|
+
# You write output as if it were an IO:
|
|
25
|
+
# Web << "<h1>Hello World!</h1>"
|
|
26
|
+
# Web.print "<p>We have lots of tricks for you.<br>"
|
|
27
|
+
# Web.write "From kungfu to jiujitsu<br>"
|
|
28
|
+
# Web.puts "anything and everything works</p>."
|
|
29
|
+
# or even:
|
|
30
|
+
# puts "hello world"
|
|
31
|
+
#
|
|
32
|
+
# Narf buffers output by default. Buffered output allows you to set headers
|
|
33
|
+
# (cookies, redirects, status, etc.) at any point before the cgi is flushed.
|
|
34
|
+
# You can force this by calling:
|
|
35
|
+
# Web.flush
|
|
36
|
+
#
|
|
37
|
+
# Once the headers are sent to the client, you cannot set any more headers.
|
|
38
|
+
#
|
|
39
|
+
# == Error Handling
|
|
40
|
+
#
|
|
41
|
+
# For cgi-scripts under Apache, one can use the 'bin/narf'
|
|
42
|
+
# script instead of using the ruby executable. This little c program
|
|
43
|
+
# doesn't do much fancy, but it can trap syntax errors and send them
|
|
44
|
+
# back to the browser. <i>I would especially appreciate security-related
|
|
45
|
+
# feedback; narf.c is contributed and I am not a c programmer.</i>
|
|
46
|
+
#
|
|
47
|
+
# == Sessions:
|
|
48
|
+
#
|
|
49
|
+
# Sessions provide a way of storing data between Web
|
|
50
|
+
# requests. Anything that can be marshalled can be stored in the
|
|
51
|
+
# session.
|
|
52
|
+
#
|
|
53
|
+
# === Getting and Setting values in a session
|
|
54
|
+
#
|
|
55
|
+
# Web.session["key"] = "value"
|
|
56
|
+
# Web.session["key"] # => "value"
|
|
57
|
+
#
|
|
58
|
+
# === Deleting session values
|
|
59
|
+
#
|
|
60
|
+
# Web.session["key"] = "value"
|
|
61
|
+
# Web.session["key"].delete # => "value"
|
|
62
|
+
# Web.session["key"] # => "nil"
|
|
63
|
+
#
|
|
64
|
+
# === Iterating through session keys
|
|
65
|
+
#
|
|
66
|
+
# Web.session.each do |key, val|
|
|
67
|
+
# Web.puts "#{key} => #{val}<br>"
|
|
68
|
+
# end
|
|
69
|
+
#
|
|
70
|
+
# === Resetting the Session
|
|
71
|
+
#
|
|
72
|
+
# Reseting the session to an empty hash is simple:
|
|
73
|
+
# Web.session.reset
|
|
74
|
+
#
|
|
75
|
+
# === Testing
|
|
76
|
+
#
|
|
77
|
+
# See Web::Testing for more details.
|
|
78
|
+
#
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# When testing, this is a useful method to tell
|
|
82
|
+
# NARF where to find your scripts
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# Web delegates to the current
|
|
86
|
+
# cgi object. This is the recommended
|
|
87
|
+
# way to use narf:
|
|
88
|
+
#
|
|
89
|
+
# Web["param"]
|
|
90
|
+
# Web << "hello world"
|
|
91
|
+
# Web.set_redirect( "http://www.narf-lib.org" )
|
|
92
|
+
# ...
|
|
93
|
+
#
|
|
94
|
+
# The documentation for these methods is on the Web::CGI object.
|
|
95
|
+
|
|
96
|
+
# set the singleton connection object for Web
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# get the singleton cgi object for Web
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# this function should be useful for web apps that
|
|
103
|
+
# want to store resources with the source files
|
|
104
|
+
# in the ruby lib directories. For example:
|
|
105
|
+
# Web::lib_filename('resources/logo.gif' )
|
|
106
|
+
# Uses Kernel::caller to determine base directory,
|
|
107
|
+
# use optional dirname parameter to change base directory
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# Get the contents of a lib file, aka
|
|
111
|
+
# template = Web::lib_file_contents('resources/template.html' )
|
|
112
|
+
# Uses Kernel::caller to determine base directory,
|
|
113
|
+
# use optional dirname parameter to change base directory
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# To send a resource gif to the client:
|
|
117
|
+
# Web::send_lib_file( 'resources/logo.gif' )
|
|
118
|
+
# Uses Kernel::caller to determine base directory,
|
|
119
|
+
# use optional dirname parameter to change base directory
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# URL-encode a string.
|
|
124
|
+
# url_encoded_string = Web::escape("'Stop!' said Fred")
|
|
125
|
+
# # => "%27Stop%21%27+said+Fred"
|
|
126
|
+
# (from cgi.rb)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# URL-decode a string.
|
|
131
|
+
# string = Web::unescape("%27Stop%21%27+said+Fred")
|
|
132
|
+
# # => "'Stop!' said Fred"
|
|
133
|
+
# (from cgi.rb)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# Escape special characters in HTML, namely &\"<>
|
|
137
|
+
# Web::escape_html('Usage: foo "bar" <baz>')
|
|
138
|
+
# # => "Usage: foo "bar" <baz>"
|
|
139
|
+
# (from cgi.rb)
|
|
140
|
+
|
|
141
|
+
# Append output to client with line endings
|
|
142
|
+
|
|
143
|
+
# Unescape a string that has been HTML-escaped
|
|
144
|
+
# Web::unescape_html("Usage: foo "bar" <baz>")
|
|
145
|
+
# # => "Usage: foo \"bar\" <baz>"
|
|
146
|
+
# (from cgi.rb)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# Escape only the tags of certain HTML elements in +string+.
|
|
150
|
+
#
|
|
151
|
+
# Takes an element or elements or array of elements. Each element
|
|
152
|
+
# is specified by the name of the element, without angle brackets.
|
|
153
|
+
# This matches both the start and the end tag of that element.
|
|
154
|
+
# The attribute list of the open tag will also be escaped (for
|
|
155
|
+
# instance, the double-quotes surrounding attribute values).
|
|
156
|
+
#
|
|
157
|
+
# print Web::escape_element('<BR><A HREF="url"></A>', "A", "IMG")
|
|
158
|
+
# # "<BR><A HREF="url"></A>"
|
|
159
|
+
#
|
|
160
|
+
# print Web::escape_element('<BR><A HREF="url"></A>', ["A", "IMG"])
|
|
161
|
+
# # "<BR><A HREF="url"></A>"
|
|
162
|
+
#
|
|
163
|
+
# (from cgi.rb)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
# Undo escaping such as that done by Web::escape_element()
|
|
168
|
+
#
|
|
169
|
+
# print Web::unescape_element(
|
|
170
|
+
# Web::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
|
|
171
|
+
# # "<BR><A HREF="url"></A>"
|
|
172
|
+
#
|
|
173
|
+
# print Web::unescape_element(
|
|
174
|
+
# Web::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
|
|
175
|
+
# # "<BR><A HREF="url"></A>"
|
|
176
|
+
# (from cgi.rb)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# Make RFC1123 date string
|
|
180
|
+
# Web::rfc1123_date(Time.now) # => Sat, 01 Jan 2000 00:00:00 GMT
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# wrapper for web errors
|