rubbyReport 0.0.1
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.
- checksums.yaml +7 -0
- data/bin/rubbyReport +24 -0
- data/lib/rubbyReport.rb +58 -0
- data/lib/templates/basic.html.erb +18 -0
- metadata +47 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6464757c3c7c9f42c5c427ee2498fd7e757ae6c287f8db9fd1d7decd121c4072
|
|
4
|
+
data.tar.gz: cab914f13890894d6302b33a16189ac765dbe64f981cac8ed7eab40ca2e1a81c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 51b438e03dadce9988b55dfec9918c8cfbfd20c5c415edc99729135ccec87f6d01796da5c22a69119972df34c5261e424c840fe128ae26b8f84c41dc01896244
|
|
7
|
+
data.tar.gz: d1b440b4cced2fa18b9d035144894eaf8c229eedd008c1dc750e3a48bbe44efc668e2d7fac36ce56dd6e9aea4804bf6d188db3d1ece27744c0d1428714557a7f
|
data/bin/rubbyReport
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require_relative '../lib/rubbyReport'
|
|
4
|
+
require 'thor'
|
|
5
|
+
|
|
6
|
+
class MyCLI < Thor
|
|
7
|
+
desc "generate", 'Generate report with .png files in current folder'
|
|
8
|
+
long_desc <<-LONGDESC
|
|
9
|
+
`Rubby Report will generate the report based on the name of the file, the order after the @ simbol
|
|
10
|
+
|
|
11
|
+
examples filenames:
|
|
12
|
+
doing something here@1.png
|
|
13
|
+
doing other thing@2.png
|
|
14
|
+
third thing that has be done@3.png
|
|
15
|
+
|
|
16
|
+
> from: Rodrigo Tenorio(rt3norio@gmail.com)
|
|
17
|
+
LONGDESC
|
|
18
|
+
def generate()
|
|
19
|
+
r = RubbyReport.new
|
|
20
|
+
r.run
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
MyCLI.start(ARGV)
|
data/lib/rubbyReport.rb
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
require 'base64'
|
|
3
|
+
require 'erb'
|
|
4
|
+
|
|
5
|
+
class RubbyReport
|
|
6
|
+
def initialize
|
|
7
|
+
@images_list = Dir.glob("*png")
|
|
8
|
+
@images_list.reverse!
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def generate_base_64_from_img_to_src(path)
|
|
12
|
+
File.open(path, 'rb') do |img|
|
|
13
|
+
'data:image/png;base64,' + Base64.strict_encode64(img.read)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def run
|
|
18
|
+
data = ReportData.new
|
|
19
|
+
data.images_array = @images_list.map do |img|
|
|
20
|
+
[img.split('@')[-2], generate_base_64_from_img_to_src(img)]
|
|
21
|
+
end
|
|
22
|
+
data.issue_description = 'descricao do que o ticket pedia'
|
|
23
|
+
data.date = Time.now
|
|
24
|
+
data.issue_key = "TO-15492"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
view = Report.new('basic', data)
|
|
28
|
+
File.write("report.html", view.render)
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class Report
|
|
34
|
+
def initialize(page, data = {})
|
|
35
|
+
@data = data
|
|
36
|
+
@page = page
|
|
37
|
+
file = File.join(File.dirname(__FILE__), "./templates/#{page}.html.erb")
|
|
38
|
+
@template = File.read(file)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def render
|
|
42
|
+
ERB.new(@template).result(binding)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class ReportData
|
|
47
|
+
attr_accessor :issue_key, :issue_description, :date, :images_array
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# 3) pedir ao usuĂĄrio qual o nome do tĂtulo a ser inserido no HTML
|
|
52
|
+
|
|
53
|
+
# 4) inserir titulo e imagem em base 64 conforme template html
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<body>
|
|
4
|
+
<h1>Session Report</h1>
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
<h2><%= @data.issue_key %></h2>
|
|
8
|
+
<h3><%= @data.issue_description %></h3>
|
|
9
|
+
|
|
10
|
+
<br/><br/>
|
|
11
|
+
<% @data.images_array.each do |img|%>
|
|
12
|
+
<h3><%=img[0]%></h3>
|
|
13
|
+
<br/>
|
|
14
|
+
<img src='<%=img[1]%>' />
|
|
15
|
+
<br/><br/><br/>
|
|
16
|
+
<% end %>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
metadata
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rubbyReport
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Rodrigo Tenorio
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-04-30 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Generate reports using images and templates in ERB
|
|
14
|
+
email: rt3norio@gmail.com
|
|
15
|
+
executables:
|
|
16
|
+
- rubbyReport
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- bin/rubbyReport
|
|
21
|
+
- lib/rubbyReport.rb
|
|
22
|
+
- lib/templates/basic.html.erb
|
|
23
|
+
homepage: https://github.com/rt3norio/rubbyReport
|
|
24
|
+
licenses:
|
|
25
|
+
- MIT
|
|
26
|
+
metadata: {}
|
|
27
|
+
post_install_message:
|
|
28
|
+
rdoc_options: []
|
|
29
|
+
require_paths:
|
|
30
|
+
- lib
|
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: '0'
|
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
requirements: []
|
|
42
|
+
rubyforge_project:
|
|
43
|
+
rubygems_version: 2.7.6
|
|
44
|
+
signing_key:
|
|
45
|
+
specification_version: 4
|
|
46
|
+
summary: Image Reports made easy!
|
|
47
|
+
test_files: []
|