ruby-grafana-reporter 0.1.6 → 0.1.7

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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +0 -0
  3. data/README.md +200 -109
  4. data/bin/ruby-grafana-reporter +4 -0
  5. data/lib/VERSION.rb +2 -2
  6. data/lib/grafana/abstract_panel_query.rb +0 -0
  7. data/lib/grafana/abstract_query.rb +0 -0
  8. data/lib/grafana/abstract_sql_query.rb +0 -0
  9. data/lib/grafana/dashboard.rb +0 -0
  10. data/lib/grafana/errors.rb +0 -0
  11. data/lib/grafana/grafana.rb +0 -0
  12. data/lib/grafana/panel.rb +0 -0
  13. data/lib/grafana/panel_image_query.rb +0 -0
  14. data/lib/grafana/variable.rb +0 -0
  15. data/lib/grafana_reporter/abstract_report.rb +0 -0
  16. data/lib/grafana_reporter/application/application.rb +0 -0
  17. data/lib/grafana_reporter/application/errors.rb +0 -0
  18. data/lib/grafana_reporter/asciidoctor/alerts_table_query.rb +0 -0
  19. data/lib/grafana_reporter/asciidoctor/annotations_table_query.rb +0 -0
  20. data/lib/grafana_reporter/asciidoctor/errors.rb +0 -0
  21. data/lib/grafana_reporter/asciidoctor/extensions/alerts_table_include_processor.rb +0 -0
  22. data/lib/grafana_reporter/asciidoctor/extensions/annotations_table_include_processor.rb +0 -0
  23. data/lib/grafana_reporter/asciidoctor/extensions/panel_image_block_macro.rb +0 -0
  24. data/lib/grafana_reporter/asciidoctor/extensions/panel_image_inline_macro.rb +0 -0
  25. data/lib/grafana_reporter/asciidoctor/extensions/panel_property_inline_macro.rb +0 -0
  26. data/lib/grafana_reporter/asciidoctor/extensions/panel_query_table_include_processor.rb +0 -0
  27. data/lib/grafana_reporter/asciidoctor/extensions/panel_query_value_inline_macro.rb +0 -0
  28. data/lib/grafana_reporter/asciidoctor/extensions/processor_mixin.rb +0 -0
  29. data/lib/grafana_reporter/asciidoctor/extensions/show_environment_include_processor.rb +0 -0
  30. data/lib/grafana_reporter/asciidoctor/extensions/show_help_include_processor.rb +0 -0
  31. data/lib/grafana_reporter/asciidoctor/extensions/sql_table_include_processor.rb +0 -0
  32. data/lib/grafana_reporter/asciidoctor/extensions/sql_value_inline_macro.rb +0 -0
  33. data/lib/grafana_reporter/asciidoctor/extensions/value_as_variable_include_processor.rb +8 -8
  34. data/lib/grafana_reporter/asciidoctor/panel_first_value_query.rb +0 -0
  35. data/lib/grafana_reporter/asciidoctor/panel_image_query.rb +0 -0
  36. data/lib/grafana_reporter/asciidoctor/panel_property_query.rb +0 -0
  37. data/lib/grafana_reporter/asciidoctor/panel_table_query.rb +0 -0
  38. data/lib/grafana_reporter/asciidoctor/query_mixin.rb +0 -0
  39. data/lib/grafana_reporter/asciidoctor/report.rb +0 -0
  40. data/lib/grafana_reporter/asciidoctor/sql_first_value_query.rb +0 -0
  41. data/lib/grafana_reporter/asciidoctor/sql_table_query.rb +0 -0
  42. data/lib/grafana_reporter/configuration.rb +1 -1
  43. data/lib/grafana_reporter/errors.rb +0 -0
  44. data/lib/grafana_reporter/logger/two_way_logger.rb +0 -0
  45. data/lib/ruby-grafana-reporter.rb +0 -0
  46. metadata +128 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ed0c1b79ce0e155cc974eaa86c09221e106376660515903765cb9e78e9c00f1
4
- data.tar.gz: 5e6fb779aa14cfbcc75f4f6916b24013fdcb036bf1a9fb46f844bbf0eaa99771
3
+ metadata.gz: aaffc7971d9bbdc7b7333d0e9e2bb11bb9c0f4a0a2a564718739793e76ad2f81
4
+ data.tar.gz: d14e3ef3e7892a15c960ba30e9f6a8c803668a071fe4d221d30d23c20ebbd6e0
5
5
  SHA512:
6
- metadata.gz: caac9139284da4855b6ca4686b4283129ca455ad0ad3b68b0e06c0232e48facacd4e813efe0960cb277f1d8d8ce64e30209af04fd6ab7eadac778a973c0192a3
7
- data.tar.gz: b738db7b1bc73c95369682c977e7db4757920539ec07ba386f7b91af7ea3321403f759a75ad4041c3bd94756eea2c1e70bc24759e9a9ee72fcec871958c3d85f
6
+ metadata.gz: 2585ee385b52e447922274769637ec0465bf3a24daceb88afcdaae2fc64d29bcad3d6790bdc7a24d38b881afa6ceeaf9715aa183eaa12084b91c284c46b3b64f
7
+ data.tar.gz: f608747c46af7c40f9eeb8a8a986a73d81bf85f35e68657046caf53182c8289c62e524eb49b4886117b9db5427de103e30f468403a52ae209a6c59fc9cc62489
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
@@ -1,85 +1,59 @@
1
- [![MIT License](https://img.shields.io/github/license/divinity666/ruby-grafana-reporter.svg?style=flat-square)](https://github.com/divinity666/ruby-grafana-reporter/blob/main/LICENSE)
1
+ [![MIT License](https://img.shields.io/github/license/divinity666/ruby-grafana-reporter.svg?style=flat-square)](https://github.com/divinity666/ruby-grafana-reporter/blob/master/LICENSE)
2
+ [![Build Status](https://travis-ci.org/divinity666/ruby-grafana-reporter.svg?branch=master)](https://travis-ci.org/github/divinity666/ruby-grafana-reporter?branch=master)
3
+ [![Coverage Status](https://coveralls.io/repos/github/divinity666/ruby-grafana-reporter/badge.svg?branch=master)](https://coveralls.io/github/divinity666/ruby-grafana-reporter?branch=master)
2
4
 
3
5
  # Ruby Grafana Reporter
4
- (Asciidoctor) Reporter Service for Grafana
6
+ Reporting Service for Grafana
7
+
8
+ ## Table of Contents
9
+
10
+ * [About the project](#about-the-project)
11
+ * [Getting started](#getting-started)
12
+ * [Initial Configuration](#initial-configuration)
13
+ * [Option 1) "Baremetal" Ruby](#baremetal-ruby)
14
+ * [Option 2) As a GEM](#as-a-gem)
15
+ * [Option 3) Docker](#docker)
16
+ * [Grafana integration](#grafana-integration)
17
+ * [Webservice overview](#webservice-overview)
18
+ * [Features](#features)
19
+ * [Roadmap](#roadmap)
20
+ * [Contributing](#contributing)
21
+ * [Licensing](#licensing)
22
+ * [Acknowledgements](#acknowledgements)
23
+ * [Donations](#donations)
24
+
25
+ ## About the project
5
26
 
6
27
  Did you ever want to create (professional) reports based on Grafana dashboards?
7
28
  I did so in order to being able to automatically get monthly reports of my
8
29
  home's energy usage. That's how it started.
9
30
 
10
- The reporter provides a full extension setup for the famous
11
- [Asciidoctor](https://github.com/asciidoctor/asciidoctor) and can perfectly
12
- integrate in a docker environment.
31
+ The reporter provides reporting capabilities for Grafana. It is based on
32
+ (but not limited to) [asciidoctor](https://github.com/asciidoctor/asciidoctor)
33
+ report templates, which can dynamically integrate Grafana panels, queries,
34
+ images etc. to create dynamic PDF reports on the fly.
13
35
 
14
- As a result of the reporter, you receive PDF documents or any other format that
15
- is supported by [Asciidoctor](https://github.com/asciidoctor/asciidoctor).
36
+ The report may also be returned in any other format that asciidoctor supports.
16
37
 
17
- ## Documentation
38
+ The reporter can run standalone or as a webservice. It is built to
39
+ integrate without further dependencies with the asciidoctor docker image.
18
40
 
19
- Find the complete
20
- [API documentation](https://rubydoc.info/github/divinity666/ruby-grafana-reporter)
21
- at this link.
41
+ The complete
42
+ [API documentation](https://rubydoc.info/gems/ruby-grafana-reporter) can be
43
+ found here.
22
44
 
23
- ## Installing
45
+ ## Getting started
24
46
 
25
47
  There exist several ways of installing the reporter. All of them have in
26
48
  common, that they require a working ruby environment. Check with the following
27
49
  commands, that the tools are setup and run properly:
28
50
 
29
- ruby -v
30
- gem -v
51
+ ruby -v
52
+ gem -v
31
53
 
32
- Download the ruby grafana reporter to a folder of your choice.
33
-
34
- You may want to use the single file application as well. BTW, you may build
35
- your own single file application by calling
36
-
37
- ruby bin/get_single_file_application.rb
38
-
39
- ### Barebone ruby installation
40
-
41
- To install on a plain ruby installation, follow these steps:
42
-
43
- Install asciidoctor
44
-
45
- gem install asciidoctor asciidoctor-pdf zip
46
-
47
- or simply use
48
-
49
- bundle install
50
-
51
- To check if all dependencies are setup properly, run the following command
52
- in that folder:
53
-
54
- ruby bin/ruby-grafana-reporter.rb -h
55
-
56
- ### GEM installation
57
-
58
- To install as a gem, simply run:
59
-
60
- gem install ruby-grafana-reporter
61
-
62
- To see if it works properly, you may run:
63
-
64
- irb
65
- require 'ruby-grafana-reporter'
66
- GrafanaReporter::Application::Application.new.configure_and_run
67
-
68
- The gem installation might mainly be interesting, if you would like to use the
69
- reporter as a library and include it in other application setups.
70
-
71
- ### Docker integration
72
-
73
- Essentially you need to make the application available within your asciidoctor
74
- docker container and run the following command
75
-
76
- ruby bin/ruby-grafana-reporter.rb -h
54
+ ### Initial Configuration
77
55
 
78
- If you are unsure, on how to make it available in the container, you may refer
79
- to the information in chapter 'Run as a service' for the docker integration
80
- below.
81
-
82
- ## Initial Configuration
56
+ #### Configuration file
83
57
 
84
58
  Create a first configuration file, named e.g. `myconfig` with the following
85
59
  content:
@@ -98,24 +72,7 @@ content:
98
72
  default-document-attributes:
99
73
  imagesdir: .
100
74
 
101
- Check out if the configuration is valid and your grafana instance can be accessed
102
- properly.
103
-
104
- ### Barebone ruby installation
105
-
106
- ruby bin/ruby-grafana-reporter.rb myconfig --test default
107
-
108
- ### GEM installation
109
-
110
- require 'ruby-grafana-reporter'
111
- GrafanaReporter::Application::Application.new.configure_and_run(["myconfig", "--test", "default"])
112
-
113
- ### Docker integration
114
-
115
- Same as in barebone ruby installation. Make sure you are running the command
116
- from inside the container, e.g. by using `docker exec`.
117
-
118
- ## Hello World example
75
+ #### "Hello World" asciidoctor template
119
76
 
120
77
  Create a first asciidoctor template file in your `templates-folder`, e.g.
121
78
  `myfirsttemplate.adoc` with the following content:
@@ -128,57 +85,133 @@ Create a first asciidoctor template file in your `templates-folder`, e.g.
128
85
 
129
86
  Now you're ready to go! Let's check it out!
130
87
 
131
- ### Barebone ruby installation
88
+ ### "Baremetal" Ruby
132
89
 
133
- ruby bin/ruby-grafana-reporter.rb myconfig --template myfirsttemplate.adoc --output myfirstrender.pdf
90
+ To install on a plain ruby installation, make sure that the `ruby` command is
91
+ accessible from your command line and then follow these steps:
134
92
 
135
- You should now find a PDF document named `myfirstrender.pdf` which includes a detailed
136
- help page on how to use the ruby grafana reporter functions in asciidoctor, as well
137
- as a list of all environment variables that can be accessed.
93
+ Download the ruby grafana reporter to a folder of your choice.
138
94
 
139
- ### GEM installation
95
+ Install asciidoctor
140
96
 
141
- require 'ruby-grafana-reporter'
142
- GrafanaReporter::Application::Application.new.configure_and_run(["myconfig", "--template", "myfirsttemplate.adoc", "--output", "myfirstrender.pdf"])
97
+ gem install asciidoctor asciidoctor-pdf zip
143
98
 
144
- ### Docker integration
99
+ or simply use
145
100
 
146
- Same as in barebone ruby installation. Make sure you are running the command
147
- from inside the container, e.g. by using `docker exec`.
101
+ bundle install
148
102
 
149
- ## Run as a service
103
+ To check if all dependencies are setup properly, run the following command
104
+ in that folder:
150
105
 
151
- Running the reporter as a webservice provides the following URLs
106
+ ruby bin/ruby-grafana-reporter -h
152
107
 
153
- /render - for rendering a template
154
- /overview - for all running or retained renderings
155
- /view_report - for viewing the status or receving the result of a specific rendering
156
- /cancel_report - for cancelling the rendering of a specific report
108
+ Check that your configured grafana instance can be accessed properly:
109
+
110
+ ruby bin/ruby-grafana-reporter myconfig --test default
111
+
112
+ Now you may want to check the conversion of your Hello World example:
113
+
114
+ ruby bin/ruby-grafana-reporter myconfig --template myfirsttemplate.adoc --output myfirstrender.pdf
115
+
116
+ You should now find a PDF document named `myfirstrender.pdf` which includes a detailed
117
+ help page on how to use the ruby grafana reporter functions in asciidoctor, as well
118
+ as a list of all environment variables that can be accessed.
157
119
 
158
- ### Barebone ruby installation
120
+ If this has been working properly as well, you might want to run the reporter
121
+ as a webservice. Nothing easier than that. Just call:
159
122
 
160
- ruby bin/ruby-grafana-reporter.rb myconfig
123
+ ruby bin/ruby-grafana-reporter myconfig
161
124
 
162
125
  Test your configuration by requesting the following URL in a browser of your
163
126
  choice:
164
127
 
165
128
  http://<<your-server-url>>:8815/render?var-template=myfirsttemplate.adoc
166
129
 
167
- ### GEM installation
130
+ If this now also serves you the PDF document after a few seconds (remember to
131
+ reload the page), you are done with the reporter service and might want to go
132
+ to step into the integration with grafana.
168
133
 
169
- require 'ruby-grafana-reporter'
170
- GrafanaReporter::Application::Application.new.configure_and_run(["myconfig"])
134
+ ### As a GEM
135
+
136
+ Installation as a gem is a simple way, if you don't want to mess with the
137
+ efforts of a barebone installation.
138
+
139
+ To install as a gem, simply run:
140
+
141
+ gem install ruby-grafana-reporter
142
+
143
+ To see if it works properly, you may run the application:
144
+
145
+ ruby-grafana-reporter
146
+
147
+ To check if your configured grafana instance can be accessed properly:
148
+
149
+ ruby-grafana-reporter myconfig --test default
150
+
151
+ Now you may want to check the conversion of your Hello World example:
152
+
153
+ ruby-grafana-reporter myconfig --template myfirsttemplate.adoc --output myfirstrender.pdf
154
+
155
+ You should now find a PDF document named `myfirstrender.pdf` which includes a detailed
156
+ help page on how to use the ruby grafana reporter functions in asciidoctor, as well
157
+ as a list of all environment variables that can be accessed.
158
+
159
+ If this has been working properly as well, you might want to run the reporter
160
+ as a webservice. Nothing easier than that. Just call:
161
+
162
+ ruby-grafana-reporter myconfig
171
163
 
172
164
  Test your configuration by requesting the following URL in a browser of your
173
165
  choice:
174
166
 
175
167
  http://<<your-server-url>>:8815/render?var-template=myfirsttemplate.adoc
176
168
 
177
- ### Docker integration
169
+ If this now also serves you the PDF document after a few seconds (remember to
170
+ reload the page), you are done with the reporter service and might want to go
171
+ to step into the integration with grafana.
172
+
173
+ ### Docker
174
+
175
+ One of the key features of the reporter is, that it can work seemlessly with
176
+ the official `asciidoctor` docker container without further dependencies.
178
177
 
179
178
  Assuming you have a `docker-compose` setup running, you may want to add the
180
179
  following to your services secion in your `docker-compose.yml`:
181
180
 
181
+ asciidoctor:
182
+ image: asciidoctor/docker-asciidoctor
183
+ container_name: asciidoctor
184
+ hostname: asciidoctor
185
+ volumes:
186
+ - /<<an-empty-local-path>>:/documents
187
+ restart: unless-stopped
188
+
189
+ After running this container, you have to copy the reporter files. Download the
190
+ ruby grafana reporter to the folder `<<an-empty-local-path>>`. I tend to use
191
+ the single file application there.
192
+
193
+ To test the setup, you'll have to first step inside the container, e.g. by
194
+ calling `docker exec` with the appropriate parameters. Then you can simply
195
+ run
196
+
197
+ ruby bin/ruby-grafana-reporter -h
198
+
199
+ Check that your configured grafana instance can be accessed properly:
200
+
201
+ ruby bin/ruby-grafana-reporter myconfig --test default
202
+
203
+ Now you may want to check the conversion of your Hello World example:
204
+
205
+ ruby bin/ruby-grafana-reporter myconfig --template myfirsttemplate.adoc --output myfirstrender.pdf
206
+
207
+ You should now find a PDF document named `myfirstrender.pdf` which includes a detailed
208
+ help page on how to use the ruby grafana reporter functions in asciidoctor, as well
209
+ as a list of all environment variables that can be accessed.
210
+
211
+ If this has been working properly as well, you might want to run the reporter
212
+ as a webservice always when starting the container. To do so, use the following
213
+ `docker-compose` configuration. Watch out for the added lines!
214
+
182
215
  asciidoctor:
183
216
  image: asciidoctor/docker-asciidoctor
184
217
  container_name: asciidoctor
@@ -193,7 +226,7 @@ Additionally you need to create a `startup.sh` file in the folder
193
226
  `<<an-empty-local-path>>` with the following content:
194
227
 
195
228
  cd /documents
196
- ruby bin/ruby-grafana-reporter.rb myconfig
229
+ ruby bin/ruby-grafana-reporter myconfig
197
230
 
198
231
  After restarting the container, the service should be running.
199
232
 
@@ -202,10 +235,61 @@ choice:
202
235
 
203
236
  http://<<your-server-url>>:8815/render?var-template=myfirsttemplate.adoc
204
237
 
238
+ If this now also serves you the PDF document after a few seconds (remember to
239
+ reload the page), you are done with the reporter service and might want to go
240
+ to step into the integration with grafana.
241
+
242
+ ### Grafana integration
243
+
244
+ The key feature of the report is, that it can easily be integrated with grafana
245
+ (I've not even been talking about the features it is providing for that, but
246
+ you'll find them having a look in the example results above).
247
+
248
+ For accessing the reporter from grafana, you need to simply add a link to your
249
+ grafana dashboard:
250
+
251
+ * Open the dashboard configuration
252
+ * Select `Links`
253
+ * Select `Add`
254
+ * Fill out as following:
255
+ * Type: `link`
256
+ * Url: `http://<<your-server-url>>:8815/render?var-template=myfirsttemplate.adoc`
257
+ * Title: `MyFirstReport`
258
+ * Select `Time range`
259
+ * Select `Variable values`
260
+ * Select `Add`
261
+
262
+ Now go back to your dashboard and click the newly generated 'MyFirstReport'
263
+ link on it. Now the renderer should start it's task and show you the expected
264
+ results.
265
+
266
+ But now the fun just starts! Try out the functions stated in the
267
+ 'MyFirstReport' PDF file, to include the dynamic content in your asciidoctor
268
+ template.
269
+
270
+ Additionally you might want to make the selection of the template variable.
271
+ Piece of cake: Just add a dashboard variable to your grafana dashboard named
272
+ `template` and let the user select or enter a template name. To make use of it,
273
+ you should change the link of the 'MyFirstReport' link to
274
+ `http://<<your-server-url>>:8815/render?`
275
+
276
+ That's it. Let me know your feedback!
277
+
278
+ ## Webservice overview
279
+
280
+ Running the reporter as a webservice provides the following URLs
281
+
282
+ /overview - for all running or retained renderings
283
+ /render - for rendering a template, 'var-template' is the only mandatory GET parameter
284
+ /view_report - for viewing the status or receving the result of a specific rendering, is automatically called after a successfull /render call
285
+ /cancel_report - for cancelling the rendering of a specific report, normally not called manually, but on user interaction in the /view_report or /overview URL
286
+
205
287
  ## Features
206
288
 
207
- * Integrate grafana panel images, grafana panel query results as table or single values,
208
- custom SQL query results as tables, alers, annotations and many more
289
+ * Build report template including all imaginable grafana content:
290
+ * panels as images
291
+ * panel table query or custom query results as real document tables (not images!)
292
+ * single panel value or custom query single value result integrated in texts
209
293
  * Solid as a rock, also in case of template errors (at least it aims to be)
210
294
  * Runs standalone or as a webservice
211
295
  * Seamlessly integrates with asciidoctor docker container
@@ -215,8 +299,8 @@ custom SQL query results as tables, alers, annotations and many more
215
299
 
216
300
  This is just a collection of things, I am heading for in future, without a schedule.
217
301
 
302
+ * Add documentation of possible asciidoctor calls to grafana
218
303
  * Add documentation for configuration file
219
- * Share (anonymized) rspec tests in this repo
220
304
  * Add a simple plugin system to support specific asciidoctor modifications
221
305
  * Solve code TODOs
222
306
  * Become [rubocop](https://rubocop.org/) ready
@@ -229,6 +313,12 @@ branch. Pull requests are warmly welcome.
229
313
  Though not yet valid for my code, I'd like to see the project become
230
314
  [rubocop](https://rubocop.org/) ready :-)
231
315
 
316
+ Definitely open spots from my side are:
317
+
318
+ * This README
319
+ * Clean and properly setup test cases
320
+ * An own webpage for this project
321
+
232
322
  ## Licensing
233
323
 
234
324
  The code in this project is licensed under MIT license.
@@ -236,6 +326,7 @@ The code in this project is licensed under MIT license.
236
326
  ## Acknowledgements
237
327
  * [asciidoctor](https://github.com/asciidoctor/asciidoctor)
238
328
  * [asciidoctor-pdf](https://github.com/asciidoctor/asciidoctor-pdf)
329
+ * [grafana](https://github.com/grafana/grafana)
239
330
 
240
331
  Inspired by [Izak Marai's grafana reporter](https://github.com/IzakMarais/reporter)
241
332
 
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/ruby-grafana-reporter'
3
+
4
+ GrafanaReporter::Application::Application.new.configure_and_run(ARGV)
@@ -1,3 +1,3 @@
1
1
  # Version information
2
- GRAFANA_REPORTER_VERSION = [0, 1, 6].freeze
3
- GRAFANA_REPORTER_RELEASE_DATE = '2020-10-19'
2
+ GRAFANA_REPORTER_VERSION = [0, 1, 7].freeze
3
+ GRAFANA_REPORTER_RELEASE_DATE = '2020-10-24'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -4,7 +4,6 @@ module GrafanaReporter
4
4
  module Asciidoctor
5
5
  module Extensions
6
6
  # TODO: add documentation
7
- # TODO: add tests
8
7
  class ValueAsVariableIncludeProcessor < ::Asciidoctor::Extensions::IncludeProcessor
9
8
  include ProcessorMixin
10
9
 
@@ -20,9 +19,10 @@ module GrafanaReporter
20
19
  # do NOT increase step, as this is done by sub processor
21
20
  #@report.next_step
22
21
 
23
- call, target = attrs.delete('call').split(":")
22
+ call_attr = attrs.delete('call')
23
+ call, target = call_attr.split(":") if call_attr
24
24
  attribute = attrs.delete('variable_name')
25
- @report.logger.debug("Processing AttributeIncludeProcessor (call: #{call}, target: #{target}, variable_name: #{attribute}, attrs: #{attrs.to_s})")
25
+ @report.logger.debug("Processing ValueAsVariableIncludeProcessor (call: #{call}, target: #{target}, variable_name: #{attribute}, attrs: #{attrs.to_s})")
26
26
  if not call or not attribute
27
27
  @report.logger.error("Missing mandatory attribute 'call' or 'variable_name'.")
28
28
  return reader
@@ -34,18 +34,18 @@ module GrafanaReporter
34
34
  end
35
35
 
36
36
  # TODO: properly show error messages also in document
37
- ext = doc.extensions.find_inline_macro_extension(call)
37
+ ext = doc.extensions.find_inline_macro_extension(call) if doc.extensions.inline_macros?
38
38
  if not ext
39
- @report.logger.error("Could not find extension for '#{call}'.")
39
+ @report.logger.error("Could not find inline macro extension for '#{call}'.")
40
40
  else
41
- @report.logger.debug("AttributeIncludeProcessor: Calling sub-method.")
41
+ @report.logger.debug("ValueAsVariableIncludeProcessor: Calling sub-method.")
42
42
  item = ext.process_method.call(doc, target, attrs)
43
43
  if not item.text.to_s.empty?
44
44
  result = ":#{attribute}: #{item.text}"
45
- @report.logger.debug("AttributeIncludeProcessor: Adding '#{result}' to document.")
45
+ @report.logger.debug("ValueAsVariableIncludeProcessor: Adding '#{result}' to document.")
46
46
  reader.unshift_line(result)
47
47
  else
48
- @report.logger.debug("AttributeIncludeProcessor: Not adding variable '#{attribute}', as query result was empty.")
48
+ @report.logger.debug("ValueAsVariableIncludeProcessor: Not adding variable '#{attribute}', as query result was empty.")
49
49
  end
50
50
  end
51
51
 
@@ -143,7 +143,7 @@ module GrafanaReporter
143
143
  params << '--help' if params.empty?
144
144
 
145
145
  parser = OptionParser.new do |opts|
146
- opts.banner = 'Usage: ruby ruby-grafana-reporter.rb CONFIG_FILE [options]'
146
+ opts.banner = "Usage: ruby #{$0} CONFIG_FILE [options]"
147
147
 
148
148
  opts.on('-d', '--debug LEVEL', 'Specify detail level: FATAL, ERROR, WARN, INFO, DEBUG.') do |level|
149
149
  @logger.level = Object.const_get("::Logger::Severity::#{level}") if level =~ /(?:FATAL|ERROR|WARN|INFO|DEBUG)/
File without changes
File without changes
metadata CHANGED
@@ -1,23 +1,133 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-grafana-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Kohlmeyer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-19 00:00:00.000000000 Z
12
- dependencies: []
13
- description: |-
14
- The reporter provides a full extension setup for the famous Asciidoctor and can perfectly integrate in a docker environment. It can be used as to convert single documents or run as a service.
11
+ date: 2020-10-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: asciidoctor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: asciidoctor-pdf
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubyzip
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.1
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '2.3'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">"
56
+ - !ruby/object:Gem::Version
57
+ version: 1.1.1
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.3'
61
+ - !ruby/object:Gem::Dependency
62
+ name: simplecov
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.16'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.16'
75
+ - !ruby/object:Gem::Dependency
76
+ name: coveralls
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.8'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.8'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '3.9'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.9'
103
+ - !ruby/object:Gem::Dependency
104
+ name: webmock
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.9'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '3.9'
117
+ description: |
118
+ Provides a standalone and a webservice frontend for creating reports
119
+ based on asciidoctor, including interfaces to integrate dynamic content
120
+ captured from grafana.
15
121
 
16
- As a result of the reporter, you receive PDF documents or any other format that is supported by Asciidoctor.
122
+ By default the reports will be converted to PDF documents, whereas other
123
+ target formats can be used as well.
17
124
  email: kohly@gmx.de
18
- executables: []
125
+ executables:
126
+ - ruby-grafana-reporter
19
127
  extensions: []
20
- extra_rdoc_files: []
128
+ extra_rdoc_files:
129
+ - README.md
130
+ - LICENSE
21
131
  files:
22
132
  - "./lib/VERSION.rb"
23
133
  - "./lib/grafana/abstract_panel_query.rb"
@@ -62,11 +172,14 @@ files:
62
172
  - "./lib/ruby-grafana-reporter.rb"
63
173
  - LICENSE
64
174
  - README.md
175
+ - bin/ruby-grafana-reporter
65
176
  homepage: https://github.com/divinity666/ruby-grafana-reporter
66
177
  licenses:
67
178
  - MIT
68
- metadata: {}
69
- post_install_message:
179
+ metadata:
180
+ source_code_uri: https://github.com/divinity666/ruby-grafana-reporter
181
+ bug_tracker_uri: https://github.com/divinity666/ruby-grafana-reporter/issues
182
+ post_install_message:
70
183
  rdoc_options: []
71
184
  require_paths:
72
185
  - lib
@@ -81,8 +194,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
194
  - !ruby/object:Gem::Version
82
195
  version: '0'
83
196
  requirements: []
84
- rubygems_version: 3.1.4
85
- signing_key:
197
+ rubyforge_project:
198
+ rubygems_version: 2.7.6.2
199
+ signing_key:
86
200
  specification_version: 4
87
- summary: "(Asciidoctor) Reporter Service for Grafana"
201
+ summary: Reporter Service for Grafana
88
202
  test_files: []