iic2143_reporter 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 858254e1ee581f9890b48fd507918287307a400d7bef1d342d7674145f6a8d04
4
+ data.tar.gz: 83b1f6b794a7bfe266eeaec708c69972dc00b2243c1450865f45d5c9399de23b
5
+ SHA512:
6
+ metadata.gz: 9b33f9b15eea1c87625ed2fd53cb8ec580be18b49fe1c87acb106e88d6c72b40777ab2a0e081e80d3642f34054e374b0487cbe5b1e7c8437f420c58b6792ed86
7
+ data.tar.gz: 268c1849b4175e4223b674df3bfc96588a765277939f9dc241860cbb5c0893c9b06651b4839a77d4d0aa8d32b3dde8ca7c5c90d255df209e23698b4eab7e6c26
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Iic2143Reporter
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/iic2143_reporter`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/iic2143_reporter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/iic2143_reporter/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Iic2143Reporter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/iic2143_reporter/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,33 @@
1
+ # lib/iic2143_reporter/reporter.rb
2
+ require "erb"
3
+
4
+
5
+ module IIC2143Reporter
6
+ class Reporter
7
+ TEMPLATE = File.join(File.dirname(__FILE__), "template.html.erb")
8
+
9
+ def initialize(total_score, max_score, failed_tests, feedback)
10
+ @total_score = total_score
11
+ @max_score = max_score
12
+ @failed_tests = failed_tests
13
+ @feedback = feedback
14
+ @timestamp = Time.now.strftime("%Y-%m-%d %H:%M:%S")
15
+ @feedback_class = feedback_class # Añade esta línea
16
+ end
17
+
18
+ def generate(output_path = "test_report.html")
19
+ template = File.read(TEMPLATE)
20
+ html = ERB.new(template).result(binding)
21
+ File.write(output_path, html)
22
+ puts "✅ Reporte generado en: #{output_path}"
23
+ end
24
+
25
+ def feedback_class
26
+ case @total_score
27
+ when 5.5..6.0 then "success"
28
+ when 4.0..5.4 then "warning"
29
+ else "danger"
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,47 @@
1
+ <!-- lib/iic2143_reporter/template.html.erb -->
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <title>Reporte de Tests IIC2143</title>
6
+ <style>
7
+ :root { --color-primary: #2c3e50; --color-success: #27ae60; --color-danger: #e74c3c; }
8
+ body { font-family: 'Segoe UI', sans-serif; margin: 2rem; }
9
+ .header { text-align: center; margin-bottom: 2rem; }
10
+ .score { font-size: 2.5em; font-weight: bold; margin: 1rem 0; }
11
+ .feedback { padding: 1rem; border-radius: 8px; margin: 1rem 0; }
12
+ .success { background-color: #e8f5e9; color: var(--color-success); }
13
+ .warning { background-color: #fff3e0; color: #f39c12; }
14
+ .danger { background-color: #ffebee; color: var(--color-danger); }
15
+ .failed-tests { margin-top: 2rem; }
16
+ .test-list { list-style-type: none; padding: 0; }
17
+ .test-item { padding: 0.5rem; margin: 0.3rem 0; border-left: 4px solid var(--color-danger); }
18
+ .timestamp { color: #7f8c8d; font-size: 0.9em; text-align: center; margin-top: 2rem; }
19
+ </style>
20
+ </head>
21
+ <body>
22
+ <div class="header">
23
+ <h1>📊 Reporte de Tests IIC2143</h1>
24
+ <div class="score">
25
+ <%= @total_score.round(1) %>/<%= @max_score %>
26
+ </div>
27
+ <div class="feedback <%= feedback_class %>">
28
+ <%= @feedback %>
29
+ </div>
30
+ </div>
31
+
32
+ <% if @failed_tests.any? %>
33
+ <div class="failed-tests">
34
+ <h3>🔴 Tests Fallidos:</h3>
35
+ <ul class="test-list">
36
+ <% @failed_tests.each do |test| %>
37
+ <li class="test-item"><%= test %></li>
38
+ <% end %>
39
+ </ul>
40
+ </div>
41
+ <% end %>
42
+
43
+ <div class="timestamp">
44
+ Generado el: <%= @timestamp %>
45
+ </div>
46
+ </body>
47
+ </html>
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Iic2143Reporter
4
+ VERSION = "0.1.1"
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "iic2143_reporter/version"
4
+ require_relative "iic2143_reporter/reporter"
5
+
6
+ module IIC2143Reporter
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iic2143_reporter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - jtvaldivia
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-03-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Gem for creation of HTML reports of grades tester fow now in IIC2143
14
+ email:
15
+ - jvaldivia@buk.cl
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - README.md
21
+ - lib/iic2143_reporter.rb
22
+ - lib/iic2143_reporter/reporter.rb
23
+ - lib/iic2143_reporter/template.html.erb
24
+ - lib/iic2143_reporter/version.rb
25
+ homepage: https://github.com/tu-usuario/iic2143_reporter
26
+ licenses:
27
+ - MIT
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 3.1.0
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubygems_version: 3.5.22
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Generador de reportes HTML para tests IIC2143
48
+ test_files: []