rack-cgi 0.4.0 → 0.4.1

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -0
  3. data/lib/rack/cgi/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a23ac17c5c6d553b31d4845dcd426004f8a38217
4
- data.tar.gz: 0cbe4eb000b84c81bcc0c19b82085d4a6d4ba838
3
+ metadata.gz: 68c8f416beeb63d142ee0091fb5672942301ee27
4
+ data.tar.gz: 53b455b7dcb638045c829240941386eb984f8f60
5
5
  SHA512:
6
- metadata.gz: 52fb4c084f8afbd23f7842fb7b4f83620ecb2d4ef6960bedc6e2d88074db715a17c549ab308b01a0896e843e989f05e83db0c7fadb60a302f82d864a2cceffc6
7
- data.tar.gz: 16486670e4b74e6617303a3550fee17223ef909fa93c5862d46fc84849d500269b59f89c8f7d786846dec2ce60f1b416e0b3c00163d0e473556706d8f03f9c26
6
+ metadata.gz: 0bda537112fe3ab5a0c5bc1a448dc878f2c8ea3cd8356f73ccbe31470f8f78376228d773e70e359afa0a7fc70dc306cbd4072a65f7431afae3ef21d810b2fe8b
7
+ data.tar.gz: e73d77341b25009a7dd41e0d67d7b5662a7381a743144200e29e8abc56b479fa2e65fb08be86d15719739a76555d1a0d1826aea3e16b1166511b6737e2988817
data/README.md CHANGED
@@ -64,6 +64,38 @@ You can use following code to open this feature.
64
64
 
65
65
  use Rack::CGI, ..., dir_redirect: true, ...
66
66
 
67
+ ### Use Rack::CGI in Rails project
68
+
69
+ Originally I intended to write a project named rails-cgi.
70
+ But it's so trouble, and run Rack app in rails is not very complex.
71
+ So I give up rails-cgi.
72
+
73
+ 1. Create a cgi controller
74
+
75
+ $ rails g controller cgi
76
+
77
+ 2. Create a Rack Application in CgiController
78
+
79
+ # You can changed arguments as you want
80
+ CGI = Rack::Builder.new do
81
+ use Rack::CGI, cgi_path: 'cgi', index: ['index.cgi', 'index.php'], Rack::CGI::Executable => '', /\.php$/ => '/usr/bin/php-cgi'
82
+ use Rack::Static, urls: ['/'], root: 'cgi'
83
+ run proc{ |env| raise ActionController::RoutingError, env['PATH_INFO'] + " not found!" }
84
+ end
85
+
86
+ 3. Call Rack App in rails controller
87
+
88
+ # add an action to controller
89
+ def cgi
90
+ [self.status, self.response.headers, self.response_body] = CGI.call env
91
+ end
92
+ # of course, you can add decoration code here, such as call rails layout
93
+
94
+ 4. Add route
95
+
96
+ # add follow to config/routes.rb
97
+ get '/cgi-bin/*path' => 'cgi#cgi'
98
+
67
99
  TODO
68
100
  ----
69
101
 
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Cgi
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-cgi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chizhong Jin