mobility-actiontext 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +18 -0
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +4 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +152 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +91 -0
  9. data/Rakefile +1 -0
  10. data/lib/mobility/action_text.rb +4 -0
  11. data/lib/mobility/action_text/version.rb +7 -0
  12. data/lib/mobility/backends/action_text.rb +98 -0
  13. data/mobility-actiontext.gemspec +33 -0
  14. data/test_app/.gitignore +40 -0
  15. data/test_app/Gemfile +50 -0
  16. data/test_app/Gemfile.lock +221 -0
  17. data/test_app/Rakefile +6 -0
  18. data/test_app/app/assets/config/manifest.js +2 -0
  19. data/test_app/app/assets/stylesheets/application.css +15 -0
  20. data/test_app/app/controllers/application_controller.rb +2 -0
  21. data/test_app/app/helpers/application_helper.rb +2 -0
  22. data/test_app/app/models/application_record.rb +3 -0
  23. data/test_app/app/models/post.rb +7 -0
  24. data/test_app/app/views/layouts/application.html.erb +15 -0
  25. data/test_app/bin/bundle +114 -0
  26. data/test_app/bin/rails +4 -0
  27. data/test_app/bin/rake +4 -0
  28. data/test_app/bin/setup +33 -0
  29. data/test_app/config.ru +6 -0
  30. data/test_app/config/application.rb +35 -0
  31. data/test_app/config/boot.rb +3 -0
  32. data/test_app/config/credentials.yml.enc +1 -0
  33. data/test_app/config/database.yml +25 -0
  34. data/test_app/config/environment.rb +5 -0
  35. data/test_app/config/environments/development.rb +71 -0
  36. data/test_app/config/environments/production.rb +106 -0
  37. data/test_app/config/environments/test.rb +52 -0
  38. data/test_app/config/initializers/application_controller_renderer.rb +8 -0
  39. data/test_app/config/initializers/assets.rb +14 -0
  40. data/test_app/config/initializers/backtrace_silencers.rb +8 -0
  41. data/test_app/config/initializers/content_security_policy.rb +30 -0
  42. data/test_app/config/initializers/cookies_serializer.rb +5 -0
  43. data/test_app/config/initializers/filter_parameter_logging.rb +6 -0
  44. data/test_app/config/initializers/i18n.rb +3 -0
  45. data/test_app/config/initializers/inflections.rb +16 -0
  46. data/test_app/config/initializers/mime_types.rb +4 -0
  47. data/test_app/config/initializers/mobility.rb +15 -0
  48. data/test_app/config/initializers/permissions_policy.rb +11 -0
  49. data/test_app/config/initializers/wrap_parameters.rb +14 -0
  50. data/test_app/config/locales/en.yml +33 -0
  51. data/test_app/config/puma.rb +43 -0
  52. data/test_app/config/routes.rb +3 -0
  53. data/test_app/config/storage.yml +34 -0
  54. data/test_app/db/migrate/20210114124021_create_active_storage_tables.active_storage.rb +39 -0
  55. data/test_app/db/migrate/20210114124022_create_action_text_tables.action_text.rb +16 -0
  56. data/test_app/db/migrate/20210114124951_translate_rich_texts.rb +17 -0
  57. data/test_app/db/migrate/20210114125134_create_posts.rb +7 -0
  58. data/test_app/db/schema.rb +64 -0
  59. data/test_app/db/seeds.rb +7 -0
  60. data/test_app/public/404.html +67 -0
  61. data/test_app/public/422.html +67 -0
  62. data/test_app/public/500.html +66 -0
  63. data/test_app/public/apple-touch-icon-precomposed.png +0 -0
  64. data/test_app/public/apple-touch-icon.png +0 -0
  65. data/test_app/public/favicon.ico +0 -0
  66. data/test_app/public/robots.txt +1 -0
  67. data/test_app/test/application_system_test_case.rb +5 -0
  68. data/test_app/test/fixtures/action_text/rich_texts.yml +35 -0
  69. data/test_app/test/fixtures/posts.yml +3 -0
  70. data/test_app/test/mobility_action_text_test.rb +108 -0
  71. data/test_app/test/test_helper.rb +28 -0
  72. metadata +158 -0
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
data/test_app/bin/rake ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "rake"
4
+ Rake.application.run
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path('..', __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?('config/database.yml')
22
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! 'bin/rails db:prepare'
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! 'bin/rails log:clear tmp:clear'
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! 'bin/rails restart'
33
+ end
@@ -0,0 +1,6 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative "config/environment"
4
+
5
+ run Rails.application
6
+ Rails.application.load_server
@@ -0,0 +1,35 @@
1
+ require_relative "boot"
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ # require "active_job/railtie"
7
+ require "active_record/railtie"
8
+ require "active_storage/engine"
9
+ require "action_controller/railtie"
10
+ # require "action_mailer/railtie"
11
+ # require "action_mailbox/engine"
12
+ require "action_text/engine"
13
+ require "action_view/railtie"
14
+ # require "action_cable/engine"
15
+ require "sprockets/railtie"
16
+ require "rails/test_unit/railtie"
17
+
18
+ # Require the gems listed in Gemfile, including any gems
19
+ # you've limited to :test, :development, or :production.
20
+ Bundler.require(*Rails.groups)
21
+
22
+ module MobilityActiontext
23
+ class Application < Rails::Application
24
+ # Initialize configuration defaults for originally generated Rails version.
25
+ config.load_defaults 6.1
26
+
27
+ # Configuration for the application, engines, and railties goes here.
28
+ #
29
+ # These settings can be overridden in specific environments using the files
30
+ # in config/environments, which are processed later.
31
+ #
32
+ # config.time_zone = "Central Time (US & Canada)"
33
+ # config.eager_load_paths << Rails.root.join("extras")
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
@@ -0,0 +1 @@
1
+ 9jLDvhF9npBPxMrz2/Ztr40Q/taoDSCEQLcIlhLfcAPSWcVVAIq024pAGTYTl3tj3nwTD2p3ENMidiq+m8O2cIVxF6wo0HGSmK/pLnOry9awpg0e6mBatD+6F8QzHv/Ejm+zkJRuxSx0x6BemW2oGV6xder8HwBItGouLS1lF/jUa1/EfFEDOWyFljHNitFXV85YKLNB9/PF8qR10E3PB29a0QAtcxSGlCZdNXFTSLx6A2yn02LQDcN2q8iEwwa8YXgRkHY8HDZ1urS6jRTazhiqaOu6UqMCHmHvWfoikylPdv16qkISIFJF261cbhnSp4EM9sZJqRtqjMzxR1IUVsFZd/KVyvbEccGvRH3agJnCyibtLnndiHmeC3QWzb0JtbE4uNttwRgc4roLY0nFDBd2SSlMDcqLQoUG--W2y5KIOOtUNYsbDQ--haOyc/Lp8hD/2sERHnPCuQ==
@@ -0,0 +1,25 @@
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: db/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: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative "application"
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,71 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded any time
7
+ # it changes. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable/disable caching. By default caching is disabled.
18
+ # Run rails dev:cache to toggle caching.
19
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
20
+ config.action_controller.perform_caching = true
21
+ config.action_controller.enable_fragment_cache_logging = true
22
+
23
+ config.cache_store = :memory_store
24
+ config.public_file_server.headers = {
25
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
26
+ }
27
+ else
28
+ config.action_controller.perform_caching = false
29
+
30
+ config.cache_store = :null_store
31
+ end
32
+
33
+ # Store uploaded files on the local file system (see config/storage.yml for options).
34
+ config.active_storage.service = :local
35
+
36
+ # Print deprecation notices to the Rails logger.
37
+ config.active_support.deprecation = :log
38
+
39
+ # Raise exceptions for disallowed deprecations.
40
+ config.active_support.disallowed_deprecation = :raise
41
+
42
+ # Tell Active Support which deprecation messages to disallow.
43
+ config.active_support.disallowed_deprecation_warnings = []
44
+
45
+ # Raise an error on page load if there are pending migrations.
46
+ config.active_record.migration_error = :page_load
47
+
48
+ # Highlight code that triggered database queries in logs.
49
+ config.active_record.verbose_query_logs = true
50
+
51
+ # Debug mode disables concatenation and preprocessing of assets.
52
+ # This option may cause significant delays in view rendering with a large
53
+ # number of complex assets.
54
+ config.assets.debug = true
55
+
56
+ # Suppress logger output for asset requests.
57
+ config.assets.quiet = true
58
+
59
+ # Raises error for missing translations.
60
+ # config.i18n.raise_on_missing_translations = true
61
+
62
+ # Annotate rendered view with file names.
63
+ # config.action_view.annotate_rendered_view_with_filenames = true
64
+
65
+ # Use an evented file watcher to asynchronously detect changes in source code,
66
+ # routes, locales, etc. This feature depends on the listen gem.
67
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
68
+
69
+ # Uncomment if you wish to allow Action Cable access from any origin.
70
+ # config.action_cable.disable_request_forgery_protection = true
71
+ end
@@ -0,0 +1,106 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # Code is not reloaded between requests.
7
+ config.cache_classes = true
8
+
9
+ # Eager load code on boot. This eager loads most of Rails and
10
+ # your application in memory, allowing both threaded web servers
11
+ # and those relying on copy on write to perform better.
12
+ # Rake tasks automatically ignore this option for performance.
13
+ config.eager_load = true
14
+
15
+ # Full error reports are disabled and caching is turned on.
16
+ config.consider_all_requests_local = false
17
+ config.action_controller.perform_caching = true
18
+
19
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21
+ # config.require_master_key = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
+
27
+ # Compress CSS using a preprocessor.
28
+ # config.assets.css_compressor = :sass
29
+
30
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
31
+ config.assets.compile = false
32
+
33
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
34
+ # config.asset_host = 'http://assets.example.com'
35
+
36
+ # Specifies the header that your server uses for sending files.
37
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
38
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
39
+
40
+ # Store uploaded files on the local file system (see config/storage.yml for options).
41
+ config.active_storage.service = :local
42
+
43
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
44
+ # config.force_ssl = true
45
+
46
+ # Include generic and useful information about system operation, but avoid logging too much
47
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
48
+ config.log_level = :info
49
+
50
+ # Prepend all log lines with the following tags.
51
+ config.log_tags = [ :request_id ]
52
+
53
+ # Use a different cache store in production.
54
+ # config.cache_store = :mem_cache_store
55
+
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation cannot be found).
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners.
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log disallowed deprecations.
65
+ config.active_support.disallowed_deprecation = :log
66
+
67
+ # Tell Active Support which deprecation messages to disallow.
68
+ config.active_support.disallowed_deprecation_warnings = []
69
+
70
+ # Use default logging formatter so that PID and timestamp are not suppressed.
71
+ config.log_formatter = ::Logger::Formatter.new
72
+
73
+ # Use a different logger for distributed setups.
74
+ # require "syslog/logger"
75
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
76
+
77
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
78
+ logger = ActiveSupport::Logger.new(STDOUT)
79
+ logger.formatter = config.log_formatter
80
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
81
+ end
82
+
83
+ # Do not dump schema after migrations.
84
+ config.active_record.dump_schema_after_migration = false
85
+
86
+ # Inserts middleware to perform automatic connection switching.
87
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
88
+ # middleware. The `delay` is used to determine how long to wait after a write
89
+ # to send a subsequent read to the primary.
90
+ #
91
+ # The `database_resolver` class is used by the middleware to determine which
92
+ # database is appropriate to use based on the time delay.
93
+ #
94
+ # The `database_resolver_context` class is used by the middleware to set
95
+ # timestamps for the last write to the primary. The resolver uses the context
96
+ # class timestamps to determine how long to wait before reading from the
97
+ # replica.
98
+ #
99
+ # By default Rails will store a last write timestamp in the session. The
100
+ # DatabaseSelector middleware is designed as such you can define your own
101
+ # strategy for connection switching and pass that into the middleware through
102
+ # these configuration options.
103
+ # config.active_record.database_selector = { delay: 2.seconds }
104
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
105
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
106
+ end
@@ -0,0 +1,52 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+
8
+ Rails.application.configure do
9
+ # Settings specified here will take precedence over those in config/application.rb.
10
+
11
+ config.cache_classes = true
12
+
13
+ # Do not eager load code on boot. This avoids loading your whole application
14
+ # just for the purpose of running a single test. If you are using a tool that
15
+ # preloads Rails for running tests, you may have to set it to true.
16
+ config.eager_load = false
17
+
18
+ # Configure public file server for tests with Cache-Control for performance.
19
+ config.public_file_server.enabled = true
20
+ config.public_file_server.headers = {
21
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
22
+ }
23
+
24
+ # Show full error reports and disable caching.
25
+ config.consider_all_requests_local = true
26
+ config.action_controller.perform_caching = false
27
+ config.cache_store = :null_store
28
+
29
+ # Raise exceptions instead of rendering exception templates.
30
+ config.action_dispatch.show_exceptions = false
31
+
32
+ # Disable request forgery protection in test environment.
33
+ config.action_controller.allow_forgery_protection = false
34
+
35
+ # Store uploaded files on the local file system in a temporary directory.
36
+ config.active_storage.service = :test
37
+
38
+ # Print deprecation notices to the stderr.
39
+ config.active_support.deprecation = :stderr
40
+
41
+ # Raise exceptions for disallowed deprecations.
42
+ config.active_support.disallowed_deprecation = :raise
43
+
44
+ # Tell Active Support which deprecation messages to disallow.
45
+ config.active_support.disallowed_deprecation_warnings = []
46
+
47
+ # Raises error for missing translations.
48
+ # config.i18n.raise_on_missing_translations = true
49
+
50
+ # Annotate rendered view with file names.
51
+ # config.action_view.annotate_rendered_view_with_filenames = true
52
+ end
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # ActiveSupport::Reloader.to_prepare do
4
+ # ApplicationController.renderer.defaults.merge!(
5
+ # http_host: 'example.org',
6
+ # https: false
7
+ # )
8
+ # end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path.
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+ # Add Yarn node_modules folder to the asset load path.
9
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
10
+
11
+ # Precompile additional assets.
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
7
+ # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
8
+ Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
@@ -0,0 +1,30 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy
4
+ # For further information see the following documentation
5
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
+
7
+ # Rails.application.config.content_security_policy do |policy|
8
+ # policy.default_src :self, :https
9
+ # policy.font_src :self, :https, :data
10
+ # policy.img_src :self, :https, :data
11
+ # policy.object_src :none
12
+ # policy.script_src :self, :https
13
+ # policy.style_src :self, :https
14
+ # # If you are using webpack-dev-server then specify webpack-dev-server host
15
+ # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
16
+
17
+ # # Specify URI for violation reports
18
+ # # policy.report_uri "/csp-violation-report-endpoint"
19
+ # end
20
+
21
+ # If you are using UJS then enable automatic nonce generation
22
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
23
+
24
+ # Set the nonce only to specific directives
25
+ # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
26
+
27
+ # Report CSP violations to a specified URI
28
+ # For further information see the following documentation:
29
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
30
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Specify a serializer for the signed and encrypted cookie jars.
4
+ # Valid options are :json, :marshal, and :hybrid.
5
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,6 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [
5
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
6
+ ]