Configure dummy app, rake tasks, and travis

This commit is contained in:
Brandon Robins
2017-12-19 23:41:28 -06:00
parent 147189f862
commit fc78886d5b
10 changed files with 130 additions and 2 deletions

7
.gitignore vendored
View File

@@ -1,8 +1,10 @@
*.gem *.gem
*.log
*.rbc *.rbc
/.config /.config
/coverage/ /coverage/
/InstalledFiles /InstalledFiles
/litmus*/
/pkg/ /pkg/
/spec/reports/ /spec/reports/
/spec/examples.txt /spec/examples.txt
@@ -48,3 +50,8 @@ build-iPhoneSimulator/
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc .rvmrc
## Dummy app
/spec/dummy/lib/
/spec/dummy/log/
/spec/dummy/tmp/

8
.travis.yml Normal file
View File

@@ -0,0 +1,8 @@
language: ruby
rvm:
- 2.2
- 2.3
- 2.4
script:
- bundle exec rake spec
- bundle exec rake litmus:run

View File

@@ -1,4 +1,3 @@
source 'https://rubygems.org' source 'https://rubygems.org'
# Specify gem dependencies in calligraphy.gemspec
gemspec gemspec

View File

@@ -66,6 +66,7 @@ GEM
nio4r (2.1.0) nio4r (2.1.0)
nokogiri (1.8.1) nokogiri (1.8.1)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
puma (3.11.0)
rack (2.0.3) rack (2.0.3)
rack-test (0.8.2) rack-test (0.8.2)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
@@ -131,6 +132,8 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
calligraphy! calligraphy!
puma (~> 3.11.0)
rake (~> 12.3.0)
rspec-rails (~> 3.7.2) rspec-rails (~> 3.7.2)
sqlite3 (~> 1.3.13) sqlite3 (~> 1.3.13)

62
Rakefile Normal file
View File

@@ -0,0 +1,62 @@
#!/usr/bin/env rake
require "rake/clean"
require "rspec/core/rake_task"
task default: %w(spec litmus:run)
desc "Run rspec tests"
RSpec::Core::RakeTask.new :spec
desc "Run litmus test suite"
task :litmus => %w(litmus:run)
namespace :litmus do
tmp_dir = "#{Dir.pwd}/tmp"
litmus_archive = "#{tmp_dir}/litmus-0.13.tar.gz"
desc "Fetch litmus test suite zip file"
task :fetch do
sh "mkdir tmp" unless File.directory? "#{tmp_dir}"
sh "mkdir tmp/webdav" unless File.directory? "#{tmp_dir}/webdav"
unless File.exist? litmus_archive
sh "wget -O #{tmp_dir}/litmus-0.13.tar.gz https://github.com/eanlain/litmus/releases/download/v0.13/litmus-0.13.tar.gz"
end
end
CLEAN.include("tmp")
task :unarchive => :fetch do
unless File.directory? "#{Dir.pwd}/litmus-0.13"
sh "tar -xvzf #{tmp_dir}/litmus-0.13.tar.gz"
end
end
CLEAN.include("litmus-0.13")
task :configure => :unarchive do
unless File.exist? "litmus-0.13/configured"
sh "cd litmus-0.13 && ./configure"
sh "cd litmus-0.13 && touch configured"
end
end
task :make_clean do
sh "cd litmus-0.13 && make clean"
sh "rm litmus-0.13/configured"
end
task :run => :configure do
sh "cd spec/dummy/ && rails server -d"
puma_pid = `cat spec/dummy/tmp/pids/server.pid`
exit_code = 0
begin
sh "cd litmus-0.13 && make URL=http://localhost:3000/webdav/ CREDS='jon_deaux changeme!' check"
rescue
exit_code = 1
puts "!!!!! Failure encountered during litmus test suite !!!!!"
end
sh "kill #{puma_pid}"
exit exit_code
end
end

View File

@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
s.add_dependency 'rails', '~> 5.0' s.add_dependency 'rails', '~> 5.0'
s.add_development_dependency 'puma', '~> 3.11.0'
s.add_development_dependency 'rake', '~> 12.3.0'
s.add_development_dependency 'rspec-rails', '~> 3.7.2' s.add_development_dependency 'rspec-rails', '~> 3.7.2'
s.add_development_dependency 'sqlite3', '~> 1.3.13' s.add_development_dependency 'sqlite3', '~> 1.3.13'
end end

View 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 = true
# 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

View File

@@ -1,4 +1,4 @@
Rails.application.routes.draw do Rails.application.routes.draw do
calligraphy_resource :test calligraphy_resource :test
calligraphy_resource :webdav, resource_class: Calligraphy::FileResource calligraphy_resource :webdav, resource_class: Calligraphy::FileResource, resource_root_path: File.expand_path('../../../../tmp/webdav', __FILE__)
end end

Binary file not shown.