runit-man 2.3.4 → 2.3.5

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.
data/lib/runit-man/app.rb CHANGED
@@ -14,10 +14,11 @@ if RUBY_VERSION >= '1.9'
14
14
  Encoding.default_internal = "utf-8"
15
15
  end
16
16
 
17
+ RunitManVersion.sendfile = (Sinatra::VERSION >= '1.3.0')
18
+
17
19
  if Sinatra::VERSION < '1.3.0' && Rack.release >= '1.3'
18
20
  # Monkey patch old Sinatra to use Rack::File to serve files.
19
- $stdout.puts 'Use custom Rack::File send_file'
20
- $stdout.flush
21
+ RunitManVersion.sendfile = true
21
22
 
22
23
  Sinatra::Helpers.class_eval do
23
24
  # Got from Sinatra 1.3.0 sources
@@ -45,6 +46,8 @@ if Sinatra::VERSION < '1.3.0' && Rack.release >= '1.3'
45
46
  end
46
47
  end
47
48
 
49
+ RunitManVersion.sendfile &&= !!File.instance_methods.detect { |m| "#{m}" == 'trysendfile' }
50
+
48
51
  class RunitMan < Sinatra::Base
49
52
  VERSION = RunitManVersion::VERSION
50
53
  MIN_TAIL = 100
@@ -144,6 +147,14 @@ class RunitMan < Sinatra::Base
144
147
  haml :index
145
148
  end
146
149
 
150
+ get '/info' do
151
+ @server = env['SERVER_SOFTWARE']
152
+ @large_files = !!(@server =~ /rainbows/i)
153
+ @rack_version = Rack.release
154
+ @sendfile = RunitManVersion.sendfile && @large_files
155
+ haml :info
156
+ end
157
+
147
158
  get '/services' do
148
159
  partial :services
149
160
  end
@@ -1,4 +1,8 @@
1
1
  module RunitManVersion
2
- VERSION = '2.3.4'.freeze
2
+ VERSION = '2.3.5'.freeze
3
+
4
+ class << self
5
+ attr_accessor :sendfile
6
+ end
3
7
  end
4
8
 
data/views/info.haml ADDED
@@ -0,0 +1,26 @@
1
+ - content_for(:content) do
2
+ %h2
3
+ runit-man v
4
+ %strong= h(RunitMan::VERSION)
5
+ %br/
6
+ %blockquote
7
+ %div
8
+ %br/
9
+ Server:
10
+ = h(@server)
11
+ %div
12
+ Rack:
13
+ = h(@rack_version)
14
+ %br/
15
+ %blockquote
16
+ %div
17
+ %br/
18
+ = @large_files ? 'Does' : 'Doesn\'t'
19
+ support downloading of large files.
20
+ %div
21
+ = @sendfile ? 'Does' : 'Doesn\'t'
22
+ support low CPU usage.
23
+ %br/
24
+ - content_for(:footer) do
25
+ %span
26
+
data/views/layout.haml CHANGED
@@ -13,6 +13,7 @@
13
13
  #header
14
14
  .content
15
15
  %strong= h(t('runit.header', :p1 => host_name, :p2 => t('runit.label')))
16
+ %a{:href=>'/info'} information
16
17
 
17
18
  .content= yield_content :content
18
19
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runit-man
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
- - 4
10
- version: 2.3.4
9
+ - 5
10
+ version: 2.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akzhan Abdulin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-30 00:00:00 +04:00
18
+ date: 2011-06-02 00:00:00 +04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -223,6 +223,7 @@ files:
223
223
  - views/_service_signal.haml
224
224
  - views/_services.haml
225
225
  - views/index.haml
226
+ - views/info.haml
226
227
  - views/layout.haml
227
228
  - views/log.haml
228
229
  - views/log_downloads.haml