Add an install generator and update README
This commit is contained in:
@@ -35,11 +35,11 @@ module Calligraphy
|
||||
TAGGED_LIST_REGEX = /\)\s</
|
||||
UNTAGGAGED_LIST_REGEX = /\)\s\(/
|
||||
|
||||
# HTTP methods allowed by the WebDavRequestsController.
|
||||
# HTTP methods allowed by the WebDavRequests controller.
|
||||
mattr_accessor :allowed_http_methods
|
||||
@@allowed_http_methods = %w(
|
||||
options head get put delete copy
|
||||
move mkcol propfind proppatch lock unlock
|
||||
options get put delete copy move
|
||||
mkcol propfind proppatch lock unlock
|
||||
)
|
||||
|
||||
# Proc responsible for returning the user's password, API key,
|
||||
@@ -53,15 +53,16 @@ module Calligraphy
|
||||
mattr_accessor :enable_digest_authentication
|
||||
@@enable_digest_authentication = false
|
||||
|
||||
# The realm used in HTTP Basic Authentication.
|
||||
# The realm used in HTTP Digest Authentication.
|
||||
mattr_accessor :http_authentication_realm
|
||||
@@http_authentication_realm = 'Application'
|
||||
|
||||
# Maximum lock lifetime in seconds.
|
||||
mattr_accessor :lock_timeout_period
|
||||
@@lock_timeout_period = 24 * 60 * 60
|
||||
@@lock_timeout_period = 86400
|
||||
|
||||
# The HTTP actions Calligraphy is responsible for handling.
|
||||
# The HTTP actions Calligraphy uses to create mappings between WebDAV
|
||||
# HTTP verbs and URLs and WebDAV controller actions.
|
||||
mattr_accessor :web_dav_actions
|
||||
@@web_dav_actions = %i(
|
||||
options get put delete copy move
|
||||
@@ -69,7 +70,7 @@ module Calligraphy
|
||||
)
|
||||
|
||||
# Default way to set up Calligraphy.
|
||||
# Run `rails generate calligraphy_install` to generate a
|
||||
# Run `rails generate calligraphy:install` to generate a
|
||||
# fresh initializer with all configuration values.
|
||||
def self.configure
|
||||
yield self
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Calligraphy
|
||||
VERSION = '0.2.0'
|
||||
VERSION = '0.2.1'
|
||||
end
|
||||
|
||||
15
lib/generators/calligraphy/install_generator.rb
Normal file
15
lib/generators/calligraphy/install_generator.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails/generators/base'
|
||||
|
||||
module Calligraphy
|
||||
module Generators
|
||||
class InstallGenerator < ::Rails::Generators::Base
|
||||
source_root File.expand_path('../../templates', __FILE__)
|
||||
|
||||
desc 'Creates a Calligraphy initializer for your application'
|
||||
|
||||
def copy_initializer
|
||||
template 'calligraphy.rb', 'config/initializers/calligraphy.rb'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
47
lib/generators/templates/calligraphy.rb
Normal file
47
lib/generators/templates/calligraphy.rb
Normal file
@@ -0,0 +1,47 @@
|
||||
Calligraphy.configure do |config|
|
||||
# The HTTP actions Calligraphy uses to create mappings between WebDAV
|
||||
# HTTP verbs and URLs and WebDAV controller actions.
|
||||
# config.web_dav_actions = [
|
||||
# :options, :get, :put, :delete, :copy, :move,
|
||||
# :mkcol, :propfind, :proppatch, :lock, :unlock
|
||||
# ]
|
||||
|
||||
# HTTP methods allowed by the WebDavRequests controller.
|
||||
# Before responding to a WebDav request, the WebDavRequests controller
|
||||
# checks this list to determine if it is allowed to make the request.
|
||||
# If a method is disallowed, the controller will respond by sending an
|
||||
# HTTP 405 (Method Not Allowed) response.
|
||||
# config.allowed_http_methods = %w(
|
||||
# options get put delete copy move
|
||||
# mkcol propfind proppatch lock unlock
|
||||
# )
|
||||
|
||||
# If Digest Authentication is enabled by default. False by default.
|
||||
# config.enable_digest_authentication = false
|
||||
|
||||
# Proc responsible for returning the user's password, API key,
|
||||
# or HA1 digest hash so that Rails can check user credentials.
|
||||
# Should be configured to handle your particular application's
|
||||
# user and/or authentication setup.
|
||||
#
|
||||
# For example, in an API setup where an email/API key are sent with the
|
||||
# request, in lieu of a username/password, the digest_password_procedure
|
||||
# would be defined as:
|
||||
#
|
||||
# config.digest_password_procedure = Proc.new do |email|
|
||||
# u = User.find_by(email: email)
|
||||
# u.authentication_token
|
||||
# end
|
||||
#
|
||||
# Digest Authentication would need to be enabled for this proc to
|
||||
# actually be called.
|
||||
# config.digest_password_procedure = Proc.new do |username|
|
||||
# 'changeme!'
|
||||
# end
|
||||
|
||||
# The realm used in HTTP Digest Authentication. 'Application' by default.
|
||||
# config.http_authentication_realm = 'Application'
|
||||
|
||||
# Maximum lock lifetime in seconds. 86400 by default.
|
||||
# config.lock_timeout_period = 86400
|
||||
end
|
||||
Reference in New Issue
Block a user