wovnrb 2.2.3 → 3.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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +5 -0
  3. data/README.en.md +198 -0
  4. data/README.ja.md +180 -0
  5. data/README.md +1 -0
  6. data/docker/docker-compose.yml +11 -0
  7. data/docker/rails/Dockerfile +6 -0
  8. data/docker/rails/TestSite/.browserslistrc +1 -0
  9. data/docker/rails/TestSite/.gitignore +63 -0
  10. data/docker/rails/TestSite/Gemfile +56 -0
  11. data/docker/rails/TestSite/README.md +24 -0
  12. data/docker/rails/TestSite/Rakefile +6 -0
  13. data/docker/rails/TestSite/app/assets/config/manifest.js +2 -0
  14. data/docker/rails/TestSite/app/assets/images/.keep +0 -0
  15. data/docker/rails/TestSite/app/assets/stylesheets/application.css +15 -0
  16. data/docker/rails/TestSite/app/assets/stylesheets/redirects.scss +3 -0
  17. data/docker/rails/TestSite/app/channels/application_cable/channel.rb +4 -0
  18. data/docker/rails/TestSite/app/channels/application_cable/connection.rb +4 -0
  19. data/docker/rails/TestSite/app/controllers/application_controller.rb +2 -0
  20. data/docker/rails/TestSite/app/controllers/concerns/.keep +0 -0
  21. data/docker/rails/TestSite/app/controllers/pages_controller.rb +7 -0
  22. data/docker/rails/TestSite/app/controllers/redirects_controller.rb +5 -0
  23. data/docker/rails/TestSite/app/helpers/application_helper.rb +2 -0
  24. data/docker/rails/TestSite/app/helpers/pages_helper.rb +2 -0
  25. data/docker/rails/TestSite/app/helpers/redirects_helper.rb +2 -0
  26. data/docker/rails/TestSite/app/javascript/channels/consumer.js +6 -0
  27. data/docker/rails/TestSite/app/javascript/channels/index.js +5 -0
  28. data/docker/rails/TestSite/app/javascript/packs/application.js +17 -0
  29. data/docker/rails/TestSite/app/jobs/application_job.rb +7 -0
  30. data/docker/rails/TestSite/app/mailers/application_mailer.rb +4 -0
  31. data/docker/rails/TestSite/app/models/application_record.rb +3 -0
  32. data/docker/rails/TestSite/app/models/concerns/.keep +0 -0
  33. data/docker/rails/TestSite/app/views/layouts/application.html.erb +15 -0
  34. data/docker/rails/TestSite/app/views/layouts/mailer.html.erb +13 -0
  35. data/docker/rails/TestSite/app/views/layouts/mailer.text.erb +1 -0
  36. data/docker/rails/TestSite/babel.config.js +72 -0
  37. data/docker/rails/TestSite/bin/bundle +114 -0
  38. data/docker/rails/TestSite/bin/rails +4 -0
  39. data/docker/rails/TestSite/bin/rake +4 -0
  40. data/docker/rails/TestSite/bin/setup +36 -0
  41. data/docker/rails/TestSite/bin/webpack +18 -0
  42. data/docker/rails/TestSite/bin/webpack-dev-server +18 -0
  43. data/docker/rails/TestSite/bin/yarn +11 -0
  44. data/docker/rails/TestSite/config.ru +5 -0
  45. data/docker/rails/TestSite/config/application.rb +26 -0
  46. data/docker/rails/TestSite/config/boot.rb +4 -0
  47. data/docker/rails/TestSite/config/cable.yml +10 -0
  48. data/docker/rails/TestSite/config/credentials.yml.enc +1 -0
  49. data/docker/rails/TestSite/config/database.yml +25 -0
  50. data/docker/rails/TestSite/config/environment.rb +5 -0
  51. data/docker/rails/TestSite/config/environments/development.rb +62 -0
  52. data/docker/rails/TestSite/config/environments/production.rb +112 -0
  53. data/docker/rails/TestSite/config/environments/test.rb +49 -0
  54. data/docker/rails/TestSite/config/initializers/application_controller_renderer.rb +8 -0
  55. data/docker/rails/TestSite/config/initializers/assets.rb +14 -0
  56. data/docker/rails/TestSite/config/initializers/backtrace_silencers.rb +7 -0
  57. data/docker/rails/TestSite/config/initializers/content_security_policy.rb +30 -0
  58. data/docker/rails/TestSite/config/initializers/cookies_serializer.rb +5 -0
  59. data/docker/rails/TestSite/config/initializers/filter_parameter_logging.rb +4 -0
  60. data/docker/rails/TestSite/config/initializers/inflections.rb +16 -0
  61. data/docker/rails/TestSite/config/initializers/mime_types.rb +4 -0
  62. data/docker/rails/TestSite/config/initializers/wrap_parameters.rb +14 -0
  63. data/docker/rails/TestSite/config/locales/en.yml +33 -0
  64. data/docker/rails/TestSite/config/puma.rb +38 -0
  65. data/docker/rails/TestSite/config/routes.rb +4 -0
  66. data/docker/rails/TestSite/config/spring.rb +6 -0
  67. data/docker/rails/TestSite/config/storage.yml +34 -0
  68. data/docker/rails/TestSite/config/webpack/development.js +5 -0
  69. data/docker/rails/TestSite/config/webpack/environment.js +3 -0
  70. data/docker/rails/TestSite/config/webpack/production.js +5 -0
  71. data/docker/rails/TestSite/config/webpack/test.js +5 -0
  72. data/docker/rails/TestSite/config/webpacker.yml +96 -0
  73. data/docker/rails/TestSite/db/seeds.rb +7 -0
  74. data/docker/rails/TestSite/lib/assets/.keep +0 -0
  75. data/docker/rails/TestSite/lib/tasks/.keep +0 -0
  76. data/docker/rails/TestSite/log/.keep +0 -0
  77. data/docker/rails/TestSite/package.json +15 -0
  78. data/docker/rails/TestSite/postcss.config.js +12 -0
  79. data/docker/rails/TestSite/public/index.html +9 -0
  80. data/docker/rails/TestSite/public/page.html +13 -0
  81. data/docker/rails/TestSite/public/pages/files/plaintext_unicode.txt +204 -0
  82. data/docker/rails/TestSite/public/pages/files/simple_css.css +8 -0
  83. data/docker/rails/TestSite/public/pages/files/simple_javascript.js +2 -0
  84. data/docker/rails/TestSite/public/pages/html5test.html +555 -0
  85. data/docker/rails/TestSite/public/pages/oldhtml.html +335 -0
  86. data/docker/rails/TestSite/public/pages/xhtml.xhtml +726 -0
  87. data/docker/rails/TestSite/public/redirection_target.html +10 -0
  88. data/docker/rails/TestSite/public/testdir/testpage-dir.html +9 -0
  89. data/docker/rails/TestSite/public/testdir/testpage-redirect-destination.html +9 -0
  90. data/docker/rails/TestSite/public/testpage.html +9 -0
  91. data/docker/rails/TestSite/public/wovn_index.html +24 -0
  92. data/docker/rails/TestSite/start.sh +13 -0
  93. data/docker/rails/TestSite/storage/.keep +0 -0
  94. data/docker/rails/TestSite/test/application_system_test_case.rb +5 -0
  95. data/docker/rails/TestSite/test/channels/application_cable/connection_test.rb +11 -0
  96. data/docker/rails/TestSite/test/controllers/.keep +0 -0
  97. data/docker/rails/TestSite/test/controllers/pages_controller_test.rb +7 -0
  98. data/docker/rails/TestSite/test/controllers/redirects_controller_test.rb +7 -0
  99. data/docker/rails/TestSite/test/fixtures/.keep +0 -0
  100. data/docker/rails/TestSite/test/fixtures/files/.keep +0 -0
  101. data/docker/rails/TestSite/test/helpers/.keep +0 -0
  102. data/docker/rails/TestSite/test/integration/.keep +0 -0
  103. data/docker/rails/TestSite/test/mailers/.keep +0 -0
  104. data/docker/rails/TestSite/test/models/.keep +0 -0
  105. data/docker/rails/TestSite/test/system/.keep +0 -0
  106. data/docker/rails/TestSite/test/test_helper.rb +13 -0
  107. data/docker/rails/TestSite/yarn.lock +7642 -0
  108. data/lib/wovnrb.rb +1 -1
  109. data/lib/wovnrb/api_translator.rb +1 -1
  110. data/lib/wovnrb/headers.rb +1 -23
  111. data/lib/wovnrb/lang.rb +77 -40
  112. data/lib/wovnrb/railtie.rb +1 -15
  113. data/lib/wovnrb/services/html_converter.rb +9 -10
  114. data/lib/wovnrb/store.rb +3 -3
  115. data/lib/wovnrb/version.rb +1 -1
  116. data/makefile +16 -0
  117. data/test/lib/headers_test.rb +7 -25
  118. data/test/lib/lang_test.rb +10 -40
  119. data/test/lib/services/html_converter_test.rb +39 -17
  120. data/test/lib/store_test.rb +2 -1
  121. data/wovnrb.gemspec +3 -3
  122. metadata +114 -11
  123. data/README.md +0 -182
@@ -0,0 +1,56 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby '2.6.5'
5
+
6
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7
+ gem 'rails', '~> 6.0.3', '>= 6.0.3.2'
8
+ # Use sqlite3 as the database for Active Record
9
+ gem 'sqlite3', '~> 1.4'
10
+ # Use Puma as the app server
11
+ gem 'puma', '~> 4.1'
12
+ # Use SCSS for stylesheets
13
+ gem 'sass-rails', '>= 6'
14
+ # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
15
+ gem 'webpacker', '~> 4.0'
16
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
17
+ gem 'turbolinks', '~> 5'
18
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
19
+ gem 'jbuilder', '~> 2.7'
20
+ # Use Redis adapter to run Action Cable in production
21
+ # gem 'redis', '~> 4.0'
22
+ # Use Active Model has_secure_password
23
+ # gem 'bcrypt', '~> 3.1.7'
24
+
25
+ # Use Active Storage variant
26
+ # gem 'image_processing', '~> 1.2'
27
+
28
+ # Reduces boot times through caching; required in config/boot.rb
29
+ gem 'bootsnap', '>= 1.4.2', require: false
30
+
31
+ group :development, :test do
32
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
33
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
34
+ end
35
+
36
+ group :development do
37
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
38
+ gem 'web-console', '>= 3.3.0'
39
+ gem 'listen', '~> 3.2'
40
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
41
+ gem 'spring'
42
+ gem 'spring-watcher-listen', '~> 2.0.0'
43
+ end
44
+
45
+ group :test do
46
+ # Adds support for Capybara system testing and selenium driver
47
+ gem 'capybara', '>= 2.15'
48
+ gem 'selenium-webdriver'
49
+ # Easy installation and use of web drivers to run system tests with browsers
50
+ gem 'webdrivers'
51
+ end
52
+
53
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
54
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
55
+
56
+ gem 'wovnrb', path: './wovnrb'
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the redirects controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,7 @@
1
+ class PagesController < ApplicationController
2
+ skip_before_action :verify_authenticity_token
3
+
4
+ def show
5
+ render file: "#{Rails.root}/public/#{params[:page]}.html", layout: false
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class RedirectsController < ApplicationController
2
+ def show
3
+ redirect_to '/redirection_target'
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PagesHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module RedirectsHelper
2
+ end
@@ -0,0 +1,6 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3
+
4
+ import { createConsumer } from "@rails/actioncable"
5
+
6
+ export default createConsumer()
@@ -0,0 +1,5 @@
1
+ // Load all the channels within this directory and all subdirectories.
2
+ // Channel files must be named *_channel.js.
3
+
4
+ const channels = require.context('.', true, /_channel\.js$/)
5
+ channels.keys().forEach(channels)
@@ -0,0 +1,17 @@
1
+ // This file is automatically compiled by Webpack, along with any other files
2
+ // present in this directory. You're encouraged to place your actual application logic in
3
+ // a relevant structure within app/javascript and only use these pack files to reference
4
+ // that code so it'll be compiled.
5
+
6
+ require("@rails/ujs").start()
7
+ require("turbolinks").start()
8
+ require("@rails/activestorage").start()
9
+ require("channels")
10
+
11
+
12
+ // Uncomment to copy all static images under ../images to the output folder and reference
13
+ // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
14
+ // or the `imagePath` JavaScript helper below.
15
+ //
16
+ // const images = require.context('../images', true)
17
+ // const imagePath = (name) => images(name, true)
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
File without changes
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestSite</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,13 @@
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>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,72 @@
1
+ module.exports = function(api) {
2
+ var validEnv = ['development', 'test', 'production']
3
+ var currentEnv = api.env()
4
+ var isDevelopmentEnv = api.env('development')
5
+ var isProductionEnv = api.env('production')
6
+ var isTestEnv = api.env('test')
7
+
8
+ if (!validEnv.includes(currentEnv)) {
9
+ throw new Error(
10
+ 'Please specify a valid `NODE_ENV` or ' +
11
+ '`BABEL_ENV` environment variables. Valid values are "development", ' +
12
+ '"test", and "production". Instead, received: ' +
13
+ JSON.stringify(currentEnv) +
14
+ '.'
15
+ )
16
+ }
17
+
18
+ return {
19
+ presets: [
20
+ isTestEnv && [
21
+ '@babel/preset-env',
22
+ {
23
+ targets: {
24
+ node: 'current'
25
+ }
26
+ }
27
+ ],
28
+ (isProductionEnv || isDevelopmentEnv) && [
29
+ '@babel/preset-env',
30
+ {
31
+ forceAllTransforms: true,
32
+ useBuiltIns: 'entry',
33
+ corejs: 3,
34
+ modules: false,
35
+ exclude: ['transform-typeof-symbol']
36
+ }
37
+ ]
38
+ ].filter(Boolean),
39
+ plugins: [
40
+ 'babel-plugin-macros',
41
+ '@babel/plugin-syntax-dynamic-import',
42
+ isTestEnv && 'babel-plugin-dynamic-import-node',
43
+ '@babel/plugin-transform-destructuring',
44
+ [
45
+ '@babel/plugin-proposal-class-properties',
46
+ {
47
+ loose: true
48
+ }
49
+ ],
50
+ [
51
+ '@babel/plugin-proposal-object-rest-spread',
52
+ {
53
+ useBuiltIns: true
54
+ }
55
+ ],
56
+ [
57
+ '@babel/plugin-transform-runtime',
58
+ {
59
+ helpers: false,
60
+ regenerator: true,
61
+ corejs: false
62
+ }
63
+ ],
64
+ [
65
+ '@babel/plugin-transform-regenerator',
66
+ {
67
+ async: false
68
+ }
69
+ ]
70
+ ].filter(Boolean)
71
+ }
72
+ }
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||=
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version
67
+ end
68
+
69
+ def bundler_requirement
70
+ return "#{Gem::Requirement.default}.a" unless bundler_version
71
+
72
+ bundler_gem_version = Gem::Version.new(bundler_version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end