interactive_record 0.0.1alpha

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # ActiveSupport::Reloader.to_prepare do
5
+ # ApplicationController.renderer.defaults.merge!(
6
+ # http_host: 'example.org',
7
+ # https: false
8
+ # )
9
+ # end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6
+ # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
7
+
8
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
9
+ # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
10
+ Rails.backtrace_cleaner.remove_silencers! if ENV['BACKTRACE']
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Define an application-wide content security policy
5
+ # For further information see the following documentation
6
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
7
+
8
+ # Rails.application.config.content_security_policy do |policy|
9
+ # policy.default_src :self, :https
10
+ # policy.font_src :self, :https, :data
11
+ # policy.img_src :self, :https, :data
12
+ # policy.object_src :none
13
+ # policy.script_src :self, :https
14
+ # policy.style_src :self, :https
15
+ # # If you are using webpack-dev-server then specify webpack-dev-server host
16
+ # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
17
+
18
+ # # Specify URI for violation reports
19
+ # # policy.report_uri "/csp-violation-report-endpoint"
20
+ # end
21
+
22
+ # If you are using UJS then enable automatic nonce generation
23
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
24
+
25
+ # Set the nonce only to specific directives
26
+ # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
27
+
28
+ # Report CSP violations to a specified URI
29
+ # For further information see the following documentation:
30
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
31
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Specify a serializer for the signed and encrypted cookie jars.
6
+ # Valid options are :json, :marshal, and :hybrid.
7
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Configure sensitive parameters which will be filtered from the log file.
6
+ Rails.application.config.filter_parameters += %i[
7
+ passw secret token _key crypt salt certificate otp ssn
8
+ ]
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Add new inflection rules using the following format. Inflections
5
+ # are locale specific, and you may define rules for as many different
6
+ # locales as you wish. All of these examples are active by default:
7
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
8
+ # inflect.plural /^(ox)$/i, '\1en'
9
+ # inflect.singular /^(ox)en/i, '\1'
10
+ # inflect.irregular 'person', 'people'
11
+ # inflect.uncountable %w( fish sheep )
12
+ # end
13
+
14
+ # These inflection rules are supported but not enabled by default:
15
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
16
+ # inflect.acronym 'RESTful'
17
+ # end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Add new mime types for use in respond_to blocks:
5
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ # Define an application-wide HTTP permissions policy. For further
3
+ # information see https://developers.google.com/web/updates/2018/06/feature-policy
4
+ #
5
+ # Rails.application.config.permissions_policy do |f|
6
+ # f.camera :none
7
+ # f.gyroscope :none
8
+ # f.microphone :none
9
+ # f.usb :none
10
+ # f.fullscreen :self
11
+ # f.payment :self, "https://secure.example.com"
12
+ # end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # This file contains settings for ActionController::ParamsWrapper which
6
+ # is enabled by default.
7
+
8
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9
+ ActiveSupport.on_load(:action_controller) do
10
+ wrap_parameters format: [:json]
11
+ end
12
+
13
+ # To enable root element in JSON for ActiveRecord objects.
14
+ # ActiveSupport.on_load(:active_record) do
15
+ # self.include_root_in_json = true
16
+ # end
@@ -0,0 +1,33 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at https://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
data/config/puma.rb ADDED
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Puma can serve each request in a thread from an internal thread pool.
4
+ # The `threads` method setting takes two numbers: a minimum and maximum.
5
+ # Any libraries that use thread pools should be configured to match
6
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
7
+ # and maximum; this matches the default thread size of Active Record.
8
+ #
9
+ max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5)
10
+ min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
11
+ threads min_threads_count, max_threads_count
12
+
13
+ # Specifies the `worker_timeout` threshold that Puma will use to wait before
14
+ # terminating a worker in development environments.
15
+ #
16
+ worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
17
+
18
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
19
+ #
20
+ port ENV.fetch('PORT', 3000)
21
+
22
+ # Specifies the `environment` that Puma will run in.
23
+ #
24
+ environment ENV.fetch('RAILS_ENV', 'development')
25
+
26
+ # Specifies the `pidfile` that Puma will use.
27
+ pidfile ENV.fetch('PIDFILE', 'tmp/pids/server.pid')
28
+
29
+ # Specifies the number of `workers` to boot in clustered mode.
30
+ # Workers are forked web server processes. If using threads and workers together
31
+ # the concurrency of the application would be max `threads` * `workers`.
32
+ # Workers do not work on JRuby or Windows (both of which do not support
33
+ # processes).
34
+ #
35
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
36
+
37
+ # Use the `preload_app!` method when specifying a `workers` number.
38
+ # This directive tells Puma to first boot the application and load code
39
+ # before forking the application. This takes advantage of Copy On Write
40
+ # process behavior so workers use less memory.
41
+ #
42
+ # preload_app!
43
+
44
+ # Allow puma to be restarted by `rails restart` command.
45
+ plugin :tmp_restart
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
5
+ end
data/config/spring.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ Spring.watch(
4
+ '.ruby-version',
5
+ '.rbenv-vars',
6
+ 'tmp/restart.txt',
7
+ 'tmp/caching-dev.txt'
8
+ )
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
data/config/unicorn.rb ADDED
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ listen "0.0.0.0:#{ENV.fetch('WEB_PORT', '8080')}", tcp_nopush: true
4
+
5
+ pid '/app/tmp/pids/server.pid'
6
+
7
+ preload_app ENV.key?('WEB_PRELOAD_APP')
8
+
9
+ timeout ENV.fetch('WEB_TIMEOUT', 60).to_i
10
+
11
+ worker_processes ENV.fetch('WEB_CONCURRENCY', 8).to_i
12
+
13
+ before_fork do |_server, _worker|
14
+ ActiveRecord::Base.connection.disconnect! if defined?(ActiveRecord)
15
+ end
16
+
17
+ after_fork do |_server, _worker|
18
+ ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
19
+ end
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment.toWebpackConfig()
@@ -0,0 +1,3 @@
1
+ const { environment } = require('@rails/webpacker')
2
+
3
+ module.exports = environment
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment.toWebpackConfig()
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment.toWebpackConfig()
@@ -0,0 +1,93 @@
1
+ # Note: You must restart bin/webpack-dev-server for changes to take effect
2
+
3
+ default: &default
4
+ source_path: app/javascript
5
+ source_entry_path: packs
6
+ public_root_path: public
7
+ public_output_path: packs
8
+ cache_path: tmp/cache/webpacker
9
+ webpack_compile_output: true
10
+
11
+ # Additional paths webpack should lookup modules
12
+ # ['app/assets', 'engine/foo/app/assets']
13
+ additional_paths: []
14
+
15
+ # Reload manifest.json on all requests so we reload latest compiled packs
16
+ cache_manifest: false
17
+
18
+ # Extract and emit a css file
19
+ extract_css: false
20
+
21
+ static_assets_extensions:
22
+ - .jpg
23
+ - .jpeg
24
+ - .png
25
+ - .gif
26
+ - .tiff
27
+ - .ico
28
+ - .svg
29
+ - .eot
30
+ - .otf
31
+ - .ttf
32
+ - .woff
33
+ - .woff2
34
+
35
+ extensions:
36
+ - .jsx
37
+ - .mjs
38
+ - .js
39
+ - .sass
40
+ - .scss
41
+ - .css
42
+ - .module.sass
43
+ - .module.scss
44
+ - .module.css
45
+ - .png
46
+ - .svg
47
+ - .gif
48
+ - .jpeg
49
+ - .jpg
50
+
51
+ development:
52
+ <<: *default
53
+ compile: true
54
+
55
+ # Reference: https://webpack.js.org/configuration/dev-server/
56
+ dev_server:
57
+ https: false
58
+ host: localhost
59
+ port: 3035
60
+ public: localhost:3035
61
+ hmr: false
62
+ # Inline should be set to true if using HMR
63
+ inline: true
64
+ overlay: true
65
+ compress: true
66
+ disable_host_check: true
67
+ use_local_ip: false
68
+ quiet: false
69
+ pretty: false
70
+ headers:
71
+ 'Access-Control-Allow-Origin': '*'
72
+ watch_options:
73
+ ignored: '**/node_modules/**'
74
+
75
+
76
+ test:
77
+ <<: *default
78
+ compile: true
79
+
80
+ # Compile test packs to a separate directory
81
+ public_output_path: packs-test
82
+
83
+ production:
84
+ <<: *default
85
+
86
+ # Production depends on precompilation of packs prior to booting for performance.
87
+ compile: false
88
+
89
+ # Extract and emit a css file
90
+ extract_css: true
91
+
92
+ # Cache manifest.json for performance
93
+ cache_manifest: true
data/db/schema.rb ADDED
@@ -0,0 +1,15 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 0) do
14
+
15
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # This file should contain all the record creation needed to seed the database with its default values.
3
+ # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
4
+ #
5
+ # Examples:
6
+ #
7
+ # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
8
+ # Character.create(name: 'Luke', movie: movies.first)
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/interactive_record/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'interactive_record'
7
+ spec.version = InteractiveRecord::VERSION
8
+ spec.authors = ['Bob Farrell']
9
+ spec.email = ['git@bob.frl']
10
+
11
+ spec.summary = 'ActiveRecord-based database development environment.'
12
+ spec.description = 'Feature-rich browser-based UI for any ActiveRecord-supported database.'
13
+ spec.homepage = 'https://github.com/bobf/interactive_record'
14
+ spec.license = 'MIT'
15
+
16
+ # rubocop:disable Gemspec/RequiredRubyVersion
17
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
18
+ # rubocop:enable Gemspec/RequiredRubyVersion
19
+
20
+ spec.metadata['homepage_uri'] = spec.homepage
21
+ spec.metadata['source_code_uri'] = spec.homepage
22
+ spec.metadata['changelog_uri'] = spec.homepage
23
+
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
26
+ end
27
+
28
+ spec.bindir = 'bin'
29
+ spec.executables = []
30
+ spec.require_paths = ['lib']
31
+ end