waitress-core 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/ext/waitress_http11/http11_wrb_parser.h +9 -1
- data/lib/waitress/chef.rb +5 -2
- data/lib/waitress/evalbind.rb +9 -0
- data/lib/waitress/server.rb +1 -1
- data/lib/waitress/version.rb +1 -1
- data/lib/waitress.rb +1 -0
- data/lib/waitress_http11.bundle +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f552a919bea93da988c0e9d2da78f1f7f3ba950b
|
4
|
+
data.tar.gz: 1c68dce7fcd814fd1a2a2ee4ceca5b6a8bf08676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b2bccd565fbda334321875aa11e1d59f45b995c69f4d061af4c348ced0db5479625cb019b5bf0ccf24e61af5de58b7b7ece144ba74da04f136cedc4fc8c347e
|
7
|
+
data.tar.gz: eab73cf5eff46c885eff8f9c6eb69e6872887958a99c1ef0fb7bf9a5cf42f7b60644d552702c577ab098bb2d1dd98e9ccad9f9b8c445b4bc6fd5433487124d63
|
@@ -27,17 +27,25 @@ VALUE WRB_Parse(VALUE self, VALUE string, VALUE buffer) {
|
|
27
27
|
|
28
28
|
int i = 0;
|
29
29
|
char pc = NULL;
|
30
|
+
int line_cur = 1;
|
31
|
+
int line = 1;
|
32
|
+
|
30
33
|
while (i < slen) {
|
31
34
|
char c = sptr[i];
|
35
|
+
if (c == '\n') line_cur += 1;
|
36
|
+
|
32
37
|
int open_e = i + tarlen;
|
33
38
|
char *open_s = substr(sptr, i, tarlen);
|
34
39
|
|
35
40
|
if (mat(open_s, tar) && pc != '\\') {
|
41
|
+
line = line_cur;
|
36
42
|
int j = open_e;
|
37
43
|
int search = 1;
|
38
44
|
int q1 = 0; int q2 = 0;
|
39
45
|
while (j < slen && search) {
|
40
46
|
char cc = sptr[j];
|
47
|
+
if (cc == '\n') line_cur += 1;
|
48
|
+
|
41
49
|
int close_e = j + endlen;
|
42
50
|
char *close_s = substr(sptr, j, endlen);
|
43
51
|
|
@@ -48,7 +56,7 @@ VALUE WRB_Parse(VALUE self, VALUE string, VALUE buffer) {
|
|
48
56
|
i = close_e - 1;
|
49
57
|
search = 0;
|
50
58
|
char *rb_ev = substr(sptr, open_e, j - open_e);
|
51
|
-
|
59
|
+
rb_yield_values(2, rb_str_new2(rb_ev), INT2NUM(line));
|
52
60
|
}
|
53
61
|
}
|
54
62
|
|
data/lib/waitress/chef.rb
CHANGED
@@ -66,8 +66,11 @@ module Waitress
|
|
66
66
|
# +target+:: The target file, given in absolute path form.
|
67
67
|
def self.include_absfile target
|
68
68
|
ext = File.extname target
|
69
|
+
bind = Waitress::EvalBindings.new
|
69
70
|
if ext == ".wrb"
|
70
|
-
Waitress::WRBParser.parse!
|
71
|
+
Waitress::WRBParser.parse!(File.read(target), $RESPONSE.body_io) do |txt, lino|
|
72
|
+
eval(txt, bind.context, target, lino) # For some reason, rb_f_eval is not exposed to ruby.h
|
73
|
+
end
|
71
74
|
elsif ext == ".rb"
|
72
75
|
require target
|
73
76
|
else
|
@@ -79,7 +82,7 @@ module Waitress
|
|
79
82
|
# to automatically include an index file if it exists under the
|
80
83
|
# requested directory, automatically add the .wrb or .html file extension
|
81
84
|
# for paths without the extension, etc. A hash containing the result (ok / notfound)
|
82
|
-
# and the new filepath will be given.
|
85
|
+
# and the new filepath will be given.
|
83
86
|
def self.find_file abspath
|
84
87
|
ret = {}
|
85
88
|
if File.exist?(abspath)
|
data/lib/waitress/server.rb
CHANGED
data/lib/waitress/version.rb
CHANGED
data/lib/waitress.rb
CHANGED
data/lib/waitress_http11.bundle
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waitress-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaci Brunning
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/waitress.rb
|
149
149
|
- lib/waitress/chef.rb
|
150
150
|
- lib/waitress/configure.rb
|
151
|
+
- lib/waitress/evalbind.rb
|
151
152
|
- lib/waitress/handlers/dirhandler.rb
|
152
153
|
- lib/waitress/handlers/handler.rb
|
153
154
|
- lib/waitress/handlers/handler404.rb
|