tilia-dav 3.1.0.pre.alpha6 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.sabre.md +97 -1
  4. data/Gemfile +1 -16
  5. data/Gemfile.lock +44 -41
  6. data/LICENSE +1 -1
  7. data/LICENSE.sabre +1 -1
  8. data/examples/addressbookserver.rb +52 -0
  9. data/examples/calendarserver.rb +58 -0
  10. data/examples/fileserver.rb +57 -0
  11. data/examples/groupwareserver.rb +69 -0
  12. data/examples/sql/mysql.addressbook.sql +28 -0
  13. data/examples/sql/mysql.calendars.sql +64 -0
  14. data/examples/sql/mysql.locks.sql +13 -0
  15. data/examples/sql/mysql.principals.sql +21 -0
  16. data/examples/sql/mysql.propertystorage.sql +8 -0
  17. data/examples/sql/mysql.users.sql +9 -0
  18. data/examples/sql/pgsql.addressbook.sql +52 -0
  19. data/examples/sql/pgsql.calendars.sql +93 -0
  20. data/examples/sql/pgsql.locks.sql +19 -0
  21. data/examples/sql/pgsql.principals.sql +38 -0
  22. data/examples/sql/pgsql.propertystorage.sql +13 -0
  23. data/examples/sql/pgsql.users.sql +14 -0
  24. data/examples/sql/sqlite.addressbooks.sql +28 -0
  25. data/examples/sql/sqlite.calendars.sql +64 -0
  26. data/examples/sql/sqlite.locks.sql +12 -0
  27. data/examples/sql/sqlite.principals.sql +20 -0
  28. data/examples/sql/sqlite.propertystorage.sql +10 -0
  29. data/examples/sql/sqlite.users.sql +9 -0
  30. data/lib/tilia/cal_dav/ics_export_plugin.rb +1 -1
  31. data/lib/tilia/cal_dav/plugin.rb +27 -11
  32. data/lib/tilia/cal_dav/schedule/i_mip_plugin.rb +2 -2
  33. data/lib/tilia/cal_dav/schedule/plugin.rb +7 -0
  34. data/lib/tilia/dav/auth/backend.rb +1 -0
  35. data/lib/tilia/dav/auth/backend/abstract_basic.rb +3 -2
  36. data/lib/tilia/dav/auth/backend/abstract_bearer.rb +116 -0
  37. data/lib/tilia/dav/auth/backend/abstract_digest.rb +3 -2
  38. data/lib/tilia/dav/auth/backend/apache.rb +2 -1
  39. data/lib/tilia/dav/auth/backend/sequel.rb +2 -9
  40. data/lib/tilia/dav/client.rb +29 -3
  41. data/lib/tilia/dav/core_plugin.rb +1 -2
  42. data/lib/tilia/dav/server.rb +16 -4
  43. data/lib/tilia/dav/temporary_file_filter_plugin.rb +3 -0
  44. data/lib/tilia/dav/tree.rb +4 -3
  45. data/lib/tilia/dav/version.rb +1 -1
  46. data/lib/tilia/dav/xml/element/response.rb +20 -2
  47. data/lib/tilia/dav_acl/principal_backend/sequel.rb +50 -6
  48. data/test/cal_dav/ics_export_plugin_test.rb +1 -0
  49. data/test/cal_dav/plugin_test.rb +4 -4
  50. data/test/cal_dav/schedule/plugin_properties_test.rb +51 -0
  51. data/test/card_dav/backend/sequel_my_sql_test.rb +3 -3
  52. data/test/card_dav/vcf_export_test.rb +11 -1
  53. data/test/dav/auth/backend/abstract_bearer_test.rb +71 -0
  54. data/test/dav/client_test.rb +42 -4
  55. data/test/dav/core_plugin_test.rb +12 -0
  56. data/test/dav/fs_ext/server_test.rb +1 -1
  57. data/test/dav/http_copy_test.rb +185 -0
  58. data/test/dav/mock/collection.rb +6 -9
  59. data/test/dav/mock/file.rb +10 -9
  60. data/test/dav/mock/streaming_file.rb +1 -3
  61. data/test/dav/server_events_test.rb +8 -6
  62. data/test/dav/server_range_test.rb +135 -155
  63. data/test/dav/server_simple_test.rb +14 -0
  64. data/test/dav/xml/element/response_test.rb +56 -1
  65. data/test/dav/xml/property/href_test.rb +14 -0
  66. data/test/dav_acl/principal_backend/abstract_sequel_test.rb +16 -0
  67. data/test/dav_acl/principal_backend/mock.rb +1 -1
  68. data/test/dav_server_test.rb +1 -1
  69. data/tilia-dav.gemspec +2 -2
  70. metadata +38 -14
  71. data/test/dav/copy_test.rb +0 -33
  72. data/test/dav/server_copy_move_test.rb +0 -164
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef422337eb29663e74a7780b2b8494703a308130
4
- data.tar.gz: 10f5b410faf83945478751069c1e636595a1b3c7
3
+ metadata.gz: 524a4d934e2aa6ab149e068e97becbb5a25e6340
4
+ data.tar.gz: c0782ae991bd4f61f6966629e5607a8b53b11819
5
5
  SHA512:
6
- metadata.gz: 83ed96bc8f6f23b52e899538e532889eb8ca440b40630e3d423edc38e24b1d3c3edb80a3c93f10394ff8d4159f36eb8661683fc3318049c1839427dc3b2d9af2
7
- data.tar.gz: 626c073bcc2cd4dc842650a3abb5eabdf0f74d27246890851d75ddb65eb2eaf2f9b5b9fbefed62402f8f2251fa0eff94a20756d5140667e88c1fd4405809eda5
6
+ metadata.gz: 387e985c9769ef1def97f600aaf60aac11030a7ef942830d8bfaa43f05411de9cf6270b320c6db92c22746e55a2b9b5adeb54e2acff63aa116ba1f456a073ed0
7
+ data.tar.gz: 573cf47a662afbb94547e677457fdc25d537d034e6c31431b7204be8a81b2fd5f3a0cc4b6cf48f5b8ac761c7f21b6ae7f37d9e76ca141eaa38b537f702949db6
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  # database connection file
5
5
  /database.yml
6
+ /examples/database.yml
6
7
 
7
8
  # backup files
8
9
  *~
@@ -23,3 +24,4 @@
23
24
 
24
25
  # Example server roots
25
26
  /examples/*test_root
27
+ /examples/*test_tmp
@@ -1,6 +1,47 @@
1
1
  ChangeLog
2
2
  ======
3
3
 
4
+ 3.1.1 (2016-01-25)
5
+ ------------------
6
+
7
+ * #755: The brower plugin and some operations would break when scheduling and
8
+ delegation would both be enabled.
9
+ * #757: A bunch of unittest improvements (@jakobsack).
10
+ * The zip release ships with [sabre/vobject 4.0.2][vobj],
11
+ [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt],
12
+ [sabre/uri 1.0.1][uri] and [sabre/xml 1.3.0][xml].
13
+
14
+
15
+ 3.1.0 (2016-01-06)
16
+ ------------------
17
+
18
+ * Better error message when the browser plugin is not enabled.
19
+ * Added a super minimal server example.
20
+ * #730: Switched all mysql tables to `utf8mb4` character set, allowing you to
21
+ use emoji in some tables where you couldn't before.
22
+ * #710: Provide an Auth backend that acts as a helper for people implementing
23
+ OAuth2 Bearer token. (@fkooman).
24
+ * #729: Not all calls to `Sabre\DAV\Tree::getChildren()` were properly cached.
25
+ * #727: Added another workaround to make CalDAV work for Windows 10 clients.
26
+ * #742: Fixes to make sure that vobject 4 is correctly supported.
27
+ * #726: Better error reporting in `Client::propPatch`. We're now throwing
28
+ exceptions.
29
+ * #608: When a HTTP error is triggered during `Client:propFind`, we're now
30
+ throwing `Sabre\HTTP\ClientHttpException` instead of `Sabre\DAV\Exception`.
31
+ This new exception contains a LOT more information about the problem.
32
+ * #721: Events are now handled in the correct order for `COPY` requests.
33
+ Before this subtle bugs could appear that could cause data-loss.
34
+ * #747: Now throwing exceptions and setting the HTTP status to 500 in subtle
35
+ cases where no other plugin set a correct HTTP status.
36
+ * #686: Corrected PDO principal backend's findByURI for email addresses that
37
+ don't match the exact capitalization.
38
+ * #512: The client now has it's own `User-Agent`.
39
+ * #720: Some browser improvements.
40
+ * The zip release ships with [sabre/vobject 4.0.1][vobj],
41
+ [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt],
42
+ [sabre/uri 1.0.1][uri] and [sabre/xml 1.3.0][xml].
43
+
44
+
4
45
  3.1.0-alpha2 (2015-09-05)
5
46
  -------------------------
6
47
 
@@ -34,6 +75,40 @@ ChangeLog
34
75
  [sabre/uri 1.0.1][uri] and [sabre/xml 1.1.0][xml].
35
76
 
36
77
 
78
+ 3.0.7 (2016-01-12)
79
+ ------------------
80
+
81
+ * #752: PHP 7 support for 3.0 branch. (@DeepDiver1975)
82
+ * The zip release ships with [sabre/vobject 3.5.0][vobj],
83
+ [sabre/http 4.2.1][http], [sabre/event 2.0.2][evnt],
84
+ [sabre/uri 1.0.1][uri] and [sabre/xml 1.3.0][xml].
85
+
86
+
87
+ 3.0.6 (2016-01-04)
88
+ ------------------
89
+
90
+ * #730: Switched all mysql tables to `utf8mb4` character set, allowing you to
91
+ use emoji in some tables where you couldn't before.
92
+ * #729: Not all calls to `Sabre\DAV\Tree::getChildren()` were properly cached.
93
+ * #734: Return `418 I'm a Teapot` when generating a multistatus response that
94
+ has resources with no returned properties.
95
+ * #740: Bugs in `migrate20.php` script.
96
+ * The zip release ships with [sabre/vobject 3.4.8][vobj],
97
+ [sabre/http 4.1.0][http], [sabre/event 2.0.2][evnt],
98
+ [sabre/uri 1.0.1][uri] and [sabre/xml 1.3.0][xml].
99
+
100
+
101
+ 3.0.5 (2015-09-15)
102
+ ------------------
103
+
104
+ * #704: Fixed broken uri encoding in multistatus responses. This affected
105
+ at least CyberDuck, but probably also others.
106
+ * The zip release ships with [sabre/vobject 3.4.7][vobj],
107
+ * The zip release ships with [sabre/vobject 3.4.7][vobj],
108
+ [sabre/http 4.1.0][http], [sabre/event 2.0.2][evnt],
109
+ [sabre/uri 1.0.1][uri] and [sabre/xml 1.2.0][xml].
110
+
111
+
37
112
  3.0.4 (2015-09-06)
38
113
  ------------------
39
114
 
@@ -179,6 +254,8 @@ ChangeLog
179
254
  its second argument, and no longer receives seperate properties and
180
255
  resourcetype arguments.
181
256
  * `MKCOL` now integrates better with propertystorage plugins.
257
+ * #623: Remove need of temporary files when working with Range requests.
258
+ (@dratini0)
182
259
  * The zip release ships with [sabre/vobject 3.4.2][vobj],
183
260
  [sabre/http 4.0.0-alpha1][http], [sabre/event 2.0.1][evnt],
184
261
  [sabre/uri 1.0.0][uri] and [sabre/xml 0.4.3][xml].
@@ -237,6 +314,23 @@ ChangeLog
237
314
  * #193: Fix `Sabre\DAV\FSExt\Directory::getQuotaInfo()` on windows.
238
315
 
239
316
 
317
+ 2.1.9 (2016-01-25)
318
+ ------------------
319
+
320
+ * #674: PHP7 support (@DeepDiver1975).
321
+ * The zip release ships with [sabre/vobject 3.5.0][vobj],
322
+ [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt].
323
+
324
+
325
+ 2.1.8 (2016-01-04)
326
+ ------------------
327
+
328
+ * #729: Fixed a caching problem in the Tree object.
329
+ * #740: Bugs in `migrate20.php` script.
330
+ * The zip release ships with [sabre/vobject 3.4.8][vobj],
331
+ [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt].
332
+
333
+
240
334
  2.1.7 (2015-09-05)
241
335
  ------------------
242
336
 
@@ -2070,7 +2164,9 @@ ChangeLog
2070
2164
 
2071
2165
  * First release!
2072
2166
  * Passes litmus: basic, http and copymove test.
2073
- * Fully working in Finder and DavFSv2 Project started: 2007-12-13
2167
+ * Fully working in Finder and DavFSv2.
2168
+
2169
+ Project started: 2007-12-13
2074
2170
 
2075
2171
 
2076
2172
  [vobj]: http://sabre.io/vobject/
data/Gemfile CHANGED
@@ -1,21 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Internal dependencies
4
- gem 'tilia-vobject', '>= 4.0.0-alpha4'
5
- gem 'tilia-event', '~> 2.0'
6
- gem 'tilia-xml', '~> 1.2'
7
- gem 'tilia-http', '~> 4.1'
8
- gem 'tilia-uri', '~> 1.0'
9
-
10
- # External dependencies
11
- gem 'activesupport', '~> 4.2'
12
- gem 'sys-filesystem', '~> 1.1'
13
- gem 'sequel', '~> 4.29'
14
- gem 'sqlite3', '~> 1.3'
15
- gem 'mysql2', '~> 0.4'
16
- gem 'chronic', '~> 0.10'
17
- gem 'mail', '~> 2.6'
18
- gem 'rchardet', '~>1.6'
3
+ gemspec
19
4
 
20
5
  # Testing
21
6
  gem 'rake'
@@ -1,3 +1,21 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tilia-dav (3.1.1)
5
+ activesupport (>= 4.0)
6
+ chronic (~> 0.10)
7
+ mail (~> 2.6)
8
+ mysql2 (~> 0.4)
9
+ rchardet (~> 1.6)
10
+ sequel (~> 4.29)
11
+ sqlite3 (~> 1.3)
12
+ sys-filesystem (~> 1.1)
13
+ tilia-event (~> 2.0)
14
+ tilia-http (~> 4.1)
15
+ tilia-uri (~> 1.0)
16
+ tilia-vobject (~> 4.0.2)
17
+ tilia-xml (~> 1.2)
18
+
1
19
  GEM
2
20
  remote: https://rubygems.org/
3
21
  specs:
@@ -7,9 +25,7 @@ GEM
7
25
  minitest (~> 5.1)
8
26
  thread_safe (~> 0.3, >= 0.3.4)
9
27
  tzinfo (~> 1.1)
10
- ast (2.1.0)
11
- astrolabe (1.3.1)
12
- parser (~> 2.2)
28
+ ast (2.2.0)
13
29
  chronic (0.10.2)
14
30
  docile (1.1.5)
15
31
  ethon (0.8.1)
@@ -20,26 +36,25 @@ GEM
20
36
  libxml-ruby (2.8.0)
21
37
  mail (2.6.3)
22
38
  mime-types (>= 1.16, < 3)
23
- mime-types (2.99)
39
+ mime-types (2.99.1)
24
40
  minitest (5.8.4)
25
41
  mysql2 (0.4.2)
26
- parser (2.2.3.0)
27
- ast (>= 1.1, < 3.0)
42
+ parser (2.3.0.6)
43
+ ast (~> 2.2)
28
44
  powerpack (0.1.1)
29
45
  rack (1.6.4)
30
- rainbow (2.0.0)
31
- rake (10.4.2)
46
+ rainbow (2.1.0)
47
+ rake (10.5.0)
32
48
  rchardet (1.6.1)
33
- rubocop (0.35.1)
34
- astrolabe (~> 1.3)
35
- parser (>= 2.2.3.0, < 3.0)
49
+ rubocop (0.37.2)
50
+ parser (>= 2.3.0.4, < 3.0)
36
51
  powerpack (~> 0.1)
37
52
  rainbow (>= 1.99.1, < 3.0)
38
53
  ruby-progressbar (~> 1.7)
39
- tins (<= 1.6.0)
54
+ unicode-display_width (~> 0.3)
40
55
  ruby-progressbar (1.7.5)
41
- sequel (4.29.0)
42
- simplecov (0.11.1)
56
+ sequel (4.31.0)
57
+ simplecov (0.11.2)
43
58
  docile (~> 1.1.0)
44
59
  json (~> 1.8)
45
60
  simplecov-html (~> 0.10.0)
@@ -48,55 +63,43 @@ GEM
48
63
  sys-filesystem (1.1.5)
49
64
  ffi
50
65
  thread_safe (0.3.5)
51
- tilia-event (2.0.2)
52
- activesupport (~> 4.2)
53
- tilia-http (4.1.0.6)
54
- activesupport (~> 4.2)
66
+ tilia-event (2.0.2.1)
67
+ activesupport (>= 4.0)
68
+ tilia-http (4.2.1)
69
+ activesupport (>= 4.0)
55
70
  rack (~> 1.6)
56
71
  rchardet (~> 1.6)
57
72
  tilia-event (~> 2.0)
58
73
  tilia-uri (~> 1.0)
59
74
  typhoeus (~> 0.8)
60
- tilia-uri (1.0.1)
61
- activesupport (~> 4.2)
62
- tilia-vobject (4.0.0.pre.alpha4)
63
- activesupport (~> 4.2)
75
+ tilia-uri (1.0.1.1)
76
+ activesupport (>= 4.0)
77
+ tilia-vobject (4.0.2)
78
+ activesupport (>= 4.0)
64
79
  mail (~> 2.6)
65
80
  rchardet (~> 1.6)
66
- tilia-xml (~> 1.1)
81
+ tilia-xml (~> 1.3)
67
82
  tzinfo (~> 1.2)
68
- tilia-xml (1.2.0.2)
69
- activesupport (~> 4.2)
70
- libxml-ruby (~> 2.8)
71
- tilia-uri (~> 1.0)
72
- tins (1.6.0)
83
+ tilia-xml (1.3.0)
84
+ activesupport (>= 4.0)
85
+ libxml-ruby (>= 2.8)
86
+ tilia-uri (~> 1.0, >= 1.0.1.1)
73
87
  typhoeus (0.8.0)
74
88
  ethon (>= 0.8.0)
75
89
  tzinfo (1.2.2)
76
90
  thread_safe (~> 0.1)
91
+ unicode-display_width (0.3.1)
77
92
  yard (0.8.7.6)
78
93
 
79
94
  PLATFORMS
80
95
  ruby
81
96
 
82
97
  DEPENDENCIES
83
- activesupport (~> 4.2)
84
- chronic (~> 0.10)
85
- mail (~> 2.6)
86
98
  minitest (~> 5.8)
87
- mysql2 (~> 0.4)
88
99
  rake
89
- rchardet (~> 1.6)
90
100
  rubocop (~> 0.34)
91
- sequel (~> 4.29)
92
101
  simplecov (~> 0.10)
93
- sqlite3 (~> 1.3)
94
- sys-filesystem (~> 1.1)
95
- tilia-event (~> 2.0)
96
- tilia-http (~> 4.1)
97
- tilia-uri (~> 1.0)
98
- tilia-vobject (>= 4.0.0.pre.alpha4)
99
- tilia-xml (~> 1.2)
102
+ tilia-dav!
100
103
  yard (~> 0.8)
101
104
 
102
105
  BUNDLED WITH
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2015 Jakob Sack (tilia@jakobsack.de)
1
+ Copyright (C) 2015-2016 Jakob Sack (tilia@jakobsack.de)
2
2
 
3
3
  All rights reserved.
4
4
 
@@ -1,4 +1,4 @@
1
- Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/)
1
+ Copyright (C) 2007-2016 fruux GmbH (https://fruux.com/)
2
2
 
3
3
  All rights reserved.
4
4
 
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+ # Addressbook/CardDAV server example
3
+ #
4
+ # This server features CardDAV support
5
+
6
+ # Expected to be called "bundle exec examples/addressbookserver.rb"
7
+ $LOAD_PATH.unshift './lib'
8
+
9
+ require 'tilia/dav'
10
+ require 'rack'
11
+ require 'yaml'
12
+ require 'sequel'
13
+
14
+ Time.zone = 'Berlin'
15
+
16
+ # Load databases
17
+ database_file = File.join(File.dirname(__FILE__), 'database.yml')
18
+ fail 'could not load database file for mysql database' unless File.exist?(database_file)
19
+ config = YAML.load(File.read(database_file))
20
+ database = config.delete(:database)
21
+ sequel = Sequel.mysql2(database, config)
22
+
23
+ app = proc do |env|
24
+ # Backends
25
+ auth_backend = Tilia::Dav::Auth::Backend::Sequel.new(sequel)
26
+ principal_backend = Tilia::DavAcl::PrincipalBackend::Sequel.new(sequel)
27
+ carddav_backend = Tilia::CardDav::Backend::Sequel.new(sequel)
28
+
29
+ # Setting up the directory tree //
30
+ nodes = [
31
+ Tilia::DavAcl::PrincipalCollection.new(principal_backend),
32
+ Tilia::CardDav::AddressBookRoot.new(principal_backend, carddav_backend)
33
+ ]
34
+
35
+ # The object tree needs in turn to be passed to the server class
36
+ server = Tilia::Dav::Server.new(env, nodes)
37
+
38
+ # Plugins
39
+ server.add_plugin(Tilia::Dav::Auth::Plugin.new(auth_backend))
40
+ server.add_plugin(Tilia::Dav::Browser::Plugin.new)
41
+ server.add_plugin(Tilia::CardDav::Plugin.new)
42
+ server.add_plugin(Tilia::DavAcl::Plugin.new)
43
+ server.add_plugin(Tilia::Dav::Sync::Plugin.new)
44
+
45
+ # And off we go!
46
+ server.exec
47
+ end
48
+
49
+ Rack::Handler::WEBrick.run app
50
+
51
+
52
+
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+ # CalDAV server example
3
+ #
4
+ # This server features CalDAV support
5
+
6
+ # Expected to be called "bundle exec examples/calendarserver.rb"
7
+ $LOAD_PATH.unshift './lib'
8
+
9
+ require 'tilia/dav'
10
+ require 'rack'
11
+ require 'yaml'
12
+ require 'sequel'
13
+
14
+ Time.zone = 'Berlin'
15
+
16
+ # Load databases
17
+ database_file = File.join(File.dirname(__FILE__), 'database.yml')
18
+ fail 'could not load database file for mysql database' unless File.exist?(database_file)
19
+ config = YAML.load(File.read(database_file))
20
+ database = config.delete(:database)
21
+ sequel = Sequel.mysql2(database, config)
22
+
23
+ app = proc do |env|
24
+ root = Tilia::Dav::Fs::Directory.new(testserver_root)
25
+ server = Tilia::Dav::Server.new(env, [root])
26
+
27
+ server.add_plugin(Tilia::Dav::Browser::Plugin.new)
28
+
29
+ server.exec
30
+
31
+ # Backends
32
+ auth_backend = Tilia::Dav::Auth::Backend::Sequel.new(sequel)
33
+ principal_backend = Tilia::DavAcl::PrincipalBackend::Sequel.new(sequel)
34
+ calendar_backend = Tilia::CalDav::Backend::Sequel.new(sequel)
35
+
36
+ # Setting up the directory tree //
37
+ nodes = [
38
+ Tilia::CalDav::Principal::Collection.new(principal_backend),
39
+ Tilia::CalDav::CalendarRoot.new(principal_backend, calendar_backend)
40
+ ]
41
+
42
+ # The object tree needs in turn to be passed to the server class
43
+ server = Tilia::Dav::Server.new(env, nodes)
44
+
45
+ # Plugins
46
+ server.add_plugin(Tilia::Dav::Auth::Plugin.new(auth_backend))
47
+ server.add_plugin(Tilia::Dav::Browser::Plugin.new)
48
+ server.add_plugin(Tilia::CalDav::Plugin.new)
49
+ server.add_plugin(Tilia::DavAcl::Plugin.new)
50
+ server.add_plugin(Tilia::Dav::Sync::Plugin.new)
51
+ server.add_plugin(Tilia::CalDav::Subscriptions::Plugin.new)
52
+ server.add_plugin(Tilia::CalDav::Schedule::Plugin.new)
53
+
54
+ # And off we go!
55
+ server.exec
56
+ end
57
+
58
+ Rack::Handler::WEBrick.run app
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+ # This is the best starting point if you're just interested in setting up a fileserver.
3
+ #
4
+ # Make sure that the 'public' and 'tmpdata' exists, with write permissions
5
+ # for your server.
6
+
7
+ # Expected to be called "bundle exec examples/minimal.rb"
8
+ $LOAD_PATH.unshift './lib'
9
+
10
+ require 'tilia/dav'
11
+ require 'rack'
12
+ require 'yaml'
13
+ require 'sequel'
14
+
15
+ Time.zone = 'Berlin'
16
+
17
+ testserver_root = File.join(File.dirname(__FILE__), 'testserver_root')
18
+ Dir.mkdir(testserver_root) unless File.exist?(testserver_root)
19
+ testserver_tmp = File.join(File.dirname(__FILE__), 'testserver_tmp')
20
+ Dir.mkdir(testserver_tmp) unless File.exist?(testserver_tmp)
21
+
22
+ fail "could not create root directory #{testserver_root}" unless File.directory?(testserver_root)
23
+ fail "could not create root directory #{testserver_root}" unless File.directory?(testserver_tmp)
24
+
25
+ app = proc do |env|
26
+ # Create the root node
27
+ root = Tilia::Dav::Fs::Directory.new(testserver_root)
28
+
29
+ # The rootnode needs in turn to be passed to the server class
30
+ server = Tilia::Dav::Server.new(env, [root])
31
+ server.debug_exceptions = true
32
+
33
+ # Support for LOCK and UNLOCK
34
+ lock_backend = Tilia::Dav::Locks::Backend::File.new(testserver_tmp + '/locksdb')
35
+ lock_plugin = Tilia::Dav::Locks::Plugin.new(lock_backend)
36
+ server.add_plugin(lock_plugin)
37
+
38
+ # Support for html frontend
39
+ browser = Tilia::Dav::Browser::Plugin.new
40
+ server.add_plugin(browser)
41
+
42
+ # Automatically guess (some) contenttypes, based on extesion
43
+ server.add_plugin(Tilia::Dav::Browser::GuessContentType.new)
44
+
45
+ # Authentication backend
46
+ auth_backend = Tilia::Dav::Auth::Backend::File.new(testserver_tmp + '.htdigest')
47
+ auth = Tilia::Dav::Auth::Plugin.new(auth_backend)
48
+ server.add_plugin(auth)
49
+
50
+ # Temporary file filter
51
+ temp_ff = Tilia::Dav::TemporaryFileFilterPlugin.new(testserver_tmp)
52
+ server.add_plugin(temp_ff)
53
+
54
+ server.exec
55
+ end
56
+
57
+ Rack::Handler::WEBrick.run app