Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 344
- Log:
Massive changeset which brings the old, ROOL customised Instiki
version up to date, but without any ROOL customisations in this
latest checked-in version (which is 0.19.1). This is deliberate,
so that it's easy to see the changes made for the ROOL version
in a subsequent changeset. The 'app/views/shared' directory is not
part of Instiki but is kept to maintain the change history with
updated ROOL customisations, some of which involve the same files
in that same directory.
- Author:
- rool
- Date:
- Sat Mar 19 19:52:13 +0000 2011
- Size:
- 1966 Bytes
1 | require 'yaml' |
2 | require 'net/http' |
3 | |
4 | class TestRequest |
5 | NOSERIALIZE = [Method, Proc] |
6 | |
7 | def call(env) |
8 | status = env["QUERY_STRING"] =~ /secret/ ? 403 : 200 |
9 | env["test.postdata"] = env["rack.input"].read |
10 | minienv = env.dup |
11 | # This may in the future want to replace with a dummy value instead. |
12 | minienv.delete_if { |k,v| NOSERIALIZE.any? { |c| v.kind_of?(c) } } |
13 | body = minienv.to_yaml |
14 | size = body.respond_to?(:bytesize) ? body.bytesize : body.size |
15 | [status, {"Content-Type" => "text/yaml", "Content-Length" => size.to_s}, [body]] |
16 | end |
17 | |
18 | module Helpers |
19 | attr_reader :status, :response |
20 | |
21 | ROOT = File.expand_path(File.dirname(__FILE__) + "/..") |
22 | ENV["RUBYOPT"] = "-I#{ROOT}/lib -rubygems" |
23 | |
24 | def root |
25 | ROOT |
26 | end |
27 | |
28 | def rackup |
29 | "#{ROOT}/bin/rackup" |
30 | end |
31 | |
32 | def GET(path, header={}) |
33 | Net::HTTP.start(@host, @port) { |http| |
34 | user = header.delete(:user) |
35 | passwd = header.delete(:passwd) |
36 | |
37 | get = Net::HTTP::Get.new(path, header) |
38 | get.basic_auth user, passwd if user && passwd |
39 | http.request(get) { |response| |
40 | @status = response.code.to_i |
41 | begin |
42 | @response = YAML.load(response.body) |
43 | rescue TypeError, ArgumentError |
44 | @response = nil |
45 | end |
46 | } |
47 | } |
48 | end |
49 | |
50 | def POST(path, formdata={}, header={}) |
51 | Net::HTTP.start(@host, @port) { |http| |
52 | user = header.delete(:user) |
53 | passwd = header.delete(:passwd) |
54 | |
55 | post = Net::HTTP::Post.new(path, header) |
56 | post.form_data = formdata |
57 | post.basic_auth user, passwd if user && passwd |
58 | http.request(post) { |response| |
59 | @status = response.code.to_i |
60 | @response = YAML.load(response.body) |
61 | } |
62 | } |
63 | end |
64 | end |
65 | end |
66 | |
67 | class StreamingRequest |
68 | def self.call(env) |
69 | [200, {"Content-Type" => "text/plain"}, new] |
70 | end |
71 | |
72 | def each |
73 | yield "hello there!\n" |
74 | sleep 5 |
75 | yield "that is all.\n" |
76 | end |
77 | end |