Giter Site home page Giter Site logo

calligraphy's Introduction

Calligraphy Build Status Gem Version

Calligraphy is a Web Distributed Authoring and Versioning (WebDAV) solution for Rails that:

  • Provides a framework for handling WebDAV requests (e.g. PROPFIND, PROPPATCH)
  • Allows you to extend WedDAV functionality to any type of resource
  • Passes all of the Litmus tests (using Calligraphy::FileResource and digest authentication)

Getting Started

Add the following line to your Gemfile:

gem 'calligraphy'

Then, run bundle install

Next, run the generator:

rails generate calligraphy:install

The generator will install an initializer which describes Calligraphy's configuration options.

Finally, set up a calligraphy_resource route in config/routes.rb with a resource_class.

# config/routes.rb
calligraphy_resource :webdav, resource_class: Calligraphy::FileResource

The above will create a route, /webdav that will be able to handle the following HTTP request methods:

  • OPTIONS
  • GET
  • PUT
  • DELETE
  • COPY
  • MOVE
  • MKCOL
  • PROPFIND
  • PROPPATCH
  • LOCK
  • UNLOCK

The routes will also use the Calligraphy::FileResource, enabling Rails to carry out WebDAV actions on files. Additionally, when using the FileResource class the resource root path (the location you'd like to serve files from) with the resource_root_path key:

# config/routes.rb
calligraphy_resource :webdav, resource_class: Calligraphy::FileResource, resource_root_path: '/home/webdav'

This will serve local files from /home/webdav on the server through the /webdav endpoint.

Extensibility

The Calligraphy::Resource class exposes all the methods used in the various Calligraphy::WebDavRequest classes. To create a custom resource, simply inherit from Calligraphy::Resource and redefine the public methods you'd like to customize.

For example, to create a CalendarResource:

module Calligraphy
  class CalendarResource < Resource

    def propfind(nodes)
      # custom implementation of propfind for CalendarResource
    end

    ...
  end
end

License

Calligraphy is Copyright © 2017 Brandon Robins. It is free software, and may be redistributed under the terms specified in the LICENSE file.

calligraphy's People

Contributors

eanlain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

calligraphy's Issues

is there any docs/blogs available?

simply following readme not helping out much, I am trying to connect using ubuntu files utility, however seeing several errors, might be missing something, trying to figure out each err on by one.

example

Started PROPFIND "/webdav/123" for 127.0.0.1 at 2019-12-21 12:31:12 +0530
Processing by Calligraphy::Rails::WebDavRequestsController#invoke_method as HTML
  Parameters: {"resource_class"=>Calligraphy::FileResource, "resource_root_path"=>"/home/amol/git/myapp/projects", "resource"=>"123"}
Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.0ms)
  
NoMethodError (undefined method `etag' for nil:NilClass):
  

123 is a folder at shared path

No release for Rails 6 support

The latest gem releases requires Rails 5. In master this has already been bumped up to 6 for a while, but has not been released yet. Any plans to release it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.