landline 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/HACKING.md +30 -0
  3. data/LAYOUT.md +59 -0
  4. data/LICENSE.md +660 -0
  5. data/README.md +159 -0
  6. data/lib/landline/dsl/constructors_path.rb +107 -0
  7. data/lib/landline/dsl/constructors_probe.rb +28 -0
  8. data/lib/landline/dsl/methods_common.rb +28 -0
  9. data/lib/landline/dsl/methods_path.rb +75 -0
  10. data/lib/landline/dsl/methods_probe.rb +129 -0
  11. data/lib/landline/dsl/methods_template.rb +16 -0
  12. data/lib/landline/node.rb +87 -0
  13. data/lib/landline/path.rb +157 -0
  14. data/lib/landline/pattern_matching/glob.rb +168 -0
  15. data/lib/landline/pattern_matching/rematch.rb +49 -0
  16. data/lib/landline/pattern_matching/util.rb +15 -0
  17. data/lib/landline/pattern_matching.rb +75 -0
  18. data/lib/landline/probe/handler.rb +56 -0
  19. data/lib/landline/probe/http_method.rb +74 -0
  20. data/lib/landline/probe/serve_handler.rb +39 -0
  21. data/lib/landline/probe.rb +62 -0
  22. data/lib/landline/request.rb +135 -0
  23. data/lib/landline/response.rb +140 -0
  24. data/lib/landline/server.rb +49 -0
  25. data/lib/landline/template/erb.rb +27 -0
  26. data/lib/landline/template/erubi.rb +36 -0
  27. data/lib/landline/template.rb +95 -0
  28. data/lib/landline/util/cookie.rb +150 -0
  29. data/lib/landline/util/errors.rb +11 -0
  30. data/lib/landline/util/html.rb +119 -0
  31. data/lib/landline/util/lookup.rb +37 -0
  32. data/lib/landline/util/mime.rb +1276 -0
  33. data/lib/landline/util/multipart.rb +175 -0
  34. data/lib/landline/util/parsesorting.rb +37 -0
  35. data/lib/landline/util/parseutils.rb +111 -0
  36. data/lib/landline/util/query.rb +66 -0
  37. data/lib/landline.rb +20 -0
  38. metadata +85 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8cfe9c90223c0d5d2fdc054e3aa2f96e76cdfeada0e865e13ef72d87b08526ff
4
+ data.tar.gz: 5a3b62e85bdafa0f9470f42d6c6789c32a4eaf9f00df686188837c3b13c570ff
5
+ SHA512:
6
+ metadata.gz: f89f80cab3f587d952a3aaca92fce4f715d7778475ffc7c36abc207b6e377a233d8450e8b051013c6bcd7c77f9271fbdf0c48b336e0961f0841437fb7fef4f07
7
+ data.tar.gz: 49a13a596296b21c9a8abedc9f1aaf479f7bdda3a20e0eeff874c2cb92f064df577e6b14067b31765cb4aeddbea46c35a54804a8ce77be66f47cdbf22b371a80
data/HACKING.md ADDED
@@ -0,0 +1,30 @@
1
+ # Notes and things to consider on Landline hacking
2
+
3
+ The structure of the Landline rewrite was specifically redesigned to allow for
4
+ extensive modification and extension. So to keep things that way, you may
5
+ want to consider the methodology of writing Landline code.
6
+
7
+ ## Recommendations
8
+
9
+ To keep things beautiful, consider following recommendations:
10
+
11
+ - **USE COMMON SENSE**. None of these guidelines will ever be adequate
12
+ enough to replace common sense.
13
+ - **Code less, think with ~~portals~~ what you have**. To minimize code
14
+ overhead, try to use existing functionality to get the effect you want.
15
+ (i.e. if you want to append headers to a request when it traverses a path,
16
+ don't write a new class variable and handler for this - just create a new
17
+ DSL method that really just appends a preprocessor to the path. Or avoid
18
+ making something like this at all - after all, preprocessors exist
19
+ exactly for that reason.)
20
+ - Preferably, **extend the DSL and not the class*. Extensive class
21
+ modifications make code a lot less maintainable, if it wasn't obvious
22
+ already. If it can't be helped, then at the very least use Rubocop.
23
+ - Document classes as if the next maintainer after you has you at gunpoint.
24
+ Document thoroughly, use YARD tags and **never** skip on public method
25
+ docs and class docs. As an example, consider Landline::PatternMatching::Glob.
26
+ - Unit tests suck for many reasons. However, if you're writing a class that
27
+ does not have any dependents and which is frequently used, consider making
28
+ a unit test for it. People that might have to fix things further along
29
+ will be very thankful.
30
+
data/LAYOUT.md ADDED
@@ -0,0 +1,59 @@
1
+ # Internal structure of Landline lib
2
+
3
+ Note: If you want to start hacking on Landline and extending it, follow this
4
+ layout as closely as possible.
5
+
6
+ ## Core classes
7
+
8
+ These are core classes of Landline and they are loaded as soon as the library is loaded.
9
+
10
+ - Landline::Path [path.rb]
11
+ - Landline::PathBinding [path.rb]
12
+ - Landline::Probe [probe.rb]
13
+ - Landline::ProbeBinding [probe.rb]
14
+ - Landline::Node (parent of Path and Probe) [node.rb]
15
+ - Landline::Server (Rack application interface) [server.rb]
16
+ - Landline::ServerBinding [server.rb]
17
+ - Landline::Request (Rack request wrapper) [request.rb]
18
+ - Landline::Response (Rack response wrapper) [response.rb]
19
+ - Landline::Pattern [pattern\_matching.rb]
20
+
21
+ ## Patterns
22
+
23
+ These are classes that Landline::Pattern can interface with to create Patterns.
24
+
25
+ - Landline::PatternMatching::ReMatch [pattern\_matching/rematch.rb]
26
+ - Landline::PatternMatching::Glob [pattern\_matching/glob.rb]
27
+
28
+ ## DSL Method mixins
29
+
30
+ These are module mixins that add common methods to DSL bindings.
31
+
32
+ - Landline::DSL::PathConstructors [dsl/path\_constructors.rb]
33
+
34
+ ## Utilities
35
+
36
+ These are self-contained classes and methods that add extra functionality to Landline.
37
+
38
+ - Landline::Util::Lookup [util/lookup.rb]
39
+
40
+ ## Probe subclasses
41
+
42
+ These are reactive request handlers with their own semantics, if needed.
43
+
44
+ - Landline::Handler [probe/handler.rb]
45
+ - Landline::GETHandler [probe/http\_method.rb]
46
+ - Landline::POSTHandler [probe/http\_method.rb]
47
+ - Landline::HEADHandler [probe/http\_method.rb]
48
+ - Landline::PUTHandler [probe/http\_method.rb]
49
+ - Landline::DELETEHandler [probe/http\_method.rb]
50
+ - Landline::CONNECTHandler [probe/http\_method.rb]
51
+ - Landline::OPTIONSHandler [probe/http\_method.rb]
52
+ - Landline::TRACEHandler [probe/http\_method.rb]
53
+ - Landline::PATCHHandler [probe/http\_method.rb]
54
+
55
+ ## Path subclasses
56
+
57
+ These are navigation handlers with their own semantics.
58
+
59
+ (currently none)