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,40 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-*
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore pidfiles, but keep the directory.
21
+ /tmp/pids/*
22
+ !/tmp/pids/
23
+ !/tmp/pids/.keep
24
+
25
+ # Ignore uploaded files in development.
26
+ /storage/*
27
+ !/storage/.keep
28
+
29
+ /public/assets
30
+ .byebug_history
31
+
32
+ # Ignore master key for decrypting credentials and more.
33
+ /config/master.key
34
+
35
+ /public/packs
36
+ /public/packs-test
37
+ /node_modules
38
+ /yarn-error.log
39
+ yarn-debug.log*
40
+ .yarn-integrity
data/test_app/Gemfile ADDED
@@ -0,0 +1,50 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby '3.0.0'
5
+
6
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7
+ gem 'rails', '~> 6.1.1'
8
+ # Use sqlite3 as the database for Active Record
9
+ gem 'sqlite3', '~> 1.4'
10
+ # Use Puma as the app server
11
+ gem 'puma', '~> 5.0'
12
+ # Use SCSS for stylesheets
13
+ gem 'sass-rails', '>= 6'
14
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
15
+ gem 'turbolinks', '~> 5'
16
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
17
+ gem 'jbuilder', '~> 2.7'
18
+ # Use Active Model has_secure_password
19
+ # gem 'bcrypt', '~> 3.1.7'
20
+
21
+ # Use Active Storage variant
22
+ # gem 'image_processing', '~> 1.2'
23
+
24
+ group :development, :test do
25
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
26
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
27
+ end
28
+
29
+ group :development do
30
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
31
+ gem 'web-console', '>= 4.1.0'
32
+ # Display performance information such as SQL time and flame graphs for each request in your browser.
33
+ # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
34
+ gem 'rack-mini-profiler', '~> 2.0'
35
+ gem 'listen', '~> 3.3'
36
+ end
37
+
38
+ group :test do
39
+ # Adds support for Capybara system testing and selenium driver
40
+ gem 'capybara', '>= 3.26'
41
+ gem 'selenium-webdriver'
42
+ # Easy installation and use of web drivers to run system tests with browsers
43
+ # gem 'webdrivers' # yields 'cannot load such file -- rexml/document'
44
+ end
45
+
46
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
47
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
48
+
49
+ gem "mobility", '~> 1.1'
50
+ gem "mobility-actiontext", path: '..'
@@ -0,0 +1,221 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ mobility-actiontext (0.1.0)
5
+ mobility (~> 1.1)
6
+ rails (~> 6.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (6.1.3)
12
+ actionpack (= 6.1.3)
13
+ activesupport (= 6.1.3)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailbox (6.1.3)
17
+ actionpack (= 6.1.3)
18
+ activejob (= 6.1.3)
19
+ activerecord (= 6.1.3)
20
+ activestorage (= 6.1.3)
21
+ activesupport (= 6.1.3)
22
+ mail (>= 2.7.1)
23
+ actionmailer (6.1.3)
24
+ actionpack (= 6.1.3)
25
+ actionview (= 6.1.3)
26
+ activejob (= 6.1.3)
27
+ activesupport (= 6.1.3)
28
+ mail (~> 2.5, >= 2.5.4)
29
+ rails-dom-testing (~> 2.0)
30
+ actionpack (6.1.3)
31
+ actionview (= 6.1.3)
32
+ activesupport (= 6.1.3)
33
+ rack (~> 2.0, >= 2.0.9)
34
+ rack-test (>= 0.6.3)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
+ actiontext (6.1.3)
38
+ actionpack (= 6.1.3)
39
+ activerecord (= 6.1.3)
40
+ activestorage (= 6.1.3)
41
+ activesupport (= 6.1.3)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (6.1.3)
44
+ activesupport (= 6.1.3)
45
+ builder (~> 3.1)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ activejob (6.1.3)
50
+ activesupport (= 6.1.3)
51
+ globalid (>= 0.3.6)
52
+ activemodel (6.1.3)
53
+ activesupport (= 6.1.3)
54
+ activerecord (6.1.3)
55
+ activemodel (= 6.1.3)
56
+ activesupport (= 6.1.3)
57
+ activestorage (6.1.3)
58
+ actionpack (= 6.1.3)
59
+ activejob (= 6.1.3)
60
+ activerecord (= 6.1.3)
61
+ activesupport (= 6.1.3)
62
+ marcel (~> 0.3.1)
63
+ mimemagic (~> 0.3.2)
64
+ activesupport (6.1.3)
65
+ concurrent-ruby (~> 1.0, >= 1.0.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ zeitwerk (~> 2.3)
70
+ addressable (2.7.0)
71
+ public_suffix (>= 2.0.2, < 5.0)
72
+ bindex (0.8.1)
73
+ builder (3.2.4)
74
+ byebug (11.1.3)
75
+ capybara (3.35.3)
76
+ addressable
77
+ mini_mime (>= 0.1.3)
78
+ nokogiri (~> 1.8)
79
+ rack (>= 1.6.0)
80
+ rack-test (>= 0.6.3)
81
+ regexp_parser (>= 1.5, < 3.0)
82
+ xpath (~> 3.2)
83
+ childprocess (3.0.0)
84
+ concurrent-ruby (1.1.8)
85
+ crass (1.0.6)
86
+ erubi (1.10.0)
87
+ ffi (1.14.2)
88
+ globalid (0.4.2)
89
+ activesupport (>= 4.2.0)
90
+ i18n (1.8.9)
91
+ concurrent-ruby (~> 1.0)
92
+ jbuilder (2.11.2)
93
+ activesupport (>= 5.0.0)
94
+ listen (3.4.1)
95
+ rb-fsevent (~> 0.10, >= 0.10.3)
96
+ rb-inotify (~> 0.9, >= 0.9.10)
97
+ loofah (2.9.0)
98
+ crass (~> 1.0.2)
99
+ nokogiri (>= 1.5.9)
100
+ mail (2.7.1)
101
+ mini_mime (>= 0.1.1)
102
+ marcel (0.3.3)
103
+ mimemagic (~> 0.3.2)
104
+ method_source (1.0.0)
105
+ mimemagic (0.3.5)
106
+ mini_mime (1.0.2)
107
+ minitest (5.14.3)
108
+ mobility (1.1.1)
109
+ i18n (>= 0.6.10, < 2)
110
+ request_store (~> 1.0)
111
+ nio4r (2.5.5)
112
+ nokogiri (1.11.1-x86_64-darwin)
113
+ racc (~> 1.4)
114
+ public_suffix (4.0.6)
115
+ puma (5.2.1)
116
+ nio4r (~> 2.0)
117
+ racc (1.5.2)
118
+ rack (2.2.3)
119
+ rack-mini-profiler (2.3.1)
120
+ rack (>= 1.2.0)
121
+ rack-test (1.1.0)
122
+ rack (>= 1.0, < 3)
123
+ rails (6.1.3)
124
+ actioncable (= 6.1.3)
125
+ actionmailbox (= 6.1.3)
126
+ actionmailer (= 6.1.3)
127
+ actionpack (= 6.1.3)
128
+ actiontext (= 6.1.3)
129
+ actionview (= 6.1.3)
130
+ activejob (= 6.1.3)
131
+ activemodel (= 6.1.3)
132
+ activerecord (= 6.1.3)
133
+ activestorage (= 6.1.3)
134
+ activesupport (= 6.1.3)
135
+ bundler (>= 1.15.0)
136
+ railties (= 6.1.3)
137
+ sprockets-rails (>= 2.0.0)
138
+ rails-dom-testing (2.0.3)
139
+ activesupport (>= 4.2.0)
140
+ nokogiri (>= 1.6)
141
+ rails-html-sanitizer (1.3.0)
142
+ loofah (~> 2.3)
143
+ railties (6.1.3)
144
+ actionpack (= 6.1.3)
145
+ activesupport (= 6.1.3)
146
+ method_source
147
+ rake (>= 0.8.7)
148
+ thor (~> 1.0)
149
+ rake (13.0.3)
150
+ rb-fsevent (0.10.4)
151
+ rb-inotify (0.10.1)
152
+ ffi (~> 1.0)
153
+ regexp_parser (2.1.0)
154
+ request_store (1.5.0)
155
+ rack (>= 1.4)
156
+ rubyzip (2.3.0)
157
+ sass-rails (6.0.0)
158
+ sassc-rails (~> 2.1, >= 2.1.1)
159
+ sassc (2.4.0)
160
+ ffi (~> 1.9)
161
+ sassc-rails (2.1.2)
162
+ railties (>= 4.0.0)
163
+ sassc (>= 2.0)
164
+ sprockets (> 3.0)
165
+ sprockets-rails
166
+ tilt
167
+ selenium-webdriver (3.142.7)
168
+ childprocess (>= 0.5, < 4.0)
169
+ rubyzip (>= 1.2.2)
170
+ sprockets (4.0.2)
171
+ concurrent-ruby (~> 1.0)
172
+ rack (> 1, < 3)
173
+ sprockets-rails (3.2.2)
174
+ actionpack (>= 4.0)
175
+ activesupport (>= 4.0)
176
+ sprockets (>= 3.0.0)
177
+ sqlite3 (1.4.2)
178
+ thor (1.1.0)
179
+ tilt (2.0.10)
180
+ turbolinks (5.2.1)
181
+ turbolinks-source (~> 5.2)
182
+ turbolinks-source (5.2.0)
183
+ tzinfo (2.0.4)
184
+ concurrent-ruby (~> 1.0)
185
+ web-console (4.1.0)
186
+ actionview (>= 6.0.0)
187
+ activemodel (>= 6.0.0)
188
+ bindex (>= 0.4.0)
189
+ railties (>= 6.0.0)
190
+ websocket-driver (0.7.3)
191
+ websocket-extensions (>= 0.1.0)
192
+ websocket-extensions (0.1.5)
193
+ xpath (3.2.0)
194
+ nokogiri (~> 1.8)
195
+ zeitwerk (2.4.2)
196
+
197
+ PLATFORMS
198
+ x86_64-darwin-20
199
+
200
+ DEPENDENCIES
201
+ byebug
202
+ capybara (>= 3.26)
203
+ jbuilder (~> 2.7)
204
+ listen (~> 3.3)
205
+ mobility (~> 1.1)
206
+ mobility-actiontext!
207
+ puma (~> 5.0)
208
+ rack-mini-profiler (~> 2.0)
209
+ rails (~> 6.1.1)
210
+ sass-rails (>= 6)
211
+ selenium-webdriver
212
+ sqlite3 (~> 1.4)
213
+ turbolinks (~> 5)
214
+ tzinfo-data
215
+ web-console (>= 4.1.0)
216
+
217
+ RUBY VERSION
218
+ ruby 3.0.0p0
219
+
220
+ BUNDLED WITH
221
+ 2.2.5
data/test_app/Rakefile ADDED
@@ -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
@@ -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,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Post < ApplicationRecord
4
+ extend Mobility
5
+ translates :title, plain: true
6
+ translates :content
7
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Mobility::ActionText</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -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