hud 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hud/version.rb +1 -1
- data/lib/hud.rb +35 -29
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd14aa710d44347443dcb1e30575b50c873a22d051f20281bb5d1aa33b00fb82
|
4
|
+
data.tar.gz: e6af8ae9a8703fa028f88b1d2d379080abec3864eec58fa9244fc5ac3f28f071
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f05b56d9e6d079724b108fd6f060268c220333c5cb90c6ca8249cd5bf3b77037be0c23e6b288fb77ddb4cc0e5d9f2d9e890c29393e256e26fea23a07de687862
|
7
|
+
data.tar.gz: 6b260356cd613124088dbc77ea4dd0ff5ad9944862e5324a4ceb4b865eefc0098d97dbe4902d3623a599f5b256123b866afb0922dd4144caebb3210c5fe8411b
|
data/lib/hud/version.rb
CHANGED
data/lib/hud.rb
CHANGED
@@ -17,31 +17,34 @@ module Hud
|
|
17
17
|
configuration.components_dirs = []
|
18
18
|
yield(configuration)
|
19
19
|
end
|
20
|
-
|
20
|
+
module Middleware
|
21
21
|
|
22
22
|
def self.included(base)
|
23
23
|
base.use Middleware::Version
|
24
24
|
#base.use Middleware::Environment
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
class Version
|
28
28
|
def initialize(app)
|
29
29
|
@app = app
|
30
30
|
manifest_path = File.join('config', 'manifest.yml')
|
31
31
|
@version = YAML.load_file(manifest_path)['version']
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def call(env)
|
35
35
|
status, headers, response = @app.call(env)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
36
|
+
|
37
|
+
|
38
|
+
if ENV['HUD_SHOW_VERSION']
|
39
|
+
response_body = ''
|
40
|
+
response.each { |part| response_body << part }
|
41
|
+
version_div = "<div style='position:fixed; bottom:0; right:0; z-index:9999; background-color:rgba(255, 255, 255, 0.7); padding:5px;'>Version: #{@version}</div>"
|
42
|
+
response_body.sub!("</body>", "#{version_div}</body>")
|
43
|
+
headers["Content-Length"] = response_body.bytesize.to_s
|
44
|
+
|
45
|
+
response = [response_body]
|
46
|
+
end
|
47
|
+
|
45
48
|
[status, headers, response]
|
46
49
|
end
|
47
50
|
end
|
@@ -49,29 +52,32 @@ module Hud
|
|
49
52
|
def initialize(app)
|
50
53
|
@app = app
|
51
54
|
end
|
52
|
-
|
55
|
+
|
53
56
|
def call(env)
|
54
57
|
status, headers, response = @app.call(env)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
|
59
|
+
|
60
|
+
if ENV['HUD_SHOW_ENVIROMENT']
|
61
|
+
color = 'green'
|
62
|
+
color = 'orange' if ENV['HUD_ENV'] == "next"
|
63
|
+
color = 'red' if ENV['HUD_ENV'] == "live"
|
64
|
+
|
65
|
+
response_body = ''
|
66
|
+
response.each { |part| response_body << part }
|
67
|
+
indicator_div = "<div style='position:fixed; top:0; z-index:9999; height:30px; width:100%; background-color:#{color}; z-index:9999;'>#{ENV['HARBR_ENV']&.upcase} ENVIRONMENT</div>"
|
68
|
+
response_body.sub!("<body>", "<body>#{indicator_div}")
|
69
|
+
headers["Content-Length"] = response_body.bytesize.to_s
|
70
|
+
end
|
71
|
+
|
66
72
|
response = [response_body]
|
67
|
-
|
68
|
-
|
73
|
+
|
74
|
+
|
69
75
|
[status, headers, response]
|
70
76
|
end
|
71
77
|
end
|
72
78
|
|
73
79
|
end
|
74
|
-
|
80
|
+
|
75
81
|
|
76
82
|
class Display
|
77
83
|
module Helpers
|
@@ -154,14 +160,14 @@ module Hud
|
|
154
160
|
class Screen < Rack::App
|
155
161
|
include Hud::Middleware
|
156
162
|
include Hud::Display::Helpers
|
157
|
-
|
163
|
+
|
158
164
|
apply_extensions :logger
|
159
165
|
apply_extensions :front_end
|
160
166
|
|
161
167
|
helpers do
|
162
168
|
include Hud::Display::Helpers
|
163
169
|
end
|
164
|
-
|
170
|
+
|
165
171
|
end
|
166
172
|
|
167
173
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delaney Kuldvee Burke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|