fiver 0.0alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/.browserslistrc +1 -0
  3. data/.gitignore +57 -0
  4. data/.orchestration.yml +4 -0
  5. data/.rspec +3 -0
  6. data/.rspec_status +18 -0
  7. data/.rubocop.yml +10 -0
  8. data/.ruby-version +1 -0
  9. data/.travis.yml +6 -0
  10. data/Gemfile +36 -0
  11. data/Gemfile.lock +292 -0
  12. data/LICENSE +7 -0
  13. data/LICENSE.txt +21 -0
  14. data/Makefile +27 -0
  15. data/README.md +11 -0
  16. data/Rakefile +8 -0
  17. data/app/assets/config/manifest.js +2 -0
  18. data/app/assets/images/.keep +0 -0
  19. data/app/assets/stylesheets/application.css +15 -0
  20. data/app/channels/application_cable/channel.rb +6 -0
  21. data/app/channels/application_cable/connection.rb +6 -0
  22. data/app/controllers/application_controller.rb +4 -0
  23. data/app/controllers/concerns/.keep +0 -0
  24. data/app/helpers/application_helper.rb +5 -0
  25. data/app/javascript/channels/consumer.js +6 -0
  26. data/app/javascript/channels/index.js +5 -0
  27. data/app/javascript/packs/application.js +17 -0
  28. data/app/javascript/packs/hello_react.jsx +26 -0
  29. data/app/jobs/application_job.rb +9 -0
  30. data/app/mailers/application_mailer.rb +6 -0
  31. data/app/models/application_record.rb +6 -0
  32. data/app/models/concerns/.keep +0 -0
  33. data/app/views/layouts/application.html.erb +15 -0
  34. data/app/views/layouts/mailer.html.erb +13 -0
  35. data/app/views/layouts/mailer.text.erb +1 -0
  36. data/babel.config.js +87 -0
  37. data/bin/bundle +114 -0
  38. data/bin/console +14 -0
  39. data/bin/rails +9 -0
  40. data/bin/rake +9 -0
  41. data/bin/setup +8 -0
  42. data/bin/spring +17 -0
  43. data/bin/webpack +18 -0
  44. data/bin/webpack-dev-server +18 -0
  45. data/bin/yarn +11 -0
  46. data/config.ru +7 -0
  47. data/config/application.rb +18 -0
  48. data/config/boot.rb +6 -0
  49. data/config/cable.yml +10 -0
  50. data/config/credentials.yml.enc +1 -0
  51. data/config/database.yml +25 -0
  52. data/config/environment.rb +7 -0
  53. data/config/environments/development.rb +64 -0
  54. data/config/environments/production.rb +114 -0
  55. data/config/environments/test.rb +52 -0
  56. data/config/initializers/application_controller_renderer.rb +9 -0
  57. data/config/initializers/assets.rb +16 -0
  58. data/config/initializers/backtrace_silencers.rb +8 -0
  59. data/config/initializers/content_security_policy.rb +31 -0
  60. data/config/initializers/cookies_serializer.rb +7 -0
  61. data/config/initializers/filter_parameter_logging.rb +6 -0
  62. data/config/initializers/inflections.rb +17 -0
  63. data/config/initializers/mime_types.rb +5 -0
  64. data/config/initializers/wrap_parameters.rb +16 -0
  65. data/config/locales/en.yml +33 -0
  66. data/config/puma.rb +40 -0
  67. data/config/rabbitmq.yml +8 -0
  68. data/config/routes.rb +5 -0
  69. data/config/spring.rb +8 -0
  70. data/config/storage.yml +34 -0
  71. data/config/unicorn.rb +19 -0
  72. data/config/webpack/development.js +5 -0
  73. data/config/webpack/environment.js +3 -0
  74. data/config/webpack/production.js +5 -0
  75. data/config/webpack/test.js +5 -0
  76. data/config/webpacker.yml +97 -0
  77. data/db/schema.rb +15 -0
  78. data/db/seeds.rb +8 -0
  79. data/fiver.gemspec +26 -0
  80. data/lib/assets/.keep +0 -0
  81. data/lib/fiver.rb +12 -0
  82. data/lib/fiver/version.rb +5 -0
  83. data/lib/tasks/.keep +0 -0
  84. data/log/.keep +0 -0
  85. data/orchestration/Dockerfile +34 -0
  86. data/orchestration/Makefile +511 -0
  87. data/orchestration/docker-compose.development.yml +14 -0
  88. data/orchestration/docker-compose.production.yml +33 -0
  89. data/orchestration/docker-compose.test.yml +14 -0
  90. data/orchestration/entrypoint.sh +17 -0
  91. data/package.json +20 -0
  92. data/postcss.config.js +12 -0
  93. data/public/404.html +67 -0
  94. data/public/422.html +67 -0
  95. data/public/500.html +66 -0
  96. data/public/apple-touch-icon-precomposed.png +0 -0
  97. data/public/apple-touch-icon.png +0 -0
  98. data/public/favicon.ico +0 -0
  99. data/public/robots.txt +1 -0
  100. data/storage/.keep +0 -0
  101. data/tmp/.keep +0 -0
  102. data/tmp/pids/.keep +0 -0
  103. data/vendor/.keep +0 -0
  104. data/yarn.lock +7696 -0
  105. metadata +148 -0
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "fiver"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/rails ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path('../spring', __FILE__)
4
+ rescue LoadError => e
5
+ raise unless e.message.include?('spring')
6
+ end
7
+ APP_PATH = File.expand_path('../config/application', __dir__)
8
+ require_relative '../config/boot'
9
+ require 'rails/commands'
data/bin/rake ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path('../spring', __FILE__)
4
+ rescue LoadError => e
5
+ raise unless e.message.include?('spring')
6
+ end
7
+ require_relative '../config/boot'
8
+ require 'rake'
9
+ Rake.application.run
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/spring ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file loads Spring without using Bundler, in order to be fast.
4
+ # It gets overwritten when you run the `spring binstub` command.
5
+
6
+ unless defined?(Spring)
7
+ require 'rubygems'
8
+ require 'bundler'
9
+
10
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11
+ spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
12
+ if spring
13
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14
+ gem 'spring', spring.version
15
+ require 'spring/binstub'
16
+ end
17
+ end
data/bin/webpack ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
+ ENV["NODE_ENV"] ||= "development"
5
+
6
+ require "pathname"
7
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8
+ Pathname.new(__FILE__).realpath)
9
+
10
+ require "bundler/setup"
11
+
12
+ require "webpacker"
13
+ require "webpacker/webpack_runner"
14
+
15
+ APP_ROOT = File.expand_path("..", __dir__)
16
+ Dir.chdir(APP_ROOT) do
17
+ Webpacker::WebpackRunner.run(ARGV)
18
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
+ ENV["NODE_ENV"] ||= "development"
5
+
6
+ require "pathname"
7
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8
+ Pathname.new(__FILE__).realpath)
9
+
10
+ require "bundler/setup"
11
+
12
+ require "webpacker"
13
+ require "webpacker/dev_server_runner"
14
+
15
+ APP_ROOT = File.expand_path("..", __dir__)
16
+ Dir.chdir(APP_ROOT) do
17
+ Webpacker::DevServerRunner.run(ARGV)
18
+ end
data/bin/yarn ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ begin
5
+ exec "yarnpkg", *ARGV
6
+ rescue Errno::ENOENT
7
+ $stderr.puts "Yarn executable was not detected in the system."
8
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
+ exit 1
10
+ end
11
+ end
data/config.ru ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require_relative 'config/environment'
6
+
7
+ run Rails.application
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ require 'rails/all'
6
+
7
+ $LOAD_PATH.insert(0, File.expand_path(File.join(__dir__, '..', 'lib')))
8
+
9
+ require 'fiver'
10
+
11
+ Bundler.require(*Rails.groups)
12
+
13
+ module Fiver
14
+ # Dashboard tool for a RabbitMQ/Sneakers/ActiveJob queue system.
15
+ class Application < Rails::Application
16
+ config.load_defaults 6.0
17
+ end
18
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
+
5
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
6
+ require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
data/config/cable.yml ADDED
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: fiver_production
@@ -0,0 +1 @@
1
+ 8GhmDU4N+BlorHaAAQLeLSa1jnpmAEU+Et0S8el+lgO44cNduzTQpjnLQ5M2j2KuW2MyY8g/8na/QoViQ+bxwIn+rjMdo/teaq+zX+PuHiF5RKQo7x2szVwDdFv7cgAvAP8tuGDLJ2l+ERWF2q2sqAw30M69Ud6LkotT+aqLz4k24MLNrBwm7aT1fVicaDGX9YaiwkaObPxXn9DfwVI75lR3Xu03CDOgT5Hfk60pH1McBd7js/yx8UvfIrnf16Jd2Xuxrh7gnpMtS/IX/gsFyQMuY2vNBzAbgnXC4DpuHg2O5Fq+WS4b2tYtvsCAEO0urDVvD7eAjvQd2qztOD3aRKe0CRNsO62VBGqkGx/sXbQGWZTwmfvn79rkRdsNLZ6MhcxPg6M54eM5xwbrbCl3QUZScGunHiErgjX3--XoZMK41USkBw9iOh--XtkVzjLrHUrr4N0sRwzuMQ==
@@ -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,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
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 on
7
+ # every request. 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
+ # Don't care if the mailer can't send.
37
+ config.action_mailer.raise_delivery_errors = false
38
+
39
+ config.action_mailer.perform_caching = false
40
+
41
+ # Print deprecation notices to the Rails logger.
42
+ config.active_support.deprecation = :log
43
+
44
+ # Raise an error on page load if there are pending migrations.
45
+ config.active_record.migration_error = :page_load
46
+
47
+ # Highlight code that triggered database queries in logs.
48
+ config.active_record.verbose_query_logs = true
49
+
50
+ # Debug mode disables concatenation and preprocessing of assets.
51
+ # This option may cause significant delays in view rendering with a large
52
+ # number of complex assets.
53
+ config.assets.debug = true
54
+
55
+ # Suppress logger output for asset requests.
56
+ config.assets.quiet = true
57
+
58
+ # Raises error for missing translations.
59
+ # config.action_view.raise_on_missing_translations = true
60
+
61
+ # Use an evented file watcher to asynchronously detect changes in source code,
62
+ # routes, locales, etc. This feature depends on the listen gem.
63
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
64
+ end
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
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.action_controller.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
+ # Mount Action Cable outside main process or domain.
44
+ # config.action_cable.mount_path = nil
45
+ # config.action_cable.url = 'wss://example.com/cable'
46
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
47
+
48
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
49
+ # config.force_ssl = true
50
+
51
+ # Use the lowest log level to ensure availability of diagnostic information
52
+ # when problems arise.
53
+ config.log_level = :debug
54
+
55
+ # Prepend all log lines with the following tags.
56
+ config.log_tags = [:request_id]
57
+
58
+ # Use a different cache store in production.
59
+ # config.cache_store = :mem_cache_store
60
+
61
+ # Use a real queuing backend for Active Job (and separate queues per environment).
62
+ # config.active_job.queue_adapter = :resque
63
+ # config.active_job.queue_name_prefix = "fiver_production"
64
+
65
+ config.action_mailer.perform_caching = false
66
+
67
+ # Ignore bad email addresses and do not raise email delivery errors.
68
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
69
+ # config.action_mailer.raise_delivery_errors = false
70
+
71
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
72
+ # the I18n.default_locale when a translation cannot be found).
73
+ config.i18n.fallbacks = true
74
+
75
+ # Send deprecation notices to registered listeners.
76
+ config.active_support.deprecation = :notify
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+
81
+ # Use a different logger for distributed setups.
82
+ # require 'syslog/logger'
83
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
84
+
85
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
86
+ logger = ActiveSupport::Logger.new($stdout)
87
+ logger.formatter = config.log_formatter
88
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
89
+ end
90
+
91
+ # Do not dump schema after migrations.
92
+ config.active_record.dump_schema_after_migration = false
93
+
94
+ # Inserts middleware to perform automatic connection switching.
95
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
96
+ # middleware. The `delay` is used to determine how long to wait after a write
97
+ # to send a subsequent read to the primary.
98
+ #
99
+ # The `database_resolver` class is used by the middleware to determine which
100
+ # database is appropriate to use based on the time delay.
101
+ #
102
+ # The `database_resolver_context` class is used by the middleware to set
103
+ # timestamps for the last write to the primary. The resolver uses the context
104
+ # class timestamps to determine how long to wait before reading from the
105
+ # replica.
106
+ #
107
+ # By default Rails will store a last write timestamp in the session. The
108
+ # DatabaseSelector middleware is designed as such you can define your own
109
+ # strategy for connection switching and pass that into the middleware through
110
+ # these configuration options.
111
+ # config.active_record.database_selector = { delay: 2.seconds }
112
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
113
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
114
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
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 = false
12
+ config.action_view.cache_template_loading = true
13
+
14
+ # Do not eager load code on boot. This avoids loading your whole application
15
+ # just for the purpose of running a single test. If you are using a tool that
16
+ # preloads Rails for running tests, you may have to set it to true.
17
+ config.eager_load = false
18
+
19
+ # Configure public file server for tests with Cache-Control for performance.
20
+ config.public_file_server.enabled = true
21
+ config.public_file_server.headers = {
22
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
23
+ }
24
+
25
+ # Show full error reports and disable caching.
26
+ config.consider_all_requests_local = true
27
+ config.action_controller.perform_caching = false
28
+ config.cache_store = :null_store
29
+
30
+ # Raise exceptions instead of rendering exception templates.
31
+ config.action_dispatch.show_exceptions = false
32
+
33
+ # Disable request forgery protection in test environment.
34
+ config.action_controller.allow_forgery_protection = false
35
+
36
+ # Store uploaded files on the local file system in a temporary directory.
37
+ config.active_storage.service = :test
38
+
39
+ config.action_mailer.perform_caching = false
40
+
41
+ # Tell Action Mailer not to deliver emails to the real world.
42
+ # The :test delivery method accumulates sent emails in the
43
+ # ActionMailer::Base.deliveries array.
44
+ config.action_mailer.delivery_method = :test
45
+
46
+ # Print deprecation notices to the stderr.
47
+ config.active_support.deprecation = :stderr
48
+
49
+ # Raises error for missing translations.
50
+ # config.action_view.raise_on_missing_translations = true
51
+ config.active_job.queue_adapter = :advanced_sneakers
52
+ end
@@ -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