rack-serverinfo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/rack/serverinfo.rb +63 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: da4fd66d1db6a443fc758b6e8ec0f47de1d25eb8
|
4
|
+
data.tar.gz: 284e1f1e04f22c10f8e475f72ebfd01939f73b38
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 296105ccf7d901336b6d2bdc07821c772d15ef13dae25b71f487f116af536ddb9e36e430982c9926976086b270930bfaf7fba5ab7e1ad0ba8c5b285adf65bb91
|
7
|
+
data.tar.gz: 3bd4f023a7651d116d1663cad9ba91b4df163fa9ecde661ca03836511f83c46f80499fbaae9cbab5b473f148b4247798caf35c22cb0082ab1a538b59001666d7
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'rack-plastic'
|
2
|
+
require 'etc'
|
3
|
+
|
4
|
+
module Rack
|
5
|
+
|
6
|
+
class Serverinfo < Plastic
|
7
|
+
|
8
|
+
def change_nokogiri_doc(doc)
|
9
|
+
badge = doc.create_element 'div', style: style
|
10
|
+
|
11
|
+
server_info_text.each do |info|
|
12
|
+
badge.add_child(doc.create_element('p', info, style: 'margin: 0'))
|
13
|
+
end
|
14
|
+
|
15
|
+
append_to_body(doc, badge)
|
16
|
+
|
17
|
+
doc
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def server_info_text
|
23
|
+
@server_info_text ||= [
|
24
|
+
"Hostname: #{hostname}",
|
25
|
+
"User: #{user}",
|
26
|
+
"Rails-Env: #{rails_env}",
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
def style
|
31
|
+
@style ||= [
|
32
|
+
'position: absolute;',
|
33
|
+
'bottom: 10px;',
|
34
|
+
'right: 10px;',
|
35
|
+
'border: 4px solid red;',
|
36
|
+
'padding: 5px;',
|
37
|
+
'border-radius: 5px;',
|
38
|
+
'background-color: black;',
|
39
|
+
'opacity: 0.5;',
|
40
|
+
'color: white;',
|
41
|
+
'font-size: 10px;',
|
42
|
+
].join
|
43
|
+
end
|
44
|
+
|
45
|
+
def user
|
46
|
+
@user ||= Etc.getlogin
|
47
|
+
end
|
48
|
+
|
49
|
+
def rails_env
|
50
|
+
@rails_env ||= ENV['RAILS_ENV']
|
51
|
+
end
|
52
|
+
|
53
|
+
def hostname
|
54
|
+
@hostname ||= Socket.gethostname
|
55
|
+
end
|
56
|
+
|
57
|
+
def append_to_body(doc, node)
|
58
|
+
doc.at_css('body').add_next_sibling(node)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack-serverinfo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roman Simecek
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rack-plastic
|
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: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Display in a div the hostname, running user, rails env.
|
56
|
+
email:
|
57
|
+
- roman@good2go.ch
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/rack/serverinfo.rb
|
63
|
+
homepage: ''
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.2.2
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Show information of the app.
|
87
|
+
test_files: []
|
88
|
+
has_rdoc:
|