Skip to content

Commit

Permalink
Spelling corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyhorner committed Apr 15, 2011
1 parent 9449cc2 commit 18894e0
Show file tree
Hide file tree
Showing 22 changed files with 826 additions and 10 deletions.
26 changes: 26 additions & 0 deletions Rack/man/App-class.Rd.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
\name{App-class}
\Rdversion{1.1}
\docType{class}
\alias{App-class}
\alias{App}

\title{Class \code{App}}
\description{
Abstract class from which \code{Middleware} and \code{Builder} inherit. Provides the \code{app} field.

\code{App} can also be used to instantiate reference classed applications wrapped around a function. See \code{\link{Middleware}} for an example.
}
\section{Fields}{
\describe{
\item{\code{app}:}{A Rack application.}
}
}
\section{Methods}{
\describe{
\item{\code{new(app=NULL)}:}{ Creates a new \code{App} object. \code{app} is any \code{Rack} aware R object.}
}
}
\seealso{
\code{\link{is_rackable}}, \code{\link{Builder}}, and \code{\link{Middleware}}.
}
\keyword{classes}
44 changes: 44 additions & 0 deletions Rack/man/Brewery-class.Rd.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
\name{Brewery-class}
\Rdversion{1.1}
\docType{class}
\alias{Brewery-class}
\alias{Brewery}

\title{Class \code{Brewery}}
\description{
A \code{\link{Middleware}} class for mapping URLs to a directory of files that are subsequently passed to \code{\link{brew}}. When a file is brewed, the two variables \code{req} (an object of class \code{\link{Request}}) and \code{res} (an object of class \code{\link{Response}}) are available for use.

}
\section{Methods}{
\describe{
\item{\code{new(url,root,...):}}{
\code{url} is a character string or \code{\link{regexp}} on which to match, \code{root} is the name of the directory where brew files reside. Named arguments can be passed in via \code{...} and will be available within the scope of each brewed file.
}
}}

\examples{

#
# This application runs any file found in tempdir() through brew.
#
s <- Rhttpd$new()
s$start(quiet=TRUE)
cat("<h1>Random Number: <\%=rnorm(1)\%></h1>",
file=file.path(tempdir(),"index.html"))
s$add(name="random",
app=Builder$new(
Brewery$new(url="/",root=tempdir()),
Redirect$new("/index.html")
)
)
\dontrun{
s$browse('random') # Opens a browser window to the app.
}
file.remove(file.path(tempdir(),"index.html"))
rm(s)
}

\seealso{
\code{\link{Rhttpd}}, \code{\link{Builder}}, \code{\link{Redirect}}, and \code{\link{brew}}.
}
\keyword{classes}
49 changes: 49 additions & 0 deletions Rack/man/Builder-class.Rd.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
\name{Builder-class}
\Rdversion{1.1}
\docType{class}
\alias{Builder-class}
\alias{Builder}

\title{Class \code{Builder}}
\description{
A convenience object for combining various \code{Middleware} with a default application to create a more complex Rack application.
}
\examples{

# The following is the Hmisc example. Explore the folder
# system.file('exampleApps/Hmisc',package='Rack') for more information.
s <- Rhttpd$new()
\dontrun{
library(Hmisc)
dir.create(file.path(tempdir(),'plots'),showWarnings=FALSE)
s$add( name="Hmisc",
app=Builder$new(
Static$new(
urls = c('/css','/images','/javascript'),
root = system.file('exampleApps/Hmisc',package='Rack')
),
Static$new(urls='/plots',root=tempdir()),
Brewery$new(
url='/brew',
root= system.file('exampleApps/Hmisc',package='Rack'),
imagepath=file.path(tempdir(),'plots'),
imageurl='../plots/'
),
Redirect$new('/brew/useR2007.rhtml')
)
)
s$start(quiet=TRUE)
s$browse('Hmisc') # Opens a browser window to the application.
}
s$remove(all=TRUE)
s$stop()
}
\seealso{
\code{\link{Rhttpd}}, \code{\link{Static}}, \code{\link{Brewery}}, and \code{\link{Redirect}}.
}
\keyword{classes}
\section{Methods}{
\describe{
\item{\code{new(...)}:}{ Arguments can be any \code{Middleware} object while the last argument in the list must be a valid \code{Rack} application. That is, it will handle the incoming request without deferring to another application. }
}
}
2 changes: 1 addition & 1 deletion Rack/man/File-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A Rack application that serves static files from a root directory, according to
# This example serves all your files in /etc (on UNIX and Mac only).
#
# Note that when you open the application, you will see the word
# 'Forbidden'. "File" doesn's serve directories, so you must amend the
# 'Forbidden'. "File" doesn't serve directories, so you must amend the
# url in the location bar with the file you want to view. Try adding /passwd.

s <- Rhttpd$new()
Expand Down
36 changes: 36 additions & 0 deletions Rack/man/File-class.Rd.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
\name{File-class}
\Rdversion{1.1}
\docType{class}
\alias{File-class}
\alias{File}

\title{Class \code{File}}
\description{
A Rack application that serves static files from a root directory, according to the path info of the Rack request.
}
\examples{
# This example serves all your files in /etc (on UNIX and Mac only).
#
# Note that when you open the application, you will see the word
# 'Forbidden'. "File" doesn's serve directories, so you must amend the
# url in the location bar with the file you want to view. Try adding /passwd.

s <- Rhttpd$new()
s$start(quiet=TRUE)
s$add(name="etc",app=File$new('/etc'))
\dontrun{
s$browse('etc') # Opens a browser window to the app.
}
s$remove(all=TRUE)
rm(s)
}
\section{Methods}{
\describe{
\item{\code{new(root):}}{
\code{root} is the name of the directory from where to serve files.
}
}}
\seealso{
\code{\link{Rhttpd}}.
}
\keyword{classes}
61 changes: 61 additions & 0 deletions Rack/man/Middleware-class.Rd.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
\name{Middleware-class}
\Rdversion{1.1}
\docType{class}
\alias{Middleware-class}
\alias{Middleware}

\title{Class \code{Middleware}}
\description{
An abstract class for building Rack Middleware applications. \code{Middleware} applications either handle the incoming web request or hand off the request to the Rack app defined in the field of the same name.
}
\examples{
# Middleware applications are typically instantiated in the argument list of
# Builder$new(), but here is stand-alone example.
#
# Once your browser loads the app, you will see something like this in
# your location bar: http://127.0.0.1:28649/custom/middle. Add '/foo'
# onto the end of that and reload.

setRefClass(
'FooBar',
contains = 'Middleware',
methods = list(
initialize = function(...){
# app to defer to.
callSuper(app=App$new(function(env){
res <- Response$new()
res$write("<h1>I'm the deferred app.</h1>")
res$finish()
}))
},
call = function(env){
req <- Request$new(env)
res <- Response$new()
if (length(grep('foo',req$path_info()))){
res$write("<h1>I'm the middleware app.</h1>")
return(res$finish())
} else {
app$call(env)
}
}
)
)
s <- Rhttpd$new()
s$start(quiet=TRUE)
s$add(name="middle",app=getRefClass('FooBar')$new())
\dontrun{
s$browse('middle') # Opens a browser window to the app.
}
s$remove(all=TRUE)
rm(s)
}
\seealso{
The following classes implement Middleware:
\code{\link{Brewery}} and \code{\link{Static}}.
}
\section{Methods}{
\describe{
\item{\code{set_app(app)}:}{ \code{app} is a \code{\link{Rack}} application that will handle the request if this Middleware app does not. }
}
}
\keyword{classes}
4 changes: 2 additions & 2 deletions Rack/man/Mime-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Mime$mime_type('.png')
\keyword{classes}
\section{Methods}{
\describe{
\item{\code{file_extname(fname=NULL)}:}{ Returns the file extentions for the given file.}
\item{\code{mime_type(ext=NULL, fallback='application/octet-stream')}:}{ Returns the MIME type given the file extension. Besure to include the dot character in \code{ext}. If no match is found, then the fallback MIME type is returned.}
\item{\code{file_extname(fname=NULL)}:}{ Returns the file extensions for the given file.}
\item{\code{mime_type(ext=NULL, fallback='application/octet-stream')}:}{ Returns the MIME type given the file extension. Be sure to include the dot character in \code{ext}. If no match is found, then the fallback MIME type is returned.}
}
}
21 changes: 21 additions & 0 deletions Rack/man/Mime-class.Rd.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
\name{Mime-class}
\Rdversion{1.1}
\docType{class}
\alias{Mime-class}
\alias{Mime}

\title{Class \code{Mime} and object \code{Mime}}
\description{
A convenience object for determining the MIME type of a file name.
}
\examples{
Mime$file_extname('foo.png')
Mime$mime_type('.png')
}
\keyword{classes}
\section{Methods}{
\describe{
\item{\code{file_extname(fname=NULL)}:}{ Returns the file extentions for the given file.}
\item{\code{mime_type(ext=NULL, fallback='application/octet-stream')}:}{ Returns the MIME type given the file extension. Besure to include the dot character in \code{ext}. If no match is found, then the fallback MIME type is returned.}
}
}
43 changes: 43 additions & 0 deletions Rack/man/Multipart-class.Rd.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
\name{Multipart-class}
\Rdversion{1.1}
\docType{class}
\alias{Multipart-class}
\alias{Multipart}

\title{Class \code{Multipart} and object \code{Multipart}}
\description{
A convenience object for parsing multipart/form-data POST payloads.
}
\examples{
s <- Rhttpd$new()
s$start(quiet=TRUE)
s$add(name="multi",
app=function(env){
req <- Request$new(env)
res <- Response$new()
res$write('<form enctype="multipart/form-data" method=POST>')
res$write('Upload a file: <input type=file name=fileUpload>')
res$write('<input type=submit></form><br>')
post <- Multipart$parse(env)
if (length(post)){
poststr <- paste(capture.output(str(post),file=NULL),collapse='\n')
res$write(c('<pre>',poststr,'</pre>'))
}
res$finish()
}
)
\dontrun{
s$browse('multi') # Opens a browser window to the app.
}
s$remove(all=TRUE)
rm(s)
}
\seealso{
\code{\link{Rhttpd}}, \code{\link{Request}}, and \code{\link{Response}}.
}
\section{Methods}{
\describe{
\item{\code{parse(env)}:}{ Returns parsed POST payload as a named list. \code{env} is an environment created by \code{Rhttpd} and conforms to the \code{\link{Rack}} specification.}
}
}
\keyword{classes}
4 changes: 2 additions & 2 deletions Rack/man/Rack-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function(env){
}
}
And the equivalent referenc class example:
And the equivalent reference class example:
\preformatted{
setRefClass('HelloWorld',
Expand Down Expand Up @@ -93,7 +93,7 @@ variables:
or absence of the appropriate HTTP header in the request.}
}

In addtion, the environment must include the following Rack-specific variables:
In addition, the environment must include the following Rack-specific variables:

\describe{
\item{rack.version}{ This version of Rack.}
Expand Down
Loading

0 comments on commit 18894e0

Please sign in to comment.