ruby2html 1.5.2 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gem/ruby2html/render.rb +1 -1
  3. data/lib/gem/ruby2html/version.rb +1 -1
  4. data/ruby2html.gemspec +33 -0
  5. metadata +2 -76
  6. data/.dockerignore +0 -48
  7. data/.rspec +0 -2
  8. data/.rubocop.yml +0 -16
  9. data/.ruby-version +0 -1
  10. data/Dockerfile +0 -71
  11. data/README.md +0 -318
  12. data/Rakefile +0 -8
  13. data/app/assets/config/manifest.js +0 -2
  14. data/app/assets/images/.keep +0 -0
  15. data/app/assets/stylesheets/application.css +0 -15
  16. data/app/channels/application_cable/channel.rb +0 -6
  17. data/app/channels/application_cable/connection.rb +0 -6
  18. data/app/components/application_component.rb +0 -5
  19. data/app/components/first_component.html.rb +0 -11
  20. data/app/components/first_component.rb +0 -19
  21. data/app/components/second_component.rb +0 -12
  22. data/app/components/third_component/third_component.html.rb +0 -6
  23. data/app/components/third_component.rb +0 -7
  24. data/app/controllers/application_controller.rb +0 -7
  25. data/app/controllers/benchmark_controller.rb +0 -48
  26. data/app/controllers/concerns/.keep +0 -0
  27. data/app/controllers/home_controller.rb +0 -16
  28. data/app/helpers/application_helper.rb +0 -4
  29. data/app/jobs/application_job.rb +0 -9
  30. data/app/mailers/application_mailer.rb +0 -6
  31. data/app/models/application_record.rb +0 -5
  32. data/app/models/concerns/.keep +0 -0
  33. data/app/views/benchmark/normal_html.html.erb +0 -31
  34. data/app/views/benchmark/ruby_2html.html.rb +0 -33
  35. data/app/views/home/form.html.rb +0 -14
  36. data/app/views/home/index.html.erb +0 -43
  37. data/app/views/home/rb_files.html.rb +0 -18
  38. data/app/views/layouts/application.html.erb +0 -21
  39. data/app/views/layouts/mailer.html.erb +0 -13
  40. data/app/views/layouts/mailer.text.erb +0 -1
  41. data/app/views/pwa/manifest.json.erb +0 -22
  42. data/app/views/pwa/service-worker.js +0 -26
  43. data/app/views/shared/_footer.html.rb +0 -3
  44. data/app/views/shared/_navbar.html.erb +0 -1
  45. data/config/application.rb +0 -45
  46. data/config/boot.rb +0 -6
  47. data/config/cable.yml +0 -10
  48. data/config/credentials.yml.enc +0 -1
  49. data/config/database.yml +0 -32
  50. data/config/environment.rb +0 -7
  51. data/config/environments/development.rb +0 -85
  52. data/config/environments/production.rb +0 -104
  53. data/config/environments/test.rb +0 -69
  54. data/config/initializers/assets.rb +0 -14
  55. data/config/initializers/content_security_policy.rb +0 -27
  56. data/config/initializers/filter_parameter_logging.rb +0 -10
  57. data/config/initializers/inflections.rb +0 -18
  58. data/config/initializers/permissions_policy.rb +0 -15
  59. data/config/locales/en.yml +0 -31
  60. data/config/puma.rb +0 -56
  61. data/config/routes.rb +0 -23
  62. data/config/storage.yml +0 -34
  63. data/config.ru +0 -8
  64. data/db/seeds.rb +0 -11
  65. data/lefthook.yml +0 -8
  66. data/lib/assets/.keep +0 -0
  67. data/lib/tasks/.keep +0 -0
  68. data/log/.keep +0 -0
  69. data/public/404.html +0 -67
  70. data/public/406-unsupported-browser.html +0 -66
  71. data/public/422.html +0 -67
  72. data/public/500.html +0 -66
  73. data/public/icon.png +0 -0
  74. data/public/icon.svg +0 -3
  75. data/public/robots.txt +0 -1
  76. data/storage/.keep +0 -0
  77. data/tmp/.keep +0 -0
  78. data/tmp/pids/.keep +0 -0
  79. data/tmp/storage/.keep +0 -0
  80. data/vendor/.keep +0 -0
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class FirstComponent < ApplicationComponent
4
- def initialize
5
- @item = 'Hello, World!'
6
- end
7
-
8
- def another_div
9
- div do
10
- "Item value: #{@item}"
11
- end
12
-
13
- div class: 'another' do
14
- h2 'Another subheading from component'
15
- end
16
-
17
- h1 'Yet Another heading from component'
18
- end
19
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class SecondComponent < ApplicationComponent
4
- def call
5
- html do
6
- h1 class: 'my-class' do
7
- plain 'Second Component'
8
- end
9
- link_to 'Home', root_path
10
- end
11
- end
12
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- h1 'Third component'
4
- div do
5
- "Item value: #{@item}"
6
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ThirdComponent < ApplicationComponent
4
- def initialize
5
- @item = 'Hello, World!'
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationController < ActionController::Base
4
- # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
5
- allow_browser versions: :modern
6
- include Ruby2html::RailsHelper
7
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class BenchmarkController < ApplicationController
4
- def normal_html
5
- @complex_data = generate_complex_data
6
- end
7
-
8
- def ruby_2html
9
- @complex_data = generate_complex_data
10
- end
11
-
12
- private
13
- def generate_complex_data
14
- {
15
- users: 50.times.map do |i|
16
- {
17
- id: i + 1,
18
- name: Faker::Name.name,
19
- email: Faker::Internet.email,
20
- address: {
21
- street: Faker::Address.street_address,
22
- city: Faker::Address.city,
23
- country: Faker::Address.country
24
- },
25
- orders: rand(1..5).times.map do
26
- {
27
- id: Faker::Alphanumeric.alphanumeric(number: 10),
28
- total: Faker::Commerce.price(range: 10..1000.0),
29
- items: rand(1..10).times.map do
30
- {
31
- name: Faker::Commerce.product_name,
32
- price: Faker::Commerce.price(range: 5..500.0),
33
- quantity: rand(1..5)
34
- }
35
- end
36
- }
37
- end
38
- }
39
- end,
40
- stats: {
41
- total_users: 50,
42
- average_orders_per_user: rand(1.0..5.0).round(2),
43
- most_expensive_item: Faker::Commerce.product_name,
44
- most_popular_country: Faker::Address.country
45
- }
46
- }
47
- end
48
- end
File without changes
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class HomeController < ApplicationController
4
- def index
5
- @items = [
6
- {
7
- title: 'Item 1',
8
- description: 'Description 1'
9
- }
10
- ]
11
- end
12
-
13
- def rb_files
14
- @value = 'value'
15
- end
16
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ApplicationHelper
4
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationJob < ActiveJob::Base
4
- # Automatically retry jobs that encountered a deadlock
5
- # retry_on ActiveRecord::Deadlocked
6
-
7
- # Most jobs are safe to ignore if the underlying records are no longer available
8
- # discard_on ActiveJob::DeserializationError
9
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationMailer < ActionMailer::Base
4
- default from: 'from@example.com'
5
- layout 'mailer'
6
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationRecord < ActiveRecord::Base
4
- primary_abstract_class
5
- end
File without changes
@@ -1,31 +0,0 @@
1
- <h1>Benchmark: Normal HTML (ERB)</h1>
2
-
3
- <h2>User Statistics</h2>
4
- <ul>
5
- <li>Total Users: <%= @complex_data[:stats][:total_users] %></li>
6
- <li>Average Orders per User: <%= @complex_data[:stats][:average_orders_per_user] %></li>
7
- <li>Most Expensive Item: <%= @complex_data[:stats][:most_expensive_item] %></li>
8
- <li>Most Popular Country: <%= @complex_data[:stats][:most_popular_country] %></li>
9
- </ul>
10
-
11
- <h2>User List</h2>
12
- <% @complex_data[:users].each do |user| %>
13
- <div class="user-card">
14
- <h3><%= user[:name] %></h3>
15
- <p>Email: <%= user[:email] %></p>
16
- <p>Address: <%= "#{user[:address][:street]}, #{user[:address][:city]}, #{user[:address][:country]}" %></p>
17
-
18
- <h4>Orders</h4>
19
- <% user[:orders].each do |order| %>
20
- <div class="order">
21
- <p>Order ID: <%= order[:id] %></p>
22
- <p>Total: $<%= order[:total] %></p>
23
- <ul>
24
- <% order[:items].each do |item| %>
25
- <li><%= item[:name] %> - $<%= item[:price] %> (Quantity: <%= item[:quantity] %>)</li>
26
- <% end %>
27
- </ul>
28
- </div>
29
- <% end %>
30
- </div>
31
- <% end %>
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- h1 'Benchmark: Ruby2html'
4
-
5
- h2 'User Statistics'
6
- ul do
7
- li { plain "Total Users: #{@complex_data[:stats][:total_users]}" }
8
- li { plain "Average Orders per User: #{@complex_data[:stats][:average_orders_per_user]}" }
9
- li { plain "Most Expensive Item: #{@complex_data[:stats][:most_expensive_item]}" }
10
- li { plain "Most Popular Country: #{@complex_data[:stats][:most_popular_country]}" }
11
- end
12
-
13
- h2 'User List'
14
- @complex_data[:users].each do |user|
15
- div class: 'user-card' do
16
- h3 user[:name]
17
- p { plain "Email: #{user[:email]}" }
18
- p { plain "Address: #{user[:address][:street]}, #{user[:address][:city]}, #{user[:address][:country]}" }
19
-
20
- h4 'Orders'
21
- user[:orders].each do |order|
22
- div class: 'order' do
23
- p { plain "Order ID: #{order[:id]}" }
24
- p { plain "Total: $#{order[:total]}" }
25
- ul do
26
- order[:items].each do |item|
27
- li { plain "#{item[:name]} - $#{item[:price]} (Quantity: #{item[:quantity]})" }
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- div do
4
- h1 'form'
5
-
6
- form_with url: '/form', method: 'post' do |f|
7
- f.label :name
8
- f.text_field :name
9
- f.submit 'submit'
10
- end
11
-
12
- link_to 'Home', root_path
13
- # button_to 'home', '/'
14
- end
@@ -1,43 +0,0 @@
1
- <h1>Home</h1>
2
-
3
- <%= render FirstComponent.new %>
4
- <%= render SecondComponent.new %>
5
- <%= render ThirdComponent.new %>
6
-
7
- <%=
8
- html(self) do
9
- h1(id: 4) { "Inside" }
10
- h2 "Inside 2", id: '44'
11
- h1 "ok"
12
- h1 "ok"
13
- h1 "ok"
14
- h1 "ok"
15
- h1 "ok"
16
- div do
17
- link_to 'home 1', root_path
18
- end
19
- link_to 'home 2', root_path
20
-
21
- div do
22
- link_to 'home 3', root_path
23
- end
24
-
25
- render partial: 'shared/navbar'
26
-
27
- @items.each do |item|
28
- h1 item[:title]
29
- end
30
- end
31
- %>
32
-
33
- <%= render partial: 'shared/navbar' %>
34
-
35
- <%=
36
- html(self) do
37
- @items.each do |item|
38
- h1 item[:title]
39
- end
40
-
41
- turbo_frame id: '4'
42
- end
43
- %>
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- h1 'RbFiles'
4
- h1 'ok'
5
- h1 'okddwadwa'
6
-
7
- div @value
8
-
9
- form_with url: '/test' do |f|
10
- f.text_field :name, placeholder: 'Name'
11
- f.submit 'Submit'
12
- end
13
-
14
- link_to 'Home', root_url
15
- render partial: 'shared/navbar'
16
- render partial: 'shared/footer'
17
-
18
- div @value
@@ -1,21 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title><%= content_for(:title) || "Ruby2html" %></title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <meta name="apple-mobile-web-app-capable" content="yes">
7
- <%= csrf_meta_tags %>
8
- <%= csp_meta_tag %>
9
-
10
- <%= yield :head %>
11
-
12
- <link rel="icon" href="/icon.png" type="image/png">
13
- <link rel="icon" href="/icon.svg" type="image/svg+xml">
14
- <link rel="apple-touch-icon" href="/icon.png">
15
- <%= stylesheet_link_tag "application" %>
16
- </head>
17
-
18
- <body>
19
- <%= yield %>
20
- </body>
21
- </html>
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <style>
6
- /* Email styles need to be inline */
7
- </style>
8
- </head>
9
-
10
- <body>
11
- <%= yield %>
12
- </body>
13
- </html>
@@ -1 +0,0 @@
1
- <%= yield %>
@@ -1,22 +0,0 @@
1
- {
2
- "name": "Ruby2html",
3
- "icons": [
4
- {
5
- "src": "/icon.png",
6
- "type": "image/png",
7
- "sizes": "512x512"
8
- },
9
- {
10
- "src": "/icon.png",
11
- "type": "image/png",
12
- "sizes": "512x512",
13
- "purpose": "maskable"
14
- }
15
- ],
16
- "start_url": "/",
17
- "display": "standalone",
18
- "scope": "/",
19
- "description": "Ruby2html.",
20
- "theme_color": "red",
21
- "background_color": "red"
22
- }
@@ -1,26 +0,0 @@
1
- // Add a service worker for processing Web Push notifications:
2
- //
3
- // self.addEventListener("push", async (event) => {
4
- // const { title, options } = await event.data.json()
5
- // event.waitUntil(self.registration.showNotification(title, options))
6
- // })
7
- //
8
- // self.addEventListener("notificationclick", function(event) {
9
- // event.notification.close()
10
- // event.waitUntil(
11
- // clients.matchAll({ type: "window" }).then((clientList) => {
12
- // for (let i = 0; i < clientList.length; i++) {
13
- // let client = clientList[i]
14
- // let clientPath = (new URL(client.url)).pathname
15
- //
16
- // if (clientPath == event.notification.data.path && "focus" in client) {
17
- // return client.focus()
18
- // }
19
- // }
20
- //
21
- // if (clients.openWindow) {
22
- // return clients.openWindow(event.notification.data.path)
23
- // }
24
- // })
25
- // )
26
- // })
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- h1 'footer'
@@ -1 +0,0 @@
1
- <h1>Navbar</h1>
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'boot'
4
-
5
- require 'rails'
6
- # Pick the frameworks you want:
7
- require 'active_model/railtie'
8
- require 'active_job/railtie'
9
- require 'active_record/railtie'
10
- require 'active_storage/engine'
11
- require 'action_controller/railtie'
12
- require 'action_mailer/railtie'
13
- require 'action_mailbox/engine'
14
- require 'action_text/engine'
15
- require 'action_view/railtie'
16
- require 'action_cable/engine'
17
- # require "rails/test_unit/railtie"
18
-
19
- # Require the gems listed in Gemfile, including any gems
20
- # you've limited to :test, :development, or :production.
21
- Bundler.require(*Rails.groups)
22
- require_relative '../lib/gem/ruby2html'
23
-
24
- module Ruby2html
25
- class Application < Rails::Application
26
- # Initialize configuration defaults for originally generated Rails version.
27
- config.load_defaults 7.2
28
-
29
- # Please, add to the `ignore` list any other `lib` subdirectories that do
30
- # not contain `.rb` files, or that should not be reloaded or eager loaded.
31
- # Common ones are `templates`, `generators`, or `middleware`, for example.
32
- config.autoload_lib(ignore: %w[gem assets tasks])
33
-
34
- # Configuration for the application, engines, and railties goes here.
35
- #
36
- # These settings can be overridden in specific environments using the files
37
- # in config/environments, which are processed later.
38
- #
39
- # config.time_zone = "Central Time (US & Canada)"
40
- # config.eager_load_paths << Rails.root.join("extras")
41
-
42
- # Don't generate system test files.
43
- config.generators.system_tests = nil
44
- end
45
- end
data/config/boot.rb DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
-
5
- require 'bundler/setup' # Set up gems listed in the Gemfile.
6
- require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
data/config/cable.yml DELETED
@@ -1,10 +0,0 @@
1
- development:
2
- adapter: async
3
-
4
- test:
5
- adapter: test
6
-
7
- production:
8
- adapter: redis
9
- url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
- channel_prefix: ruby2html_production
@@ -1 +0,0 @@
1
- syxIQNjKjMQTCYgIrZXzklAmWupRucx5oAblyiO1h4pPn+S9KZSUmxjnZ1ntCzFRMDGgbeIAUI5WoEsnKk6uRhX1DTULIOuW4ODNbxRWkWf5WOBXF7zxu9v1b0jcfsBO8mYHRoFxulDbxhsOIS8opAH1pzhLAB65uV8w3BPuG9547t/CHvarEzipOceugWaVjK1cF4lqkB72xWz5IQ1zxJmX+pSEj36jFfhSK5bbUlnC2h/TDBYc9tEz7GZPYnHw+xrGnhayz+6pLUBmHFwwnfQjZE9VYEm4Y0vLZLjveSmvV6LX+4QsX/r6wD0gWxDdG0jarO6i7u18Vg8aLcSQRII5bTjEdyn4NuF6E61HUhkuaSBNb9hcGCX7eGOlYziZHrOZdNg8lxIrjc2gauGz0M3bWUkJ--l6VJIq9MkwuXzeWl--MuF7LY4aYyUOZwMPsBdsBQ==
data/config/database.yml DELETED
@@ -1,32 +0,0 @@
1
- # SQLite. Versions 3.8.0 and up are supported.
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem "sqlite3"
6
- #
7
- default: &default
8
- adapter: sqlite3
9
- pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
- timeout: 5000
11
-
12
- development:
13
- <<: *default
14
- database: storage/development.sqlite3
15
-
16
- # Warning: The database defined as "test" will be erased and
17
- # re-generated from your development database when you run "rake".
18
- # Do not set this db to the same as development or production.
19
- test:
20
- <<: *default
21
- database: storage/test.sqlite3
22
-
23
-
24
- # SQLite3 write its data on the local filesystem, as such it requires
25
- # persistent disks. If you are deploying to a managed service, you should
26
- # make sure it provides disk persistence, as many don't.
27
- #
28
- # Similarly, if you deploy your application as a Docker container, you must
29
- # ensure the database is located in a persisted volume.
30
- production:
31
- <<: *default
32
- # database: path/to/persistent/storage/production.sqlite3
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Load the Rails application.
4
- require_relative 'application'
5
-
6
- # Initialize the Rails application.
7
- Rails.application.initialize!
@@ -1,85 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/core_ext/integer/time'
4
-
5
- Rails.application.configure do
6
- # Settings specified here will take precedence over those in config/application.rb.
7
-
8
- # In the development environment your application's code is reloaded any time
9
- # it changes. This slows down response time but is perfect for development
10
- # since you don't have to restart the web server when you make code changes.
11
- config.enable_reloading = true
12
-
13
- # Do not eager load code on boot.
14
- config.eager_load = false
15
-
16
- # Show full error reports.
17
- config.consider_all_requests_local = true
18
-
19
- # Enable server timing.
20
- config.server_timing = true
21
-
22
- # Enable/disable caching. By default caching is disabled.
23
- # Run rails dev:cache to toggle caching.
24
- if Rails.root.join('tmp/caching-dev.txt').exist?
25
- config.action_controller.perform_caching = true
26
- config.action_controller.enable_fragment_cache_logging = true
27
-
28
- config.cache_store = :memory_store
29
- config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" }
30
- else
31
- config.action_controller.perform_caching = false
32
-
33
- config.cache_store = :null_store
34
- end
35
-
36
- # Store uploaded files on the local file system (see config/storage.yml for options).
37
- config.active_storage.service = :local
38
-
39
- # Don't care if the mailer can't send.
40
- config.action_mailer.raise_delivery_errors = false
41
-
42
- # Disable caching for Action Mailer templates even if Action Controller
43
- # caching is enabled.
44
- config.action_mailer.perform_caching = false
45
-
46
- config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
47
-
48
- # Print deprecation notices to the Rails logger.
49
- config.active_support.deprecation = :log
50
-
51
- # Raise exceptions for disallowed deprecations.
52
- config.active_support.disallowed_deprecation = :raise
53
-
54
- # Tell Active Support which deprecation messages to disallow.
55
- config.active_support.disallowed_deprecation_warnings = []
56
-
57
- # Raise an error on page load if there are pending migrations.
58
- config.active_record.migration_error = :page_load
59
-
60
- # Highlight code that triggered database queries in logs.
61
- config.active_record.verbose_query_logs = true
62
-
63
- # Highlight code that enqueued background job in logs.
64
- config.active_job.verbose_enqueue_logs = true
65
-
66
- # Suppress logger output for asset requests.
67
- config.assets.quiet = true
68
-
69
- # Raises error for missing translations.
70
- # config.i18n.raise_on_missing_translations = true
71
-
72
- # Annotate rendered view with file names.
73
- config.action_view.annotate_rendered_view_with_filenames = true
74
-
75
- # Uncomment if you wish to allow Action Cable access from any origin.
76
- # config.action_cable.disable_request_forgery_protection = true
77
-
78
- # Raise error when a before_action's only/except options reference missing actions.
79
- config.action_controller.raise_on_missing_callback_actions = true
80
-
81
- # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
82
- # config.generators.apply_rubocop_autocorrect_after_generate!
83
-
84
- config.middleware.use Ruby2html::HtmlBeautifierMiddleware
85
- end