runit-man 1.9.4 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/runit-man/app.rb CHANGED
@@ -1,9 +1,8 @@
1
- require 'ftools'
1
+ require 'fileutils'
2
2
  require 'yajl/json_gem'
3
3
  require 'erubis'
4
4
  require 'sinatra/base'
5
5
  require 'sinatra/r18n'
6
- require 'runit-man/erb-to-erubis'
7
6
  require 'runit-man/helpers'
8
7
 
9
8
  MIN_TAIL = 100
@@ -43,7 +42,7 @@ class RunitMan < Sinatra::Base
43
42
  get '/' do
44
43
  @scripts = [ 'jquery-1.4.4.min' ]
45
44
  @title = host_name
46
- erb :index
45
+ erubis :index
47
46
  end
48
47
 
49
48
  get '/services' do
@@ -73,7 +72,7 @@ class RunitMan < Sinatra::Base
73
72
  return not_found if data.nil?
74
73
  @scripts = []
75
74
  @title = t.runit.services.log.title(h(name), h(host_name), h(count), h(data[:log_location]))
76
- erb :log, :locals => data
75
+ erubis :log, :locals => data
77
76
  end
78
77
 
79
78
  get %r[^/([^/]+)/log(?:/(\d+))?\.txt$] do |name, count|
@@ -102,7 +101,7 @@ class RunitMan < Sinatra::Base
102
101
  @scripts = []
103
102
  @title = t.runit.view_file.title(h(data[:name]), h(host_name))
104
103
  content_type CONTENT_TYPES[:html], :charset => 'utf-8'
105
- erb :view_file, :locals => data
104
+ erubis :view_file, :locals => data
106
105
  end
107
106
 
108
107
  get '/view.txt' do
@@ -147,8 +146,8 @@ class RunitMan < Sinatra::Base
147
146
  File.unlink(all_r_dir)
148
147
  end
149
148
  unless File.directory?(all_r_dir)
150
- File.makedirs(log_dir)
151
- File.copy(File.join(my_dir, 'log', 'run'), File.join(log_dir, 'run'))
149
+ FileUtils.mkdir_p(log_dir)
150
+ FileUtils.cp(File.join(my_dir, 'log', 'run'), File.join(log_dir, 'run'))
152
151
  end
153
152
  create_run_script(all_r_dir)
154
153
  unless File.symlink?(active_r_dir)
@@ -1,12 +1,12 @@
1
1
  require 'socket'
2
2
  require 'runit-man/service_info'
3
3
  require 'runit-man/partials'
4
- require 'sinatra/content_for'
4
+ require 'sinatra/content_for2'
5
5
 
6
6
  module Helpers
7
7
  include Rack::Utils
8
8
  include Sinatra::Partials
9
- include Sinatra::ContentFor
9
+ include Sinatra::ContentFor2
10
10
  alias_method :h, :escape_html
11
11
 
12
12
  attr_accessor :even_or_odd_state
@@ -1,20 +1,18 @@
1
- # stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
2
- # and made a lot more robust by me
3
- # this implementation uses erb by default. if you want to use any other template mechanism
4
- # then replace `erb` on line 13 and line 17 with `haml` or whatever
5
- module Sinatra::Partials
6
- def partial(template, *args)
7
- template_array = template.to_s.split('/')
8
- template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
9
- options = args.last.is_a?(Hash) ? args.pop : {}
10
- options.merge!(:layout => false)
11
- if collection = options.delete(:collection) then
12
- collection.inject([]) do |buffer, member|
13
- buffer << erb(:"#{template}", options.merge(:layout =>
14
- false, :locals => {template_array[-1].to_sym => member}))
15
- end.join("\n")
16
- else
17
- erb(:"#{template}", options)
18
- end
19
- end
20
- end
1
+ # stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
2
+ # and made a lot more robust by me
3
+ module Sinatra::Partials
4
+ def partial(template, *args)
5
+ template_array = template.to_s.split('/')
6
+ template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
7
+ options = args.last.is_a?(Hash) ? args.pop : {}
8
+ options.merge!(:layout => false)
9
+ if collection = options.delete(:collection) then
10
+ collection.inject([]) do |buffer, member|
11
+ buffer << erubis(:"#{template}", options.merge(:layout =>
12
+ false, :locals => {template_array[-1].to_sym => member}))
13
+ end.join("\n")
14
+ else
15
+ erubis(:"#{template}", options)
16
+ end
17
+ end
18
+ end
File without changes
File without changes
File without changes
@@ -16,12 +16,12 @@
16
16
  </div>
17
17
 
18
18
  <div class="content">
19
- <% yield_content :content %>
19
+ <%= yield_content :content %>
20
20
  </div>
21
21
 
22
22
  <div id="footer">
23
23
  <div class="content">
24
- <% yield_content :footer %>
24
+ <%= yield_content :footer %>
25
25
  </div>
26
26
  </div>
27
27
 
File without changes
File without changes
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runit-man
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 9
9
- - 4
10
- version: 1.9.4
8
+ - 5
9
+ version: 1.9.5
11
10
  platform: ruby
12
11
  authors:
13
12
  - Akzhan Abdulin
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 3
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
@@ -40,7 +38,6 @@ dependencies:
40
38
  requirements:
41
39
  - - ">="
42
40
  - !ruby/object:Gem::Version
43
- hash: 3
44
41
  segments:
45
42
  - 0
46
43
  version: "0"
@@ -54,21 +51,20 @@ dependencies:
54
51
  requirements:
55
52
  - - ">="
56
53
  - !ruby/object:Gem::Version
57
- hash: 3
58
54
  segments:
59
- - 0
60
- version: "0"
55
+ - 1
56
+ - 1
57
+ version: "1.1"
61
58
  type: :runtime
62
59
  version_requirements: *id003
63
60
  - !ruby/object:Gem::Dependency
64
- name: sinatra-content-for
61
+ name: sinatra-content-for2
65
62
  prerelease: false
66
63
  requirement: &id004 !ruby/object:Gem::Requirement
67
64
  none: false
68
65
  requirements:
69
66
  - - ">="
70
67
  - !ruby/object:Gem::Version
71
- hash: 3
72
68
  segments:
73
69
  - 0
74
70
  version: "0"
@@ -82,7 +78,6 @@ dependencies:
82
78
  requirements:
83
79
  - - ">="
84
80
  - !ruby/object:Gem::Version
85
- hash: 11
86
81
  segments:
87
82
  - 0
88
83
  - 4
@@ -98,7 +93,6 @@ dependencies:
98
93
  requirements:
99
94
  - - ">="
100
95
  - !ruby/object:Gem::Version
101
- hash: 3
102
96
  segments:
103
97
  - 0
104
98
  version: "0"
@@ -112,7 +106,6 @@ dependencies:
112
106
  requirements:
113
107
  - - ">="
114
108
  - !ruby/object:Gem::Version
115
- hash: 3
116
109
  segments:
117
110
  - 0
118
111
  version: "0"
@@ -126,7 +119,6 @@ dependencies:
126
119
  requirements:
127
120
  - - ">="
128
121
  - !ruby/object:Gem::Version
129
- hash: 3
130
122
  segments:
131
123
  - 0
132
124
  version: "0"
@@ -140,7 +132,6 @@ dependencies:
140
132
  requirements:
141
133
  - - ">="
142
134
  - !ruby/object:Gem::Version
143
- hash: 3
144
135
  segments:
145
136
  - 0
146
137
  version: "0"
@@ -163,7 +154,6 @@ extra_rdoc_files: []
163
154
  files:
164
155
  - bin/runit-man
165
156
  - lib/runit-man/app.rb
166
- - lib/runit-man/erb-to-erubis.rb
167
157
  - lib/runit-man/helpers.rb
168
158
  - lib/runit-man/log_location_cache.rb
169
159
  - lib/runit-man/partials.rb
@@ -177,14 +167,14 @@ files:
177
167
  - public/css/tripoli.visual.css
178
168
  - public/js/jquery-1.4.4.min.js
179
169
  - public/js/runit-man.js
180
- - views/_service_action.erb
181
- - views/_service_info.erb
182
- - views/_service_signal.erb
183
- - views/_services.erb
184
- - views/index.erb
185
- - views/layout.erb
186
- - views/log.erb
187
- - views/view_file.erb
170
+ - views/_service_action.erubis
171
+ - views/_service_info.erubis
172
+ - views/_service_signal.erubis
173
+ - views/_services.erubis
174
+ - views/index.erubis
175
+ - views/layout.erubis
176
+ - views/log.erubis
177
+ - views/view_file.erubis
188
178
  - i18n/en.yml
189
179
  - i18n/ru.yml
190
180
  - sv/log/run
@@ -203,7 +193,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
193
  requirements:
204
194
  - - ">="
205
195
  - !ruby/object:Gem::Version
206
- hash: 3
207
196
  segments:
208
197
  - 0
209
198
  version: "0"
@@ -212,7 +201,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
201
  requirements:
213
202
  - - ">="
214
203
  - !ruby/object:Gem::Version
215
- hash: 3
216
204
  segments:
217
205
  - 0
218
206
  version: "0"
@@ -1,17 +0,0 @@
1
- module Sinatra::Erb
2
- def erb(content, options={})
3
- begin
4
- require 'erubis'
5
- @@erb_class = Erubis::Eruby
6
- rescue LoadError
7
- require "erb"
8
- @@erb_class = ::ERB
9
- end
10
- render(:erb, content, options)
11
- end
12
-
13
- private
14
- def render_erb(content, options = {})
15
- @@erb_class.new(content).result(binding)
16
- end
17
- end