kibana-sinatra 3.1.0.0 → 3.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/kibana/sinatra/version.rb +1 -1
- data/lib/kibana/sinatra/web.rb +4 -0
- data/lib/kibana/views/config.erb +1 -1
- data/lib/tasks/update.rb +1 -0
- data/test/sinatra_test.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1e05bf726539ac6f753a4f87fcfac3437365c8c
|
4
|
+
data.tar.gz: b13d42d8c9a2bc96f3724b6146ec8aa446d96684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b6cb7c1cc7db01d55c8b7b3c84a73d699c3ca9726ed42532fd5c8be566fd486536623b2dde6295ef9a7efffeda664972363b02a4fccdad741a447a4fb28b6f1
|
7
|
+
data.tar.gz: 0d74a6de030ef1386d4e9d3622a08aa4ff00f0acb94632a2bc17f8b752570e646bd58da842cddb562382ed3766148dc77c2127cfb9b0d602132c267295dbe462
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
First you will need to configure Kibana's config.js file so that a web browser can find your [elasticsearch](http://www.elasticsearch.org/) cluster.
|
28
28
|
|
29
|
-
Create a new file in `config/initializers` and include the following code. Replace the strings with the location of your elasticsearch cluster and the kibana index. Note that
|
29
|
+
Create a new file in `config/initializers` and include the following code. Replace the strings with the location of your elasticsearch cluster and the kibana index. You may also set the default_route. Note that all of these are optional. Please refer to the [Kibana config file](https://github.com/elasticsearch/kibana/blob/master/src/config.js) for explanations of what these settings do.
|
30
30
|
|
31
31
|
```ruby
|
32
32
|
module Kibana::Sinatra
|
@@ -38,6 +38,10 @@ module Kibana::Sinatra
|
|
38
38
|
def kibana_index
|
39
39
|
"kibana-int"
|
40
40
|
end
|
41
|
+
|
42
|
+
def default_route
|
43
|
+
"/dashboard/elasticsearch/asdf"
|
44
|
+
end
|
41
45
|
end
|
42
46
|
end
|
43
47
|
```
|
data/lib/kibana/sinatra/web.rb
CHANGED
data/lib/kibana/views/config.erb
CHANGED
data/lib/tasks/update.rb
CHANGED
@@ -39,6 +39,7 @@ task :update do
|
|
39
39
|
text = File.read(config_file)
|
40
40
|
text.gsub!('http://"+window.location.hostname+":9200', '<%= elasticsearch_url %>')
|
41
41
|
text.gsub!('"kibana-int"', '"<%= kibana_index %>"')
|
42
|
+
text.gsub!('\'/dashboard/file/default.json\'', '\'<%= default_route %>\'')
|
42
43
|
File.open(config_file, "w") {|file| file.write(text) }
|
43
44
|
end
|
44
45
|
|
data/test/sinatra_test.rb
CHANGED
@@ -23,6 +23,12 @@ class SinatraTest < Minitest::Unit::TestCase
|
|
23
23
|
assert last_response.body.include?('elasticsearch: "http://"+window.location.hostname+":9200"')
|
24
24
|
end
|
25
25
|
|
26
|
+
def test_it_renders_config_with_default_default_route
|
27
|
+
get '/config.js'
|
28
|
+
assert last_response.ok?
|
29
|
+
assert last_response.body.include?('default_route : \'/dashboard/file/default.json\'')
|
30
|
+
end
|
31
|
+
|
26
32
|
def test_it_renders_config_with_custom_elasticsearch_url
|
27
33
|
elasticsearch_url = Proc.new { "http://asdf.com:9200" }
|
28
34
|
|
@@ -49,6 +55,16 @@ class SinatraTest < Minitest::Unit::TestCase
|
|
49
55
|
end
|
50
56
|
end
|
51
57
|
|
58
|
+
def test_it_renders_config_with_custom_default_route
|
59
|
+
default_route = Proc.new { "asdf" }
|
60
|
+
|
61
|
+
monkey_patch "default_route", default_route do
|
62
|
+
get '/config.js'
|
63
|
+
assert last_response.ok?
|
64
|
+
assert last_response.body.include?('default_route : \'asdf\'')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
52
68
|
def monkey_patch(method_name, method_replacement)
|
53
69
|
Kibana::Sinatra::Web.class_eval do
|
54
70
|
alias_method "old_#{method_name}", method_name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kibana-sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.
|
4
|
+
version: 3.1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Neubert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|