oxidized-web 0.9.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oxidized-web might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 082d314e3b82281ec62f6e845e12809801920cfc
4
- data.tar.gz: 5c27d5bdca70bde5ed9cf8a1e26552634ae9978b
2
+ SHA256:
3
+ metadata.gz: 67c5f5f7e9122fd6fba70a0f50e4b822386c8ac209114cf21f987895057c727c
4
+ data.tar.gz: 8eb2e53fc0e064cbe59610540d1914eccd795e93897f998aad3e53b6375824ed
5
5
  SHA512:
6
- metadata.gz: 6722e3424583a8944f70ab7b943f033633d241cc28cccfabd78e44397d6f402055442fe3d8891975d21d9e333ac0b0221a317d24090888ddd5b428a90e305702
7
- data.tar.gz: faa997ec6a000993abaf5a9803f10797459e43878978852862f91f39c4009b05f36edacf2fec73ed6fc884e9802e0d80b48df622ed2ae2c3d8ec76eee9b77352
6
+ metadata.gz: a8f5b6788432058f260019cd3cbb956fe33e06f9063fc849ac712018b81d24b24ebbff907e3bceffa5611b73e7210a46617a1ecbea530cc02040f7844cc9977a
7
+ data.tar.gz: fd4c7132b2e76bb044d0dc3f987b78ca9b392cef81bed6d5a33b9feae1072315fe39813575371d0909a70088e1996b441ebd4fdbbe36b45db0c87a812ac278df
data/.gitignore CHANGED
@@ -9,6 +9,7 @@
9
9
  /test/tmp/
10
10
  /test/version_tmp/
11
11
  /tmp/
12
+ .idea/
12
13
 
13
14
  # Used by dotenv library to load environment variables.
14
15
  # .env
@@ -42,9 +43,9 @@ build-iPhoneSimulator/
42
43
 
43
44
  # for a library or gem, you might want to ignore these files since the code is
44
45
  # intended to run in multiple environments; otherwise, check them in:
45
- # Gemfile.lock
46
- # .ruby-version
47
- # .ruby-gemset
46
+ Gemfile.lock
47
+ .ruby-version
48
+ .ruby-gemset
48
49
 
49
50
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
51
  .rvmrc
data/.rubocop.yml CHANGED
@@ -1,5 +1,36 @@
1
- ---
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ Include:
5
+ - Rakefile
6
+
7
+ StringLiterals:
8
+ Enabled: false
2
9
 
3
10
  LineLength:
4
- # Default line length is silly. 100 is more realistic.
5
- Max: 100
11
+ Enabled: false
12
+
13
+ # Stick to verbose until https://bugs.ruby-lang.org/issues/10177 is closed.
14
+ Style/PreferredHashMethods:
15
+ EnforcedStyle: verbose
16
+
17
+ Style/Not:
18
+ Enabled: false
19
+
20
+ # comply with @ytti's exacting specifications
21
+ Style/CommandLiteral:
22
+ EnforcedStyle: percent_x
23
+
24
+ Style/FormatString:
25
+ EnforcedStyle: percent
26
+
27
+ Style/FormatStringToken:
28
+ EnforcedStyle: unannotated
29
+
30
+ Style/RescueModifier:
31
+ Enabled: false
32
+
33
+ # Do not attempt to police vendored code, and exclude special cases
34
+ AllCops:
35
+ Exclude:
36
+ - 'vendor/**/*'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,264 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-05-03 20:40:31 +0200 using RuboCop version 0.55.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
12
+ # Include: **/*.gemspec
13
+ Gemspec/OrderedDependencies:
14
+ Exclude:
15
+ - 'oxidized-web.gemspec'
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: Include.
19
+ # Include: **/*.gemspec
20
+ Gemspec/RequiredRubyVersion:
21
+ Exclude:
22
+ - 'oxidized-web.gemspec'
23
+
24
+ # Offense count: 2
25
+ # Cop supports --auto-correct.
26
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
27
+ # SupportedStyles: space, no_space, compact
28
+ # SupportedStylesForEmptyBraces: space, no_space
29
+ Layout/SpaceInsideHashLiteralBraces:
30
+ Exclude:
31
+ - 'lib/oxidized/web/webapp.rb'
32
+
33
+ # Offense count: 1
34
+ # Cop supports --auto-correct.
35
+ # Configuration parameters: AllowInHeredoc.
36
+ Layout/TrailingWhitespace:
37
+ Exclude:
38
+ - 'lib/oxidized/web/mig.rb'
39
+
40
+ # Offense count: 1
41
+ Lint/AmbiguousBlockAssociation:
42
+ Exclude:
43
+ - 'lib/oxidized/web/webapp.rb'
44
+
45
+ # Offense count: 1
46
+ # Configuration parameters: AllowSafeAssignment.
47
+ Lint/AssignmentInCondition:
48
+ Exclude:
49
+ - 'lib/oxidized/web/mig.rb'
50
+
51
+ # Offense count: 1
52
+ Lint/HandleExceptions:
53
+ Exclude:
54
+ - 'lib/oxidized/web/webapp.rb'
55
+
56
+ # Offense count: 7
57
+ Metrics/AbcSize:
58
+ Max: 47
59
+
60
+ # Offense count: 2
61
+ # Configuration parameters: CountComments, ExcludedMethods.
62
+ Metrics/BlockLength:
63
+ Max: 33
64
+
65
+ # Offense count: 1
66
+ # Configuration parameters: CountBlocks.
67
+ Metrics/BlockNesting:
68
+ Max: 5
69
+
70
+ # Offense count: 2
71
+ # Configuration parameters: CountComments.
72
+ Metrics/ClassLength:
73
+ Max: 282
74
+
75
+ # Offense count: 2
76
+ Metrics/CyclomaticComplexity:
77
+ Max: 9
78
+
79
+ # Offense count: 9
80
+ # Configuration parameters: CountComments.
81
+ Metrics/MethodLength:
82
+ Max: 36
83
+
84
+ # Offense count: 3
85
+ Metrics/PerceivedComplexity:
86
+ Max: 11
87
+
88
+ # Offense count: 5
89
+ # Cop supports --auto-correct.
90
+ Performance/RedundantMatch:
91
+ Exclude:
92
+ - 'lib/oxidized/web/mig.rb'
93
+ - 'lib/oxidized/web/webapp.rb'
94
+
95
+ # Offense count: 2
96
+ # Cop supports --auto-correct.
97
+ Performance/StringReplacement:
98
+ Exclude:
99
+ - 'lib/oxidized/web/mig.rb'
100
+
101
+ # Offense count: 1
102
+ Security/Eval:
103
+ Exclude:
104
+ - 'Rakefile'
105
+
106
+ # Offense count: 1
107
+ # Cop supports --auto-correct.
108
+ # Configuration parameters: AutoCorrect.
109
+ Security/JSONLoad:
110
+ Exclude:
111
+ - 'lib/oxidized/web/webapp.rb'
112
+
113
+ # Offense count: 2
114
+ # Cop supports --auto-correct.
115
+ # Configuration parameters: EnforcedStyle.
116
+ # SupportedStyles: always, conditionals
117
+ Style/AndOr:
118
+ Exclude:
119
+ - 'lib/oxidized/web/webapp.rb'
120
+
121
+ # Offense count: 2
122
+ # Cop supports --auto-correct.
123
+ # Configuration parameters: EnforcedStyle.
124
+ # SupportedStyles: braces, no_braces, context_dependent
125
+ Style/BracesAroundHashParameters:
126
+ Exclude:
127
+ - 'lib/oxidized/web/webapp.rb'
128
+
129
+ # Offense count: 2
130
+ # Cop supports --auto-correct.
131
+ # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
132
+ # SupportedStyles: assign_to_condition, assign_inside_condition
133
+ Style/ConditionalAssignment:
134
+ Exclude:
135
+ - 'lib/oxidized/web/webapp.rb'
136
+
137
+ # Offense count: 2
138
+ Style/DateTime:
139
+ Exclude:
140
+ - 'lib/oxidized/web/webapp.rb'
141
+
142
+ # Offense count: 3
143
+ Style/Documentation:
144
+ Exclude:
145
+ - 'spec/**/*'
146
+ - 'test/**/*'
147
+ - 'lib/oxidized/web.rb'
148
+ - 'lib/oxidized/web/mig.rb'
149
+ - 'lib/oxidized/web/webapp.rb'
150
+
151
+ # Offense count: 1
152
+ # Cop supports --auto-correct.
153
+ Style/EmptyLiteral:
154
+ Exclude:
155
+ - 'lib/oxidized/web/webapp.rb'
156
+
157
+ # Offense count: 2
158
+ # Configuration parameters: EnforcedStyle.
159
+ # SupportedStyles: each, for
160
+ Style/For:
161
+ Exclude:
162
+ - 'lib/oxidized/web/mig.rb'
163
+ - 'lib/oxidized/web/webapp.rb'
164
+
165
+ # Offense count: 1
166
+ # Cop supports --auto-correct.
167
+ # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
168
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
169
+ Style/HashSyntax:
170
+ Exclude:
171
+ - 'Rakefile'
172
+
173
+ # Offense count: 9
174
+ # Cop supports --auto-correct.
175
+ Style/IfUnlessModifier:
176
+ Exclude:
177
+ - 'lib/oxidized/web/mig.rb'
178
+ - 'lib/oxidized/web/webapp.rb'
179
+
180
+ # Offense count: 10
181
+ # Cop supports --auto-correct.
182
+ # Configuration parameters: EnforcedStyle.
183
+ # SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
184
+ Style/MethodDefParentheses:
185
+ Exclude:
186
+ - 'lib/oxidized/web.rb'
187
+ - 'lib/oxidized/web/mig.rb'
188
+ - 'lib/oxidized/web/webapp.rb'
189
+
190
+ # Offense count: 1
191
+ # Cop supports --auto-correct.
192
+ # Configuration parameters: EnforcedStyle.
193
+ # SupportedStyles: both, prefix, postfix
194
+ Style/NegatedIf:
195
+ Exclude:
196
+ - 'lib/oxidized/web.rb'
197
+
198
+ # Offense count: 4
199
+ # Cop supports --auto-correct.
200
+ # Configuration parameters: EnforcedStyle, MinBodyLength.
201
+ # SupportedStyles: skip_modifier_ifs, always
202
+ Style/Next:
203
+ Exclude:
204
+ - 'lib/oxidized/web/mig.rb'
205
+ - 'lib/oxidized/web/webapp.rb'
206
+
207
+ # Offense count: 1
208
+ # Cop supports --auto-correct.
209
+ # Configuration parameters: IncludeSemanticChanges.
210
+ Style/NonNilCheck:
211
+ Exclude:
212
+ - 'lib/oxidized/web/webapp.rb'
213
+
214
+ # Offense count: 1
215
+ # Cop supports --auto-correct.
216
+ Style/ParallelAssignment:
217
+ Exclude:
218
+ - 'lib/oxidized/web.rb'
219
+
220
+ # Offense count: 1
221
+ # Cop supports --auto-correct.
222
+ Style/Proc:
223
+ Exclude:
224
+ - 'lib/oxidized/web/webapp.rb'
225
+
226
+ # Offense count: 4
227
+ # Cop supports --auto-correct.
228
+ Style/RedundantParentheses:
229
+ Exclude:
230
+ - 'lib/oxidized/web/webapp.rb'
231
+
232
+ # Offense count: 1
233
+ # Cop supports --auto-correct.
234
+ Style/SelfAssignment:
235
+ Exclude:
236
+ - 'lib/oxidized/web/webapp.rb'
237
+
238
+ # Offense count: 1
239
+ # Cop supports --auto-correct.
240
+ # Configuration parameters: EnforcedStyleForMultiline.
241
+ # SupportedStylesForMultiline: comma, consistent_comma, no_comma
242
+ Style/TrailingCommaInHashLiteral:
243
+ Exclude:
244
+ - 'lib/oxidized/web.rb'
245
+
246
+ # Offense count: 1
247
+ # Cop supports --auto-correct.
248
+ Style/WhileUntilDo:
249
+ Exclude:
250
+ - 'lib/oxidized/web/webapp.rb'
251
+
252
+ # Offense count: 1
253
+ # Cop supports --auto-correct.
254
+ # Configuration parameters: WordRegex.
255
+ # SupportedStyles: percent, brackets
256
+ Style/WordArray:
257
+ EnforcedStyle: percent
258
+ MinSize: 3
259
+
260
+ # Offense count: 10
261
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
262
+ # URISchemes: http, https
263
+ Metrics/LineLength:
264
+ Max: 177
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ before_install:
5
+ - gem install bundler
6
+ rvm:
7
+ - 2.1
8
+ - 2.2
9
+ - 2.3
10
+ - 2.4
11
+ - 2.5
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Oxidized Web
1
+ # Oxidized Web [![Build Status](https://travis-ci.com/ytti/oxidized-web.svg)](https://travis-ci.com/ytti/oxidized-web) [![Gem Version](https://badge.fury.io/rb/oxidized-web.svg)](http://badge.fury.io/rb/oxidized-web)
2
2
 
3
3
  Web userinterface and RESTful API for Oxidized.
4
4
 
data/Rakefile CHANGED
@@ -4,6 +4,18 @@ require 'rake/testtask'
4
4
  gemspec = eval(File.read(Dir['*.gemspec'].first))
5
5
  file = [gemspec.name, gemspec.version].join('-') + '.gem'
6
6
 
7
+ # Integrate Rubocop if available
8
+ begin
9
+ require 'rubocop/rake_task'
10
+
11
+ RuboCop::RakeTask.new
12
+ task(:default).prerequisites << task(:rubocop)
13
+ rescue LoadError
14
+ task :rubocop do
15
+ puts 'Install rubocop to run its rake tasks'
16
+ end
17
+ end
18
+
7
19
  desc 'Validate gemspec'
8
20
  task :gemspec do
9
21
  gemspec.validate
data/lib/oxidized/web.rb CHANGED
@@ -25,7 +25,10 @@ module Oxidized
25
25
  end
26
26
 
27
27
  def run
28
- @thread = Thread.new { Rack::Handler::Puma.run @app, @opts }
28
+ @thread = Thread.new do
29
+ Rack::Handler::Puma.run @app, @opts
30
+ exit!
31
+ end
29
32
  end
30
33
  end
31
34
  end
@@ -44,7 +44,7 @@ var convertTime = function() {
44
44
  */
45
45
  $('.time').each(function() {
46
46
  var content = $(this).text();
47
- if(content === 'never' || content === '') { return; }
47
+ if(content === 'never' || content === 'unknown' || content === '') { return; }
48
48
  var utcTime = content.split(' ');
49
49
  var date = new Date(utcTime[0] + 'T' + utcTime[1] + 'Z');
50
50
  var year = date.getFullYear();
@@ -30,6 +30,7 @@
30
30
  $(function() {
31
31
  $('#versionsTable').dataTable({
32
32
  dom: 'C<"clear">lfrtip',
33
+ bAutoWidth: false,
33
34
  "order": [[0, "desc"]]
34
35
  });
35
36
  });
@@ -50,54 +50,44 @@
50
50
  - @diff[:old_diff].each do |line|
51
51
  - if /^\+.*/.match(line)
52
52
  .added><
53
- :escaped
54
- #{line}
53
+ != escape_once("#{line}")
55
54
 
56
55
  - elsif /^\-.*/.match(line)
57
56
  .deleted><
58
- :escaped
59
- #{line}
57
+ != escape_once("#{line}")
60
58
 
61
59
  - elsif /^@@\s.*@@.*$/.match(line)
62
60
  .diff-index><
63
- :escaped
64
- #{line}
61
+ != escape_once("#{line}")
65
62
 
66
63
  - elsif /^empty_line&nbsp;/.match(line)
67
64
  - line.slice! "empty_line"
68
65
  .diff-empty><
69
- :escaped
70
- #{line}
66
+ != escape_once("#{line}")
71
67
 
72
68
  - else
73
69
  %div><
74
- :escaped
75
- #{line}
70
+ != escape_once("#{line}")
76
71
 
77
72
  .diffs_new
78
73
  - @diff[:new_diff].each do |line|
79
74
  - if /^\+.*/.match(line)
80
75
  .added><
81
- :escaped
82
- #{line}
76
+ != escape_once("#{line}")
83
77
 
84
78
  - elsif /^\-.*/.match(line)
85
79
  .deleted><
86
- :escaped
87
- #{line}
80
+ != escape_once("#{line}")
88
81
 
89
82
  - elsif /^@@\s.*@@.*$/.match(line)
90
83
  .diff-index><
91
- :escaped
92
- #{line}
84
+ != escape_once("#{line}")
93
85
 
94
86
  - elsif /^empty_line&nbsp;/.match(line)
95
87
  - line.slice! "empty_line"
96
88
  .diff-empty><
97
- :escaped
98
- #{line}
89
+ != escape_once("#{line}")
99
90
 
100
91
  - else
101
92
  %div><
102
- :escaped
103
- #{line}
93
+ != escape_once("#{line}")
@@ -0,0 +1,4 @@
1
+ %footer
2
+ %hr
3
+ %span
4
+ %p Oxidized v.#{Oxidized::VERSION}
@@ -36,6 +36,7 @@
36
36
 
37
37
  .container-fluid
38
38
  =yield
39
+ !=haml :footer
39
40
  %script{src: url_for('/scripts/bootstrap.min.js')}
40
41
  %script{src: url_for('/scripts/jquery.dataTables.min.js')}
41
42
  %script{src: url_for('/scripts/dataTables.bootstrap.js')}
@@ -22,6 +22,7 @@
22
22
  %th Group
23
23
  %th Last Status
24
24
  %th Last Update
25
+ %th Last Changed
25
26
  %th Actions
26
27
 
27
28
  %tbody
@@ -40,6 +41,7 @@
40
41
  %div{title: node[:status], class: node[:status]}
41
42
  %span{style: 'visibility: hidden'}#{node[:status]}
42
43
  %td.time= node[:time]
44
+ %td.time= node[:mtime]
43
45
  %td
44
46
  %a{title: 'configuration',
45
47
  href: url_for("/node/fetch/#{node[:full_name]}")}
@@ -56,6 +58,7 @@
56
58
  $(function() {
57
59
  $('#nodesTable').dataTable({
58
60
  dom: 'C<"clear">lfrtip',
61
+ bAutoWidth: false,
59
62
  "lengthMenu": [[50, 250, 500, -1], [50, 250, 500, "All"]],
60
63
  columnDefs: [{
61
64
  visible: false,
@@ -65,7 +68,7 @@
65
68
  targets: 3
66
69
  }],
67
70
  colVis: {
68
- exclude: [0, 5]
71
+ exclude: [0, 7]
69
72
  }
70
73
  });
71
74
  });
@@ -28,8 +28,8 @@
28
28
  %tbody
29
29
  - @data.map do |node, stats|
30
30
  - status = 'no_connection'
31
- - successes = 0
32
- - failures = 0
31
+ - successes = stats.successes
32
+ - failures = stats.failures
33
33
  - avg_success_time = 0
34
34
  - avg_failure_time = 0
35
35
  - avg_time = 0
@@ -37,14 +37,12 @@
37
37
 
38
38
  - if stats[:success]
39
39
  - last_success = stats[:success].last[:end]
40
- - successes = stats[:success].length
41
40
  - avg_success_time = stats[:success].collect {|x| x[:time]}
42
41
  - avg_success_time = avg_success_time.inject {|sum, x| sum + x}
43
42
  - avg_success_time /= successes
44
43
 
45
44
  - if stats[:no_connection]
46
45
  - last_failure = stats[:no_connection].last[:end]
47
- - failures = stats[:no_connection].length
48
46
  - avg_failure_time = stats[:no_connection].collect {|x| x[:time]}
49
47
  - avg_failure_time = avg_failure_time.inject {|sum, x| sum + x}
50
48
  - avg_failure_time /= failures
@@ -86,6 +84,7 @@
86
84
  $('#statsTable').dataTable({
87
85
  dom: 'C<"clear">lfrtip',
88
86
  "lengthMenu": [[50, 250, 500, -1], [50, 250, 500, "All"]],
87
+ bAutoWidth: false,
89
88
  columnDefs: [{
90
89
  visible: false,
91
90
  targets: 1
@@ -19,5 +19,4 @@
19
19
  .diffs
20
20
  - @data.each_line do |line|
21
21
  %div><
22
- :escaped
23
- #{line}
22
+ != escape_once("#{line}")
@@ -43,6 +43,7 @@
43
43
  $('#versionsTable').dataTable({
44
44
  dom: 'C<"clear">lfrtip',
45
45
  "order": [[0, "desc"]],
46
+ bAutoWidth: false,
46
47
  columnDefs: [{
47
48
  visible: false,
48
49
  targets: [2, 3]
@@ -6,6 +6,7 @@ require 'sass'
6
6
  require 'pp'
7
7
  require 'oxidized/web/mig'
8
8
  require 'htmlentities'
9
+ require 'charlock_holmes'
9
10
  module Oxidized
10
11
  module API
11
12
  class WebApp < Sinatra::Base
@@ -19,13 +20,18 @@ module Oxidized
19
20
  get '/nodes/:filter/:value.?:format?' do
20
21
  @data = nodes.list.select do |node|
21
22
  if node[params[:filter].to_sym] == params[:value]
23
+ versions = nodes.version node[:name], node[:group]
22
24
  node[:status] = 'never'
23
25
  node[:time] = 'never'
24
- node[:group] = 'default' unless node[:group]
26
+ node[:mtime] = 'unknown'
27
+ node[:group] = 'default' unless node[:group]
25
28
  if node[:last]
26
29
  node[:status] = node[:last][:status]
27
30
  node[:time] = node[:last][:end]
28
31
  end
32
+ if versions.is_a? Array
33
+ node[:mtime] = versions.first[:date]
34
+ end
29
35
  node
30
36
  end
31
37
  end
@@ -34,13 +40,18 @@ module Oxidized
34
40
 
35
41
  get '/nodes.?:format?' do
36
42
  @data = nodes.list.map do |node|
43
+ versions = nodes.version node[:name], node[:group]
37
44
  node[:status] = 'never'
38
45
  node[:time] = 'never'
39
- node[:group] = 'default' unless node[:group]
46
+ node[:mtime] = 'unknown'
47
+ node[:group] = 'default' unless node[:group]
40
48
  if node[:last]
41
49
  node[:status] = node[:last][:status]
42
50
  node[:time] = node[:last][:end]
43
51
  end
52
+ if versions.is_a? Array and (not versions.empty?)
53
+ node[:mtime] = versions.first[:date]
54
+ end
44
55
  node
45
56
  end
46
57
  out :nodes
@@ -175,7 +186,10 @@ module Oxidized
175
186
  num: params[:num]
176
187
  }
177
188
 
178
- @data = HTMLEntities.new.encode(nodes.get_version node, @info[:group], @info[:oid])
189
+ the_data = nodes.get_version node, @info[:group], @info[:oid]
190
+ detection = ::CharlockHolmes::EncodingDetector.detect(the_data)
191
+ utf8_encoded_content = ::CharlockHolmes::Converter.convert the_data, detection[:encoding], 'UTF-8'
192
+ @data = HTMLEntities.new.encode(utf8_encoded_content)
179
193
  out :version
180
194
  end
181
195
 
@@ -285,7 +299,9 @@ module Oxidized
285
299
  old_diff = []
286
300
  new_diff = []
287
301
 
288
- HTMLEntities.new.encode(diff).each_line do |line|
302
+ detection = ::CharlockHolmes::EncodingDetector.detect(diff)
303
+ utf8_encoded_content = ::CharlockHolmes::Converter.convert diff, detection[:encoding], 'UTF-8'
304
+ HTMLEntities.new.encode(utf8_encoded_content).each_line do |line|
289
305
  if /^\+/.match(line)
290
306
  new_diff.push(line)
291
307
  elsif /^\-/.match(line)
data/oxidized-web.gemspec CHANGED
@@ -1,25 +1,32 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'oxidized-web'
3
- s.version = '0.9.3'
4
- s.licenses = %w( Apache-2.0 )
3
+ s.version = '0.10.0'
4
+ s.licenses = %w[Apache-2.0]
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ['Saku Ytti', 'Samer Abdel-Hafez']
7
- s.email = %w(saku@ytti.fi sam@arahant.net)
7
+ s.email = %w[saku@ytti.fi sam@arahant.net]
8
8
  s.homepage = 'http://github.com/ytti/oxidized-web'
9
9
  s.summary = 'sinatra API + webUI for oxidized'
10
10
  s.description = 'puma+sinatra+haml webUI + REST API for oxidized'
11
11
  s.rubyforge_project = s.name
12
- s.files = `git ls-files`.split("\n")
13
- s.executables = %w( )
12
+ s.files = %x(git ls-files).split("\n")
13
+ s.executables = %w[]
14
14
  s.require_path = 'lib'
15
15
 
16
- s.required_ruby_version = '>= 1.9.3'
16
+ s.required_ruby_version = '>= 2.0.0'
17
+ s.add_runtime_dependency 'charlock_holmes', '~> 0.7.5'
18
+ s.add_runtime_dependency 'emk-sinatra-url-for', '~> 0.2'
19
+ s.add_runtime_dependency 'haml', '~> 5.0'
20
+ s.add_runtime_dependency 'htmlentities', '~> 4.3'
17
21
  s.add_runtime_dependency 'oxidized', '~> 0.21.0'
18
22
  s.add_runtime_dependency 'puma', '~> 3'
23
+ s.add_runtime_dependency 'sass', '~> 3.3'
19
24
  s.add_runtime_dependency 'sinatra', '~> 1.4', '>= 1.4.6'
20
25
  s.add_runtime_dependency 'sinatra-contrib', '~> 1.4', '>= 1.4.6'
21
- s.add_runtime_dependency 'haml', '~> 4.0'
22
- s.add_runtime_dependency 'sass', '~> 3.3'
23
- s.add_runtime_dependency 'emk-sinatra-url-for', '~> 0.2'
24
- s.add_runtime_dependency 'htmlentities', '~> 4.3'
26
+ s.add_runtime_dependency 'json', '>= 1.7.0'
27
+ s.add_runtime_dependency 'rack-test', '~> 0.7.0'
28
+
29
+ s.add_development_dependency 'rails_best_practices', '~> 1.19'
30
+ s.add_development_dependency 'rake', '~> 10.0'
31
+ s.add_development_dependency 'rubocop', '~> 0.55.0'
25
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxidized-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
@@ -9,132 +9,216 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-01 00:00:00.000000000 Z
12
+ date: 2018-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: charlock_holmes
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.7.5
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.7.5
28
+ - !ruby/object:Gem::Dependency
29
+ name: emk-sinatra-url-for
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '0.2'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.2'
42
+ - !ruby/object:Gem::Dependency
43
+ name: haml
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '5.0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '5.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: htmlentities
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '4.3'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '4.3'
14
70
  - !ruby/object:Gem::Dependency
15
71
  name: oxidized
16
72
  requirement: !ruby/object:Gem::Requirement
17
73
  requirements:
18
- - - ~>
74
+ - - "~>"
19
75
  - !ruby/object:Gem::Version
20
76
  version: 0.21.0
21
77
  type: :runtime
22
78
  prerelease: false
23
79
  version_requirements: !ruby/object:Gem::Requirement
24
80
  requirements:
25
- - - ~>
81
+ - - "~>"
26
82
  - !ruby/object:Gem::Version
27
83
  version: 0.21.0
28
84
  - !ruby/object:Gem::Dependency
29
85
  name: puma
30
86
  requirement: !ruby/object:Gem::Requirement
31
87
  requirements:
32
- - - ~>
88
+ - - "~>"
33
89
  - !ruby/object:Gem::Version
34
90
  version: '3'
35
91
  type: :runtime
36
92
  prerelease: false
37
93
  version_requirements: !ruby/object:Gem::Requirement
38
94
  requirements:
39
- - - ~>
95
+ - - "~>"
40
96
  - !ruby/object:Gem::Version
41
97
  version: '3'
98
+ - !ruby/object:Gem::Dependency
99
+ name: sass
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '3.3'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '3.3'
42
112
  - !ruby/object:Gem::Dependency
43
113
  name: sinatra
44
114
  requirement: !ruby/object:Gem::Requirement
45
115
  requirements:
46
- - - ~>
116
+ - - "~>"
47
117
  - !ruby/object:Gem::Version
48
118
  version: '1.4'
49
- - - '>='
119
+ - - ">="
50
120
  - !ruby/object:Gem::Version
51
121
  version: 1.4.6
52
122
  type: :runtime
53
123
  prerelease: false
54
124
  version_requirements: !ruby/object:Gem::Requirement
55
125
  requirements:
56
- - - ~>
126
+ - - "~>"
57
127
  - !ruby/object:Gem::Version
58
128
  version: '1.4'
59
- - - '>='
129
+ - - ">="
60
130
  - !ruby/object:Gem::Version
61
131
  version: 1.4.6
62
132
  - !ruby/object:Gem::Dependency
63
133
  name: sinatra-contrib
64
134
  requirement: !ruby/object:Gem::Requirement
65
135
  requirements:
66
- - - ~>
136
+ - - "~>"
67
137
  - !ruby/object:Gem::Version
68
138
  version: '1.4'
69
- - - '>='
139
+ - - ">="
70
140
  - !ruby/object:Gem::Version
71
141
  version: 1.4.6
72
142
  type: :runtime
73
143
  prerelease: false
74
144
  version_requirements: !ruby/object:Gem::Requirement
75
145
  requirements:
76
- - - ~>
146
+ - - "~>"
77
147
  - !ruby/object:Gem::Version
78
148
  version: '1.4'
79
- - - '>='
149
+ - - ">="
80
150
  - !ruby/object:Gem::Version
81
151
  version: 1.4.6
82
152
  - !ruby/object:Gem::Dependency
83
- name: haml
153
+ name: json
84
154
  requirement: !ruby/object:Gem::Requirement
85
155
  requirements:
86
- - - ~>
156
+ - - ">="
87
157
  - !ruby/object:Gem::Version
88
- version: '4.0'
158
+ version: 1.7.0
89
159
  type: :runtime
90
160
  prerelease: false
91
161
  version_requirements: !ruby/object:Gem::Requirement
92
162
  requirements:
93
- - - ~>
163
+ - - ">="
94
164
  - !ruby/object:Gem::Version
95
- version: '4.0'
165
+ version: 1.7.0
96
166
  - !ruby/object:Gem::Dependency
97
- name: sass
167
+ name: rack-test
98
168
  requirement: !ruby/object:Gem::Requirement
99
169
  requirements:
100
- - - ~>
170
+ - - "~>"
101
171
  - !ruby/object:Gem::Version
102
- version: '3.3'
172
+ version: 0.7.0
103
173
  type: :runtime
104
174
  prerelease: false
105
175
  version_requirements: !ruby/object:Gem::Requirement
106
176
  requirements:
107
- - - ~>
177
+ - - "~>"
108
178
  - !ruby/object:Gem::Version
109
- version: '3.3'
179
+ version: 0.7.0
110
180
  - !ruby/object:Gem::Dependency
111
- name: emk-sinatra-url-for
181
+ name: rails_best_practices
112
182
  requirement: !ruby/object:Gem::Requirement
113
183
  requirements:
114
- - - ~>
184
+ - - "~>"
115
185
  - !ruby/object:Gem::Version
116
- version: '0.2'
117
- type: :runtime
186
+ version: '1.19'
187
+ type: :development
118
188
  prerelease: false
119
189
  version_requirements: !ruby/object:Gem::Requirement
120
190
  requirements:
121
- - - ~>
191
+ - - "~>"
122
192
  - !ruby/object:Gem::Version
123
- version: '0.2'
193
+ version: '1.19'
124
194
  - !ruby/object:Gem::Dependency
125
- name: htmlentities
195
+ name: rake
126
196
  requirement: !ruby/object:Gem::Requirement
127
197
  requirements:
128
- - - ~>
198
+ - - "~>"
129
199
  - !ruby/object:Gem::Version
130
- version: '4.3'
131
- type: :runtime
200
+ version: '10.0'
201
+ type: :development
132
202
  prerelease: false
133
203
  version_requirements: !ruby/object:Gem::Requirement
134
204
  requirements:
135
- - - ~>
205
+ - - "~>"
136
206
  - !ruby/object:Gem::Version
137
- version: '4.3'
207
+ version: '10.0'
208
+ - !ruby/object:Gem::Dependency
209
+ name: rubocop
210
+ requirement: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: 0.55.0
215
+ type: :development
216
+ prerelease: false
217
+ version_requirements: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "~>"
220
+ - !ruby/object:Gem::Version
221
+ version: 0.55.0
138
222
  description: puma+sinatra+haml webUI + REST API for oxidized
139
223
  email:
140
224
  - saku@ytti.fi
@@ -143,9 +227,11 @@ executables: []
143
227
  extensions: []
144
228
  extra_rdoc_files: []
145
229
  files:
146
- - .codeclimate.yml
147
- - .gitignore
148
- - .rubocop.yml
230
+ - ".codeclimate.yml"
231
+ - ".gitignore"
232
+ - ".rubocop.yml"
233
+ - ".rubocop_todo.yml"
234
+ - ".travis.yml"
149
235
  - Gemfile
150
236
  - README.md
151
237
  - Rakefile
@@ -180,6 +266,7 @@ files:
180
266
  - lib/oxidized/web/public/scripts/script-migration.js
181
267
  - lib/oxidized/web/views/conf_search.haml
182
268
  - lib/oxidized/web/views/diffs.haml
269
+ - lib/oxidized/web/views/footer.haml
183
270
  - lib/oxidized/web/views/head.haml
184
271
  - lib/oxidized/web/views/layout.haml
185
272
  - lib/oxidized/web/views/migration.haml
@@ -201,17 +288,17 @@ require_paths:
201
288
  - lib
202
289
  required_ruby_version: !ruby/object:Gem::Requirement
203
290
  requirements:
204
- - - '>='
291
+ - - ">="
205
292
  - !ruby/object:Gem::Version
206
- version: 1.9.3
293
+ version: 2.0.0
207
294
  required_rubygems_version: !ruby/object:Gem::Requirement
208
295
  requirements:
209
- - - '>='
296
+ - - ">="
210
297
  - !ruby/object:Gem::Version
211
298
  version: '0'
212
299
  requirements: []
213
300
  rubyforge_project: oxidized-web
214
- rubygems_version: 2.0.14.1
301
+ rubygems_version: 2.7.6
215
302
  signing_key:
216
303
  specification_version: 4
217
304
  summary: sinatra API + webUI for oxidized