fiver 0.0alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.browserslistrc +1 -0
- data/.gitignore +57 -0
- data/.orchestration.yml +4 -0
- data/.rspec +3 -0
- data/.rspec_status +18 -0
- data/.rubocop.yml +10 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +36 -0
- data/Gemfile.lock +292 -0
- data/LICENSE +7 -0
- data/LICENSE.txt +21 -0
- data/Makefile +27 -0
- data/README.md +11 -0
- data/Rakefile +8 -0
- data/app/assets/config/manifest.js +2 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/stylesheets/application.css +15 -0
- data/app/channels/application_cable/channel.rb +6 -0
- data/app/channels/application_cable/connection.rb +6 -0
- data/app/controllers/application_controller.rb +4 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/helpers/application_helper.rb +5 -0
- data/app/javascript/channels/consumer.js +6 -0
- data/app/javascript/channels/index.js +5 -0
- data/app/javascript/packs/application.js +17 -0
- data/app/javascript/packs/hello_react.jsx +26 -0
- data/app/jobs/application_job.rb +9 -0
- data/app/mailers/application_mailer.rb +6 -0
- data/app/models/application_record.rb +6 -0
- data/app/models/concerns/.keep +0 -0
- data/app/views/layouts/application.html.erb +15 -0
- data/app/views/layouts/mailer.html.erb +13 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/babel.config.js +87 -0
- data/bin/bundle +114 -0
- data/bin/console +14 -0
- data/bin/rails +9 -0
- data/bin/rake +9 -0
- data/bin/setup +8 -0
- data/bin/spring +17 -0
- data/bin/webpack +18 -0
- data/bin/webpack-dev-server +18 -0
- data/bin/yarn +11 -0
- data/config.ru +7 -0
- data/config/application.rb +18 -0
- data/config/boot.rb +6 -0
- data/config/cable.yml +10 -0
- data/config/credentials.yml.enc +1 -0
- data/config/database.yml +25 -0
- data/config/environment.rb +7 -0
- data/config/environments/development.rb +64 -0
- data/config/environments/production.rb +114 -0
- data/config/environments/test.rb +52 -0
- data/config/initializers/application_controller_renderer.rb +9 -0
- data/config/initializers/assets.rb +16 -0
- data/config/initializers/backtrace_silencers.rb +8 -0
- data/config/initializers/content_security_policy.rb +31 -0
- data/config/initializers/cookies_serializer.rb +7 -0
- data/config/initializers/filter_parameter_logging.rb +6 -0
- data/config/initializers/inflections.rb +17 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/wrap_parameters.rb +16 -0
- data/config/locales/en.yml +33 -0
- data/config/puma.rb +40 -0
- data/config/rabbitmq.yml +8 -0
- data/config/routes.rb +5 -0
- data/config/spring.rb +8 -0
- data/config/storage.yml +34 -0
- data/config/unicorn.rb +19 -0
- data/config/webpack/development.js +5 -0
- data/config/webpack/environment.js +3 -0
- data/config/webpack/production.js +5 -0
- data/config/webpack/test.js +5 -0
- data/config/webpacker.yml +97 -0
- data/db/schema.rb +15 -0
- data/db/seeds.rb +8 -0
- data/fiver.gemspec +26 -0
- data/lib/assets/.keep +0 -0
- data/lib/fiver.rb +12 -0
- data/lib/fiver/version.rb +5 -0
- data/lib/tasks/.keep +0 -0
- data/log/.keep +0 -0
- data/orchestration/Dockerfile +34 -0
- data/orchestration/Makefile +511 -0
- data/orchestration/docker-compose.development.yml +14 -0
- data/orchestration/docker-compose.production.yml +33 -0
- data/orchestration/docker-compose.test.yml +14 -0
- data/orchestration/entrypoint.sh +17 -0
- data/package.json +20 -0
- data/postcss.config.js +12 -0
- data/public/404.html +67 -0
- data/public/422.html +67 -0
- data/public/500.html +66 -0
- data/public/apple-touch-icon-precomposed.png +0 -0
- data/public/apple-touch-icon.png +0 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +1 -0
- data/storage/.keep +0 -0
- data/tmp/.keep +0 -0
- data/tmp/pids/.keep +0 -0
- data/vendor/.keep +0 -0
- data/yarn.lock +7696 -0
- metadata +148 -0
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright 2021 Robert Farrell
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Bob Farrell
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
include orchestration/Makefile
|
2
|
+
#
|
3
|
+
# Example test command
|
4
|
+
#
|
5
|
+
# This command will call `test-setup` before running your usual test pipeline.
|
6
|
+
#
|
7
|
+
# `test-setup` starts all containers specified in `docker-compose.test.yml`,
|
8
|
+
# waits for them to be ready, and runs DB migrations.
|
9
|
+
#
|
10
|
+
# In your CI environment, simply run `make test`.
|
11
|
+
#
|
12
|
+
.PHONY: test
|
13
|
+
test: test-setup
|
14
|
+
bundle exec rspec
|
15
|
+
bundle exec rubocop
|
16
|
+
bundle exec strong_versions
|
17
|
+
bundle exec brakeman
|
18
|
+
|
19
|
+
# Start development containers and create/migrate/seed database
|
20
|
+
.PHONY: develop
|
21
|
+
develop:
|
22
|
+
bundle install
|
23
|
+
@$(MAKE) start env=test
|
24
|
+
@$(MAKE) start env=development
|
25
|
+
bundle exec rake db:create
|
26
|
+
bundle exec rake db:migrate
|
27
|
+
bundle exec rake db:seed
|
data/README.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Fiver
|
2
|
+
|
3
|
+
Dashboard and management console for [ActiveJob](https://guides.rubyonrails.org/active_job_basics.html)'s [`:advanced_sneakers` adapter](https://github.com/veeqo/advanced-sneakers-activejob) (built on top of [Sneakers](https://github.com/jondot/sneakers)).
|
4
|
+
|
5
|
+
Run as a standalone application using a pre-built _Docker_ image or mount as a _Rails_ engine inside your application.
|
6
|
+
|
7
|
+
Your _RabbitMQ_ instance *must* have the [`management` plugin](https://www.rabbitmq.com/management.html) enabled.
|
8
|
+
|
9
|
+
## License
|
10
|
+
|
11
|
+
[MIT License](LICENSE)
|
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
|
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
|
+
*/
|
File without changes
|
@@ -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 `rails generate channel` command.
|
3
|
+
|
4
|
+
import { createConsumer } from "@rails/actioncable"
|
5
|
+
|
6
|
+
export default createConsumer()
|
@@ -0,0 +1,17 @@
|
|
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
|
+
require("@rails/ujs").start()
|
7
|
+
require("turbolinks").start()
|
8
|
+
require("@rails/activestorage").start()
|
9
|
+
require("channels")
|
10
|
+
|
11
|
+
|
12
|
+
// Uncomment to copy all static images under ../images to the output folder and reference
|
13
|
+
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
|
14
|
+
// or the `imagePath` JavaScript helper below.
|
15
|
+
//
|
16
|
+
// const images = require.context('../images', true)
|
17
|
+
// const imagePath = (name) => images(name, true)
|
@@ -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
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Fiver</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
9
|
+
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
15
|
+
</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,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
|