interactive_record 0.0.1alpha

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 (103) hide show
  1. checksums.yaml +7 -0
  2. data/.browserslistrc +1 -0
  3. data/.gitattributes +10 -0
  4. data/.gitignore +31 -0
  5. data/.orchestration.yml +4 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +6 -0
  8. data/.ruby-version +1 -0
  9. data/Gemfile +40 -0
  10. data/Gemfile.lock +287 -0
  11. data/LICENSE.txt +21 -0
  12. data/Makefile +27 -0
  13. data/README.md +39 -0
  14. data/Rakefile +8 -0
  15. data/app/assets/config/manifest.js +2 -0
  16. data/app/assets/images/.keep +0 -0
  17. data/app/assets/stylesheets/application.css +15 -0
  18. data/app/channels/application_cable/channel.rb +6 -0
  19. data/app/channels/application_cable/connection.rb +6 -0
  20. data/app/controllers/application_controller.rb +4 -0
  21. data/app/controllers/concerns/.keep +0 -0
  22. data/app/helpers/application_helper.rb +5 -0
  23. data/app/javascript/channels/consumer.js +6 -0
  24. data/app/javascript/channels/index.js +5 -0
  25. data/app/javascript/packs/application.js +13 -0
  26. data/app/javascript/packs/hello_react.jsx +26 -0
  27. data/app/jobs/application_job.rb +9 -0
  28. data/app/mailers/application_mailer.rb +6 -0
  29. data/app/models/application_record.rb +6 -0
  30. data/app/models/concerns/.keep +0 -0
  31. data/app/views/layouts/application.html.erb +16 -0
  32. data/app/views/layouts/mailer.html.erb +13 -0
  33. data/app/views/layouts/mailer.text.erb +1 -0
  34. data/babel.config.js +87 -0
  35. data/bin/bundle +118 -0
  36. data/bin/console +15 -0
  37. data/bin/rails +7 -0
  38. data/bin/rake +7 -0
  39. data/bin/setup +38 -0
  40. data/bin/spring +16 -0
  41. data/bin/webpack +19 -0
  42. data/bin/webpack-dev-server +19 -0
  43. data/bin/yarn +19 -0
  44. data/config.ru +8 -0
  45. data/config/application.rb +24 -0
  46. data/config/boot.rb +6 -0
  47. data/config/cable.yml +10 -0
  48. data/config/credentials.yml.enc +1 -0
  49. data/config/database.yml +25 -0
  50. data/config/environment.rb +7 -0
  51. data/config/environments/development.rb +70 -0
  52. data/config/environments/production.rb +116 -0
  53. data/config/environments/test.rb +62 -0
  54. data/config/initializers/application_controller_renderer.rb +9 -0
  55. data/config/initializers/backtrace_silencers.rb +10 -0
  56. data/config/initializers/content_security_policy.rb +31 -0
  57. data/config/initializers/cookies_serializer.rb +7 -0
  58. data/config/initializers/filter_parameter_logging.rb +8 -0
  59. data/config/initializers/inflections.rb +17 -0
  60. data/config/initializers/mime_types.rb +5 -0
  61. data/config/initializers/permissions_policy.rb +12 -0
  62. data/config/initializers/wrap_parameters.rb +16 -0
  63. data/config/locales/en.yml +33 -0
  64. data/config/puma.rb +45 -0
  65. data/config/routes.rb +5 -0
  66. data/config/spring.rb +8 -0
  67. data/config/storage.yml +34 -0
  68. data/config/unicorn.rb +19 -0
  69. data/config/webpack/development.js +5 -0
  70. data/config/webpack/environment.js +3 -0
  71. data/config/webpack/production.js +5 -0
  72. data/config/webpack/test.js +5 -0
  73. data/config/webpacker.yml +93 -0
  74. data/db/schema.rb +15 -0
  75. data/db/seeds.rb +8 -0
  76. data/interactive_record.gemspec +31 -0
  77. data/lib/assets/.keep +0 -0
  78. data/lib/interactive_record.rb +8 -0
  79. data/lib/interactive_record/version.rb +5 -0
  80. data/lib/tasks/.keep +0 -0
  81. data/log/.keep +0 -0
  82. data/orchestration/Dockerfile +32 -0
  83. data/orchestration/Makefile +508 -0
  84. data/orchestration/deploy.mk +69 -0
  85. data/orchestration/docker-compose.development.yml +4 -0
  86. data/orchestration/docker-compose.production.yml +28 -0
  87. data/orchestration/docker-compose.test.yml +4 -0
  88. data/orchestration/entrypoint.sh +17 -0
  89. data/package.json +20 -0
  90. data/postcss.config.js +12 -0
  91. data/public/404.html +67 -0
  92. data/public/422.html +67 -0
  93. data/public/500.html +66 -0
  94. data/public/apple-touch-icon-precomposed.png +0 -0
  95. data/public/apple-touch-icon.png +0 -0
  96. data/public/favicon.ico +0 -0
  97. data/public/robots.txt +1 -0
  98. data/storage/.keep +0 -0
  99. data/tmp/.keep +0 -0
  100. data/tmp/pids/.keep +0 -0
  101. data/vendor/.keep +0 -0
  102. data/yarn.lock +7785 -0
  103. metadata +147 -0
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # InteractiveRecord
2
+
3
+ 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/interactive_record`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'interactive_record'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install interactive_record
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 spec` 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]/interactive_record.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5
+
6
+ require_relative 'config/application'
7
+
8
+ 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,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Channel < ActionCable::Channel::Base
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Connection < ActionCable::Connection::Base
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ end
File without changes
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Application view helper.
4
+ module ApplicationHelper
5
+ 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 `bin/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,13 @@
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
+ import Rails from "@rails/ujs"
7
+ import Turbolinks from "turbolinks"
8
+ import * as ActiveStorage from "@rails/activestorage"
9
+ import "channels"
10
+
11
+ Rails.start()
12
+ Turbolinks.start()
13
+ ActiveStorage.start()
@@ -0,0 +1,26 @@
1
+ // Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
2
+ // like app/views/layouts/application.html.erb. All it does is render <div>Hello React</div> at the bottom
3
+ // of the page.
4
+
5
+ import React from 'react'
6
+ import ReactDOM from 'react-dom'
7
+ import PropTypes from 'prop-types'
8
+
9
+ const Hello = props => (
10
+ <div>Hello {props.name}!</div>
11
+ )
12
+
13
+ Hello.defaultProps = {
14
+ name: 'David'
15
+ }
16
+
17
+ Hello.propTypes = {
18
+ name: PropTypes.string
19
+ }
20
+
21
+ document.addEventListener('DOMContentLoaded', () => {
22
+ ReactDOM.render(
23
+ <Hello name="React" />,
24
+ document.body.appendChild(document.createElement('div')),
25
+ )
26
+ })
@@ -0,0 +1,9 @@
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
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: 'from@example.com'
5
+ layout 'mailer'
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Application record base class.
4
+ class ApplicationRecord < ActiveRecord::Base
5
+ self.abstract_class = true
6
+ end
File without changes
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>InteractiveRecord</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
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
11
+ </head>
12
+
13
+ <body>
14
+ <%= yield %>
15
+ </body>
16
+ </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 %>
data/babel.config.js ADDED
@@ -0,0 +1,87 @@
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
+ modules: 'commonjs'
27
+ },
28
+ '@babel/preset-react'
29
+ ],
30
+ (isProductionEnv || isDevelopmentEnv) && [
31
+ '@babel/preset-env',
32
+ {
33
+ forceAllTransforms: true,
34
+ useBuiltIns: 'entry',
35
+ corejs: 3,
36
+ modules: false,
37
+ exclude: ['transform-typeof-symbol']
38
+ }
39
+ ],
40
+ [
41
+ '@babel/preset-react',
42
+ {
43
+ development: isDevelopmentEnv || isTestEnv,
44
+ useBuiltIns: true
45
+ }
46
+ ]
47
+ ].filter(Boolean),
48
+ plugins: [
49
+ 'babel-plugin-macros',
50
+ '@babel/plugin-syntax-dynamic-import',
51
+ isTestEnv && 'babel-plugin-dynamic-import-node',
52
+ '@babel/plugin-transform-destructuring',
53
+ [
54
+ '@babel/plugin-proposal-class-properties',
55
+ {
56
+ loose: true
57
+ }
58
+ ],
59
+ [
60
+ '@babel/plugin-proposal-object-rest-spread',
61
+ {
62
+ useBuiltIns: true
63
+ }
64
+ ],
65
+ [
66
+ '@babel/plugin-transform-runtime',
67
+ {
68
+ helpers: false,
69
+ regenerator: true,
70
+ corejs: false
71
+ }
72
+ ],
73
+ [
74
+ '@babel/plugin-transform-regenerator',
75
+ {
76
+ async: false
77
+ }
78
+ ],
79
+ isProductionEnv && [
80
+ 'babel-plugin-transform-react-remove-prop-types',
81
+ {
82
+ removeImport: true
83
+ }
84
+ ]
85
+ ].filter(Boolean)
86
+ }
87
+ }
data/bin/bundle ADDED
@@ -0,0 +1,118 @@
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($PROGRAM_NAME) == 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
+
28
+ bundler_version = nil
29
+ update_index = nil
30
+ ARGV.each_with_index do |a, i|
31
+ bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
32
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
33
+
34
+ bundler_version = Regexp.last_match(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', __dir__)
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
+
59
+ lockfile_contents = File.read(lockfile)
60
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
61
+
62
+ Regexp.last_match(1)
63
+ end
64
+
65
+ def bundler_version
66
+ @bundler_version ||=
67
+ env_var_version || cli_arg_version ||
68
+ lockfile_version
69
+ end
70
+
71
+ def bundler_requirement
72
+ return "#{Gem::Requirement.default}.a" unless bundler_version
73
+
74
+ bundler_gem_version = Gem::Version.new(bundler_version)
75
+
76
+ requirement = bundler_gem_version.approximate_recommendation
77
+
78
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.7.0')
79
+
80
+ requirement += '.a' if bundler_gem_version.prerelease?
81
+
82
+ requirement
83
+ end
84
+
85
+ def load_bundler!
86
+ ENV['BUNDLE_GEMFILE'] ||= gemfile
87
+
88
+ activate_bundler
89
+ end
90
+
91
+ def activate_bundler
92
+ gem_error = activation_error_handling do
93
+ gem 'bundler', bundler_requirement
94
+ end
95
+ return if gem_error.nil?
96
+
97
+ require_error = activation_error_handling do
98
+ require 'bundler/version'
99
+ end
100
+ if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
101
+ return
102
+ end
103
+
104
+ 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}'`"
105
+ exit 42
106
+ end
107
+
108
+ def activation_error_handling
109
+ yield
110
+ nil
111
+ rescue StandardError, LoadError => e
112
+ e
113
+ end
114
+ end
115
+
116
+ m.load_bundler!
117
+
118
+ load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'interactive_record'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)