-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f218b08
Showing
13 changed files
with
1,281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*~ | ||
doc/* | ||
pkg/* | ||
test/repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Copyright (c) 2009 Matthias Georgi <http://www.matthias-georgi.de> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to | ||
deal in the Software without restriction, including without limitation the | ||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
sell copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
RackDAV - Web Authoring for Rack and Rails | ||
========================================== | ||
|
||
RackDAV is Handler for [Rack][1], which allows content authoring over | ||
HTTP. RackDAV brings its own implentation for authoring files, but | ||
other resource types are possible by subclassing RackDAV::Resource. | ||
|
||
## Install | ||
|
||
Just install the gem from github: | ||
|
||
$ gem sources -a http://gems.github.com | ||
$ sudo gem install georgi-rack_dav | ||
|
||
## Quickstart | ||
|
||
If you just want to share a folder over WebDAV, you can just start a | ||
simple server with this: | ||
|
||
$ rack_dav | ||
|
||
This will start a WEBrick server on port 3000, which you can connect | ||
to withou authentication. | ||
|
||
## Rack Handler | ||
|
||
Using RackDAV inside a rack application is quite easy. A simple rackup | ||
script looks like this: | ||
|
||
require 'rubygems' | ||
require 'rack_dav' | ||
use Rack::CommonLogger | ||
run RackDAV::Handler.new('/path/to/docs') | ||
|
||
## Implementing your own WebDAV resource | ||
|
||
You have to subclass RackDAV::Resource and implement following | ||
methods: | ||
|
||
* _children_: If this is a collection, return the child resources. | ||
|
||
* _collection?_: Is this resource a collection? | ||
|
||
* _exist?; end_: Does this recource exist? | ||
|
||
* _creation\_date: Return the creation time. | ||
|
||
* _last_modified: Return the time of last modification. | ||
|
||
* _last_modified=(time): Set the time of last modification. | ||
|
||
* _etag_: Return an Etag, an unique hash value for this resource. | ||
|
||
* _content_type_: Return the mime type of this resource. | ||
|
||
* _content\_length_: Return the size in bytes for this resource. | ||
|
||
* _get(request, response)_: Write the content of the resource to the response.body. | ||
|
||
* _put(request, response)_: Save the content of the request.body. | ||
|
||
* _post(request, response)_: Usually forbidden. | ||
|
||
* _delete_: Delete this resource. | ||
|
||
* _copy(dest)_: Copy this resource to given destination resource. | ||
|
||
* _move(dest)_: Move this resource to given destination resource. | ||
|
||
* _make\_collection_: Create this resource as collection. | ||
|
||
|
||
Each resource has a path attribute, which you must use to find and | ||
manipulate the real resource. | ||
|
||
Finally you have to tell RackDAV::Handler, what class it should use: | ||
|
||
RackDAV::Handler.new(:resource_class => MyResource) | ||
|
||
|
||
### RackDAV on GitHub | ||
|
||
Download or fork the project on its [Github page][2] | ||
|
||
|
||
[1]: http://github.com/chneukirchen/rack | ||
[2]: http://github.com/georgi/rack_dav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'rubygems' | ||
require 'rack_dav' | ||
|
||
app = Rack::Builder.new do | ||
use Rack::ShowExceptions | ||
use Rack::CommonLogger | ||
use Rack::Reloader | ||
use Rack::Lint | ||
|
||
run RackDAV::Handler.new | ||
|
||
end.to_app | ||
|
||
Rack::Handler::WEBrick.run(app, :Port => 3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'rubygems' | ||
require 'builder' | ||
require 'time' | ||
require 'rexml/document' | ||
require 'webrick/httputils' | ||
|
||
require 'rack' | ||
require 'rack_dav/builder_namespace' | ||
require 'rack_dav/http_status' | ||
require 'rack_dav/resource' | ||
require 'rack_dav/file_resource' | ||
require 'rack_dav/handler' | ||
require 'rack_dav/controller' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
module Builder | ||
|
||
class XmlBase | ||
def namespace(ns) | ||
old_namespace = @namespace | ||
@namespace = ns | ||
yield | ||
@namespace = old_namespace | ||
self | ||
end | ||
|
||
alias_method :method_missing_without_namespace, :method_missing | ||
|
||
def method_missing(sym, *args, &block) | ||
sym = "#{@namespace}:#{sym}" if @namespace | ||
method_missing_without_namespace(sym, *args, &block) | ||
end | ||
|
||
end | ||
|
||
end |
Oops, something went wrong.