rack-process-name 0.0.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. data/LICENSE +24 -0
  2. data/README.md +29 -0
  3. data/lib/rack-process-name.rb +23 -0
  4. metadata +84 -0
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <http://unlicense.org/>
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ Rack::ProcessName
2
+ =================
3
+
4
+ Set the process name to what request is currently being processed. If you're
5
+ lucky and your OS shows process name changes, you'll see something like:
6
+
7
+ 15696 ttys001 0:07.04 script/rails S GET http://localhost:3000/servers/localhost/edit
8
+
9
+ The letter before the request method means:
10
+
11
+ * R - running
12
+ * S - sleeping (last response was ok)
13
+ * E - error (last response raised an exception)
14
+
15
+ Installation
16
+ ============
17
+
18
+ In Rails, add to your Gemfile:
19
+
20
+ gem 'rack-process-name'
21
+
22
+ then in application.rb or in one of config/environments/*.rb:
23
+
24
+ config.middleware.use Rack::ProcessName
25
+
26
+ If using config.ru:
27
+
28
+ require 'rack-process-name'
29
+ use Rack::ProcessName
@@ -0,0 +1,23 @@
1
+ module Rack
2
+ class ProcessName
3
+ def initialize(app)
4
+ @app = app
5
+ @name = $0
6
+ end
7
+
8
+ def call(env)
9
+ req = Rack::Request.new(env)
10
+ info = "#{req.request_method} #{req.url}"
11
+
12
+ set(info, "R")
13
+ @app.call(env).tap { set(info, "S") }
14
+ rescue
15
+ set(info, "E")
16
+ raise
17
+ end
18
+
19
+ def set(info, state = nil)
20
+ $0 = "#{@name} #{state} #{info}"
21
+ end
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-process-name
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Visnu Pitiyanuvath
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-04 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rack
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 59
30
+ segments:
31
+ - 0
32
+ - 9
33
+ - 0
34
+ version: 0.9.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Rack::ProcessName is rack middleware to set the ruby process name to whatever request is currently being processed.
38
+ email: visnupx@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - README.md
45
+ files:
46
+ - README.md
47
+ - LICENSE
48
+ - lib/rack-process-name.rb
49
+ has_rdoc: true
50
+ homepage: https://github.com/visnup/rack-process-name
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project:
79
+ rubygems_version: 1.5.2
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Rack::ProcessName is rack middleware to set the ruby process name to whatever request is currently being processed.
83
+ test_files: []
84
+