rack-cgi 0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/README.md +60 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/rack/cgi/version.rb +5 -0
- data/rack-cgi.gemspec +35 -12
- metadata +88 -19
- data/test/cgi/error +0 -6
- data/test/cgi/export +0 -7
- data/test/cgi/file +0 -1
- data/test/cgi/index.cgi +0 -6
- data/test/cgi/redirect +0 -6
- data/test/cgi/test.php +0 -3
- data/test/cgi/without_header +0 -2
- data/test/config.ru +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e729e9b2542873a943dbb1deae047c6a54540d4d
|
4
|
+
data.tar.gz: a80866ebad4baa9c9aeb93c96fc3f093481c7ace
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d5583c12e8c56d9c220eac7382df3effbeff7cde637221cf4ce1fed1d64ffb3f9e6430bda2073265e36e504a5b2a70525c5f055b5debd9b73298a62904a0ed27
|
7
|
+
data.tar.gz: 6bb2fb2471284598cf0ec1945541aaba4d1dfbdf20fb2fe23814264bea42c2fb825b1a9e1832dfd57ed44c3da523fab9e43aa0acd9bdf30221a3532f7123b6d7
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
Rack::CGI
|
2
|
+
=========
|
3
|
+
|
4
|
+
Let you using CGI in your rack application.
|
5
|
+
|
6
|
+
Usage
|
7
|
+
-----
|
8
|
+
|
9
|
+
Here is an example for using Rack::CGI
|
10
|
+
|
11
|
+
# config.ru
|
12
|
+
|
13
|
+
use Rack::CGI, cgi_path: 'cgi', index: 'index.cgi', Rack::CGI::Executable => '', /\.php$/ => '/usr/bin/php-cgi'
|
14
|
+
use Rack::Static, urls: ['/'], root: 'cgi'
|
15
|
+
run proc{ [404, {"CONTENT-TYPE" => "text/plain"}, ['404 Not Found']] }
|
16
|
+
|
17
|
+
Howto
|
18
|
+
-----
|
19
|
+
|
20
|
+
### Document Root
|
21
|
+
|
22
|
+
In default, Rack::CGI will use Dir.pwd as document root, you can use `cgi_path: path` to change it.
|
23
|
+
|
24
|
+
### Index file
|
25
|
+
|
26
|
+
When user access directory, Rack::CGI will use index script instand of.
|
27
|
+
|
28
|
+
If you not special index, Rack::CGI will not have a default value, and it's not works.
|
29
|
+
|
30
|
+
You can special index as follow:
|
31
|
+
|
32
|
+
use Rack::CGI, index: 'index.php'
|
33
|
+
|
34
|
+
# or special multiple, Rack::CGI will try each by order
|
35
|
+
use Rack::CGI, index: ['index.php', 'index.cgi']
|
36
|
+
|
37
|
+
### Rules
|
38
|
+
|
39
|
+
When Rack::CGI found a script file in disk, it will try to find a rule to deal it.
|
40
|
+
|
41
|
+
You can special multiple rules, in follow format:
|
42
|
+
|
43
|
+
use Rack::CGI, match1 => deal1, match2 => deal2, match3 => deal3 ...
|
44
|
+
|
45
|
+
`match` can not Rack::CGI::Executable or Regexp.
|
46
|
+
Rack::CGI::Executable means script file with '+x' property.
|
47
|
+
Regexp will try to match scriptname.
|
48
|
+
|
49
|
+
If none rules match, Rack::CGI will do nothing. Such as if you spacial Rack::CGI::Executable => "",
|
50
|
+
and your file do not have a '+x' property, Rack::CGI will not tell you file cannot executable, but just skiped.
|
51
|
+
|
52
|
+
`deal` can be `nil`, "", `path_to_application`.
|
53
|
+
If you special `nil`, nothing will happened.
|
54
|
+
If you special "", script will be runned directly.
|
55
|
+
If you special `path_to_application`, application will be launched with script name.
|
56
|
+
|
57
|
+
TODO
|
58
|
+
----
|
59
|
+
|
60
|
+
POST Request support
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rack/cgi"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/rack-cgi.gemspec
CHANGED
@@ -1,13 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rack/cgi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rack-cgi"
|
8
|
+
spec.version = Rack::Cgi::VERSION
|
9
|
+
spec.authors = ["Chizhong Jin"]
|
10
|
+
spec.email = ["jinchizhong@kingsoft.com"]
|
11
|
+
|
12
|
+
spec.summary = 'A rack middleware that can call CGI in rack'
|
13
|
+
spec.description = 'A rack middleware that can call CGI in rack'
|
14
|
+
spec.homepage = 'http://rubygems.org/gems/rack-cgi'
|
15
|
+
spec.license = 'BSD'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_runtime_dependency 'rake'
|
31
|
+
spec.add_runtime_dependency 'childprocess'
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
34
|
+
spec.add_development_dependency 'test-unit'
|
35
|
+
spec.add_development_dependency 'rake-test'
|
13
36
|
end
|
metadata
CHANGED
@@ -1,56 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-cgi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Chizhong Jin
|
9
8
|
autorequire:
|
10
|
-
bindir:
|
9
|
+
bindir: exe
|
11
10
|
cert_chain: []
|
12
11
|
date: 2015-05-17 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: childprocess
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
14
83
|
description: A rack middleware that can call CGI in rack
|
15
|
-
email:
|
84
|
+
email:
|
85
|
+
- jinchizhong@kingsoft.com
|
16
86
|
executables: []
|
17
87
|
extensions: []
|
18
88
|
extra_rdoc_files: []
|
19
89
|
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- bin/console
|
95
|
+
- bin/setup
|
20
96
|
- lib/rack-cgi.rb
|
21
97
|
- lib/rack/cgi.rb
|
22
|
-
-
|
23
|
-
- test/cgi/redirect
|
24
|
-
- test/cgi/error
|
25
|
-
- test/cgi/export
|
26
|
-
- test/cgi/test.php
|
27
|
-
- test/cgi/without_header
|
28
|
-
- test/cgi/index.cgi
|
29
|
-
- test/cgi/file
|
98
|
+
- lib/rack/cgi/version.rb
|
30
99
|
- rack-cgi.gemspec
|
31
100
|
homepage: http://rubygems.org/gems/rack-cgi
|
32
101
|
licenses:
|
33
102
|
- BSD
|
103
|
+
metadata:
|
104
|
+
allowed_push_host: https://rubygems.org
|
34
105
|
post_install_message:
|
35
106
|
rdoc_options: []
|
36
107
|
require_paths:
|
37
108
|
- lib
|
38
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
110
|
requirements:
|
41
|
-
- -
|
111
|
+
- - ">="
|
42
112
|
- !ruby/object:Gem::Version
|
43
113
|
version: '0'
|
44
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
115
|
requirements:
|
47
|
-
- -
|
116
|
+
- - ">="
|
48
117
|
- !ruby/object:Gem::Version
|
49
118
|
version: '0'
|
50
119
|
requirements: []
|
51
120
|
rubyforge_project:
|
52
|
-
rubygems_version:
|
121
|
+
rubygems_version: 2.4.6
|
53
122
|
signing_key:
|
54
|
-
specification_version:
|
123
|
+
specification_version: 4
|
55
124
|
summary: A rack middleware that can call CGI in rack
|
56
125
|
test_files: []
|
data/test/cgi/error
DELETED
data/test/cgi/export
DELETED
data/test/cgi/file
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
This is a test file for test
|
data/test/cgi/index.cgi
DELETED
data/test/cgi/redirect
DELETED
data/test/cgi/test.php
DELETED
data/test/cgi/without_header
DELETED
data/test/config.ru
DELETED