hephaestus 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +16 -0
- data/README.md +6 -4
- data/bin/hephaestus +19 -6
- data/lib/hephaestus/app_builder.rb +7 -1
- data/lib/hephaestus/generators/base.rb +4 -0
- data/lib/hephaestus/generators/config_generator.rb +3 -3
- data/lib/hephaestus/generators/core_generator.rb +1 -2
- data/lib/hephaestus/generators/lib_generator.rb +5 -0
- data/lib/hephaestus/generators/sorbet_generator.rb +1 -0
- data/lib/hephaestus/version.rb +1 -1
- data/templates/.env.test +4 -0
- data/templates/.github/actions/license/action.yml +11 -0
- data/templates/.github/actions/setup/action.yml +10 -0
- data/templates/.github/actions/sisyphus/action.yml +11 -0
- data/templates/.github/actions/sorbet/action.yml +19 -0
- data/templates/.github/dependabot.yml +22 -0
- data/templates/.github/workflows/automerge.yml +97 -0
- data/templates/.github/workflows/licenses.yml +43 -0
- data/templates/.github/workflows/lint.yml +52 -0
- data/templates/.github/workflows/security.yml +38 -0
- data/templates/.github/workflows/sorbet.yml +49 -0
- data/templates/.github/workflows/test.yml +53 -0
- data/templates/.licensed.yml +33 -0
- data/templates/.rubocop.yml +5 -0
- data/templates/.vscode/extensions.json +9 -0
- data/templates/.vscode/launch.json +13 -0
- data/templates/.vscode/settings.json +52 -0
- data/templates/app/lib/plug_app/middleware/tracing_attributes.rb +6 -1
- data/templates/config/initializers/environment.rb +1 -1
- data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/yetto.json +167 -1
- data/templates/lib/plug_app/schemas/api/2023-03-06/openapi.json +3 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/paths/plug.json +4 -5
- data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/after_create_message.json +11 -1
- data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/after_create_plug_installation.json +10 -0
- data/templates/script/typecheck +2 -0
- data/templates/test/controllers/settings_controller_test.rb +1 -1
- data/templates/test/controllers/yetto_controller_test.rb +0 -1
- data/templates/test/fixtures/files/.keep +0 -0
- data/templates/test/integration/.keep +0 -0
- data/templates/test/mailers/.keep +0 -0
- data/templates/test/support/api.rb +1 -1
- data/templates/test/support/rails.rb +6 -5
- metadata +26 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91109351951b2ac1514f251751c9311dd55028f4fdcfa8e0140fc2c4efa014c9
|
4
|
+
data.tar.gz: 452d4065cdfb605092c41c5677e87b85fe4070c6b21d2c28d8cd4649cadbfbb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31f32e5f396ae5b519bde7f6c30b7b796ae26f0db150e6ed1717eb2aaf153079f1755b0d8da36312bb3e5c151f2c7534fbfcf81c8d9efcf11e6f7769b2a5f2cd
|
7
|
+
data.tar.gz: d1b3456db78f30e7d62c20731cd1fcb3925bc39e1e8653fff9a2bfa693b8b38db0a6c48fffc1df86d8417a50098a4f195570f63387f412ba22b4b88855d29507
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.1.1](https://github.com/yettoapp/hephaestus/tree/v0.1.1) (2023-03-15)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/yettoapp/hephaestus/compare/v0.1.0...v0.1.1)
|
6
|
+
|
7
|
+
## [v0.1.0](https://github.com/yettoapp/hephaestus/tree/v0.1.0) (2023-03-15)
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/yettoapp/hephaestus/compare/v0.0.2...v0.1.0)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Various updates [\#2](https://github.com/yettoapp/hephaestus/pull/2) ([gjtorikian](https://github.com/gjtorikian))
|
14
|
+
|
15
|
+
## [v0.0.2](https://github.com/yettoapp/hephaestus/tree/v0.0.2) (2023-03-01)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/yettoapp/hephaestus/compare/v0.0.1...v0.0.2)
|
18
|
+
|
3
19
|
## [v0.0.1](https://github.com/yettoapp/hephaestus/tree/v0.0.1) (2023-02-28)
|
4
20
|
|
5
21
|
[Full Changelog](https://github.com/yettoapp/hephaestus/compare/b33ebb8ab3188b8689b10d4649d3f29ea7ca1f2a...v0.0.1)
|
data/README.md
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
# Hephaestus
|
2
2
|
|
3
|
-
A plug template for Yetto.
|
3
|
+
A plug template for Yetto. Use this to quickly spin up new plugs with a set of defaults.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
7
|
```
|
8
|
-
|
8
|
+
gem install hephaestus
|
9
|
+
|
10
|
+
hephaestus plug-app
|
9
11
|
```
|
10
12
|
|
11
|
-
If you're working on updating this locally, you
|
13
|
+
If you're working on updating this locally, you may also probably want:
|
12
14
|
|
13
15
|
```
|
14
|
-
rm -rf plug-app && DEBUG=1
|
16
|
+
rm -rf plug-app && DEBUG=1 hephaestus/bin/hephaestus plug-app
|
15
17
|
```
|
16
18
|
|
17
19
|
## Acknowledgements
|
data/bin/hephaestus
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require "pathname"
|
5
|
+
|
6
|
+
source_path = (Pathname.new(__FILE__).dirname + "../lib").expand_path
|
5
7
|
$LOAD_PATH << source_path
|
6
8
|
|
7
9
|
activate_rails_version = ->(rails_version) do
|
@@ -10,7 +12,7 @@ activate_rails_version = ->(rails_version) do
|
|
10
12
|
$LOAD_PATH.unshift(rails_path)
|
11
13
|
end
|
12
14
|
|
13
|
-
if str = ARGV.first
|
15
|
+
if (str = ARGV.first)
|
14
16
|
str = str.b[/\A_(.*)_\z/, 1]
|
15
17
|
|
16
18
|
if str && Gem::Version.correct?(str)
|
@@ -20,7 +22,7 @@ if str = ARGV.first
|
|
20
22
|
begin
|
21
23
|
activate_rails_version.call(rails_version)
|
22
24
|
rescue Gem::GemNotFoundException
|
23
|
-
abort
|
25
|
+
abort("Hephaestus error: Unable to find Rails version #{rails_version}")
|
24
26
|
end
|
25
27
|
else
|
26
28
|
require "hephaestus/version"
|
@@ -38,13 +40,24 @@ if ARGV.empty?
|
|
38
40
|
puts
|
39
41
|
puts "See --help for more info"
|
40
42
|
exit 0
|
41
|
-
elsif ["-v", "--version"].include?
|
43
|
+
elsif ["-v", "--version"].include?(ARGV[0])
|
42
44
|
puts Hephaestus::VERSION
|
43
45
|
exit 0
|
44
46
|
end
|
45
47
|
|
48
|
+
path = ARGV.first
|
49
|
+
if File.exist?(path)
|
50
|
+
puts "The directory #{path} already exists."
|
51
|
+
exit 1
|
52
|
+
end
|
53
|
+
|
54
|
+
unless path.start_with?("plug-")
|
55
|
+
puts "The directory name must start with 'plug-'"
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
|
46
59
|
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
47
|
-
Hephaestus::AppGenerator.source_root
|
60
|
+
Hephaestus::AppGenerator.source_root(templates_root)
|
48
61
|
Hephaestus::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
|
49
62
|
|
50
63
|
ARGV.push("--minimal")
|
@@ -6,6 +6,7 @@ require "forwardable"
|
|
6
6
|
module Hephaestus
|
7
7
|
class AppBuilder < ::Rails::AppBuilder
|
8
8
|
include Hephaestus::Actions
|
9
|
+
|
9
10
|
extend Forwardable
|
10
11
|
|
11
12
|
def readme
|
@@ -138,7 +139,8 @@ module Hephaestus
|
|
138
139
|
end
|
139
140
|
|
140
141
|
def replace_generic_variables
|
141
|
-
replace_in_files(destination_root, "${APP}",
|
142
|
+
replace_in_files(destination_root, "${APP}", short_appname.capitalize)
|
143
|
+
replace_in_files(destination_root, "${app}", short_appname.downcase)
|
142
144
|
replace_in_files(destination_root, "PlugApp", app_name.underscore.camelcase)
|
143
145
|
replace_in_files(destination_root, "plug-app", app_name.dasherize)
|
144
146
|
replace_in_files(destination_root, "PLUG_APP", app_name.underscore.upcase)
|
@@ -147,6 +149,10 @@ module Hephaestus
|
|
147
149
|
|
148
150
|
private
|
149
151
|
|
152
|
+
def short_appname
|
153
|
+
app_name.split("_").last
|
154
|
+
end
|
155
|
+
|
150
156
|
def root_path
|
151
157
|
@root_path ||= Pathname(__dir__).join("..", "..").expand_path
|
152
158
|
end
|
@@ -37,6 +37,10 @@ module Hephaestus
|
|
37
37
|
Rails.app_class.module_parent_name.demodulize.underscore.dasherize
|
38
38
|
end
|
39
39
|
|
40
|
+
def short_appname
|
41
|
+
app_name.sub(/plug-/i, "")
|
42
|
+
end
|
43
|
+
|
40
44
|
def empty_directory_with_keep_file(destination)
|
41
45
|
empty_directory(destination, {})
|
42
46
|
keep_file(destination)
|
@@ -35,10 +35,10 @@ module Hephaestus
|
|
35
35
|
|
36
36
|
Rails.root.glob("app/lib/#{app_name.underscore}/middleware/*.{rb}").each { |file| require_relative file }
|
37
37
|
|
38
|
-
config.middleware.insert(0,
|
39
|
-
config.middleware.insert(0,
|
38
|
+
config.middleware.insert(0, PlugApp::Middleware::TracingAttributes)
|
39
|
+
config.middleware.insert(0, PlugApp::Middleware::MalformedRequest)
|
40
40
|
|
41
|
-
config.middleware.use(
|
41
|
+
config.middleware.use(PlugApp::Middleware::OpenapiValidation)
|
42
42
|
|
43
43
|
GIT_SHA = %x(git rev-parse HEAD).chomp
|
44
44
|
CONFIG
|
@@ -23,9 +23,8 @@ module Hephaestus
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def libs
|
26
|
-
bare_app_name = app_name.split("-").last
|
27
26
|
copy_file("app/lib/body_parameter/yetto_parameters.rb", "app/lib/body_parameter/yetto_parameters.rb")
|
28
|
-
copy_file("app/lib/constants/app.rb", "app/lib/constants/#{
|
27
|
+
copy_file("app/lib/constants/app.rb", "app/lib/constants/#{app_name}.rb")
|
29
28
|
copy_file("app/lib/headers/yetto.rb", "app/lib/headers/yetto.rb")
|
30
29
|
copy_file("app/lib/path_parameter/yetto_parameters.rb", "app/lib/path_parameter/yetto_parameters.rb")
|
31
30
|
directory("app/lib/plug_app", "app/lib/#{app_name.underscore}")
|
@@ -12,5 +12,10 @@ module Hephaestus
|
|
12
12
|
def lib_tasks
|
13
13
|
directory("lib/tasks", "lib/tasks")
|
14
14
|
end
|
15
|
+
|
16
|
+
def plug_schema
|
17
|
+
copy_file("lib/plug_app/schemas/api/2023-03-06/paths/plug.json", "lib/#{app_name.underscore}/schemas/api/2023-03-06/paths/#{short_appname.underscore}.json")
|
18
|
+
remove_file("lib/#{app_name.underscore}/schemas/api/2023-03-06/paths/plug.json") # cleanup
|
19
|
+
end
|
15
20
|
end
|
16
21
|
end
|
data/lib/hephaestus/version.rb
CHANGED
data/templates/.env.test
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
name: "Run Sorbet Check"
|
2
|
+
description: "Validates that all the Sorbet types are up to date."
|
3
|
+
|
4
|
+
inputs:
|
5
|
+
gh_token:
|
6
|
+
description: 'A GitHub PAT'
|
7
|
+
required: true
|
8
|
+
|
9
|
+
runs:
|
10
|
+
using: "composite"
|
11
|
+
steps:
|
12
|
+
- uses: ./.github/actions/setup
|
13
|
+
|
14
|
+
- name: Update RBI files
|
15
|
+
shell: bash
|
16
|
+
id: update
|
17
|
+
env:
|
18
|
+
GITHUB_TOKEN: ${{ inputs.gh_token }}
|
19
|
+
run: script/typecheck --update
|
@@ -0,0 +1,22 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: "github-actions"
|
4
|
+
directory: "/"
|
5
|
+
schedule:
|
6
|
+
interval: daily
|
7
|
+
time: "09:00"
|
8
|
+
timezone: "Etc/UTC"
|
9
|
+
open-pull-requests-limit: 10
|
10
|
+
|
11
|
+
- package-ecosystem: bundler
|
12
|
+
directory: "/"
|
13
|
+
schedule:
|
14
|
+
interval: daily
|
15
|
+
time: "09:00"
|
16
|
+
timezone: "Etc/UTC"
|
17
|
+
open-pull-requests-limit: 10
|
18
|
+
allow:
|
19
|
+
- dependency-name: "*"
|
20
|
+
dependency-type: "production"
|
21
|
+
- dependency-name: "sorbet*"
|
22
|
+
dependency-type: "all"
|
@@ -0,0 +1,97 @@
|
|
1
|
+
name: PR auto-{approve,merge}
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request_target:
|
5
|
+
|
6
|
+
permissions:
|
7
|
+
pull-requests: write
|
8
|
+
contents: write
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
dependabot:
|
12
|
+
name: Dependabot
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
|
15
|
+
env:
|
16
|
+
RAILS_ENV: test
|
17
|
+
REDIS_URL: redis://localhost:6379/0
|
18
|
+
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
|
19
|
+
SLACK_LOG_URL: http://slack.com/the_log_room
|
20
|
+
|
21
|
+
# Service containers to run; note that this is duplicated
|
22
|
+
# in test.yml due to a limitation in GitHub Actions
|
23
|
+
# (services can only be defined per job)
|
24
|
+
services:
|
25
|
+
redis:
|
26
|
+
# Docker Hub image name
|
27
|
+
image: redis:6.2-alpine
|
28
|
+
ports: ["6379:6379"]
|
29
|
+
# Set health checks to wait until redis has started
|
30
|
+
options: >-
|
31
|
+
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout
|
32
|
+
5s --health-retries 5
|
33
|
+
|
34
|
+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
|
35
|
+
steps:
|
36
|
+
- name: Fetch Dependabot metadata
|
37
|
+
id: dependabot-metadata
|
38
|
+
uses: dependabot/fetch-metadata@v1
|
39
|
+
with:
|
40
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
41
|
+
|
42
|
+
- uses: actions/checkout@v3
|
43
|
+
with:
|
44
|
+
ref: ${{ github.head_ref }}
|
45
|
+
|
46
|
+
- uses: ./.github/actions/sisyphus
|
47
|
+
|
48
|
+
- uses: ./.github/actions/license
|
49
|
+
|
50
|
+
- name: Commit licenses
|
51
|
+
run: |
|
52
|
+
git add .
|
53
|
+
git commit -m "[auto-license]: Update license information" || true
|
54
|
+
git push
|
55
|
+
|
56
|
+
- uses: ./.github/actions/sorbet
|
57
|
+
|
58
|
+
- name: Commit Sorbet
|
59
|
+
run: |
|
60
|
+
git add .
|
61
|
+
git commit -m "[auto-rbi]: Update RBI files" || true
|
62
|
+
git push
|
63
|
+
|
64
|
+
- name: Approve Dependabot PR
|
65
|
+
if: ${{steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'}}
|
66
|
+
run: gh pr review --approve "$PR_URL"
|
67
|
+
env:
|
68
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
69
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
70
|
+
|
71
|
+
- name: Merge Dependabot PR
|
72
|
+
run: gh pr merge --auto --squash "$PR_URL"
|
73
|
+
env:
|
74
|
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
75
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
76
|
+
|
77
|
+
sisyphusbot:
|
78
|
+
name: Automated PRs
|
79
|
+
runs-on: ubuntu-latest
|
80
|
+
|
81
|
+
if: ${{ github.event.pull_request.user.login == 'sisyphusbot' }}
|
82
|
+
steps:
|
83
|
+
- uses: actions/checkout@v3
|
84
|
+
|
85
|
+
- name: Approve Automated PR
|
86
|
+
if: startsWith(github.event.pull_request.title, '[auto')
|
87
|
+
run: gh pr review --approve "$PR_URL"
|
88
|
+
env:
|
89
|
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
90
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
91
|
+
|
92
|
+
- name: Merge Automated PR
|
93
|
+
if: startsWith(github.event.pull_request.title, '[auto')
|
94
|
+
run: gh pr merge --auto --squash "$PR_URL"
|
95
|
+
env:
|
96
|
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
97
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: Update licenses
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
paths:
|
6
|
+
- "**/Gemfile.lock"
|
7
|
+
branches:
|
8
|
+
- production
|
9
|
+
- staging
|
10
|
+
workflow_dispatch:
|
11
|
+
|
12
|
+
permissions:
|
13
|
+
contents: write
|
14
|
+
pull-requests: write
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
license-cache:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v3
|
22
|
+
with:
|
23
|
+
ref: ${{ github.ref }}
|
24
|
+
|
25
|
+
- uses: ./.github/actions/license
|
26
|
+
|
27
|
+
- name: Create Pull Request
|
28
|
+
uses: peter-evans/create-pull-request@v4
|
29
|
+
with:
|
30
|
+
token: ${{ secrets.GH_SISYPHUS_YETTO_REPO_TOKEN }}
|
31
|
+
commit-message: "[auto-license] Update license information"
|
32
|
+
title: "[auto-license] Update license information"
|
33
|
+
body: |
|
34
|
+
- Update license information
|
35
|
+
|
36
|
+
Auto-generated by [create-pull-request][1]
|
37
|
+
|
38
|
+
[1]: https://github.com/peter-evans/create-pull-request
|
39
|
+
branch: update-licenses
|
40
|
+
committer: Sisyphus <sisyphus@yetto.app>
|
41
|
+
author: Sisyphus <sisyphus@yetto.app>
|
42
|
+
delete-branch: true
|
43
|
+
labels: 'chore, github action'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
name: Linting
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
|
6
|
+
env:
|
7
|
+
RAILS_ENV: test
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rubocop:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v3
|
14
|
+
|
15
|
+
# reads from .ruby-version
|
16
|
+
- uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
bundler-cache: true
|
19
|
+
rubygems: latest
|
20
|
+
|
21
|
+
- name: Rubocop
|
22
|
+
run: bundle exec rake rubocop
|
23
|
+
|
24
|
+
ruby-types:
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v3
|
28
|
+
|
29
|
+
# reads from .ruby-version
|
30
|
+
- uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
bundler-cache: true
|
33
|
+
rubygems: latest
|
34
|
+
|
35
|
+
- name: Sorbet
|
36
|
+
id: sorbet_tc
|
37
|
+
run: bundle exec srb tc
|
38
|
+
|
39
|
+
- name: Provide error message
|
40
|
+
if: failure() && steps.sorbet_tc.outcome == 'failure'
|
41
|
+
run: |
|
42
|
+
echo "Run 'bundle exec srb tc -a' to auto-correct Sorbet checks."
|
43
|
+
|
44
|
+
- name: Verifying Tapioca
|
45
|
+
id: tapioca_verify
|
46
|
+
run: script/typecheck --verify
|
47
|
+
|
48
|
+
- name: Provide error message
|
49
|
+
if: failure() && steps.tapioca_verify.outcome == 'failure'
|
50
|
+
run: |
|
51
|
+
echo "Run 'script/typecheck --update' to update Tapioca's RBI files."
|
52
|
+
echo "Run 'script/typecheck --verify' to verify that Tapioca's RBI files are up-to-date."
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: Security
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
|
6
|
+
env:
|
7
|
+
RAILS_ENV: test
|
8
|
+
BUNDLE_WITH: "ci"
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
bundle-audit:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
bundler-cache: true
|
18
|
+
rubygems: latest
|
19
|
+
|
20
|
+
# Patch-level verification for bundler.
|
21
|
+
- name: Run bundle-audit
|
22
|
+
run: |
|
23
|
+
script/security_checks/bundle-audit
|
24
|
+
|
25
|
+
brakeman: # A static analysis security vulnerability scanner for Ruby on Rails applications
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v3
|
29
|
+
|
30
|
+
- uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
bundler-cache: true
|
33
|
+
rubygems: latest
|
34
|
+
|
35
|
+
- name: brakeman report
|
36
|
+
run: |
|
37
|
+
script/security_checks/brakeman
|
38
|
+
cat security-results.json
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: Update Sorbet files
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
paths:
|
6
|
+
- '**.rb'
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: write
|
10
|
+
pull-requests: write
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
trigger_tapioca_pr:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
env:
|
17
|
+
RAILS_ENV: test
|
18
|
+
REDIS_URL: redis://localhost:6379/0
|
19
|
+
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
|
20
|
+
SLACK_LOG_URL: http://slack.com/the_log_room
|
21
|
+
|
22
|
+
# Service containers to run; note that this is duplicated
|
23
|
+
# in test.yml due to a limitation in GitHub Actions
|
24
|
+
# (services can only be defined per job)
|
25
|
+
services:
|
26
|
+
redis:
|
27
|
+
# Docker Hub image name
|
28
|
+
image: redis:6.2-alpine
|
29
|
+
ports: ["6379:6379"]
|
30
|
+
# Set health checks to wait until redis has started
|
31
|
+
options: >-
|
32
|
+
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout
|
33
|
+
5s --health-retries 5
|
34
|
+
|
35
|
+
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
|
36
|
+
steps:
|
37
|
+
- uses: actions/checkout@v3
|
38
|
+
with:
|
39
|
+
ref: ${{ github.head_ref }}
|
40
|
+
|
41
|
+
- uses: ./.github/actions/sisyphus
|
42
|
+
|
43
|
+
- uses: ./.github/actions/sorbet
|
44
|
+
|
45
|
+
- name: Commit Sorbet
|
46
|
+
run: |
|
47
|
+
git add .
|
48
|
+
git commit -m "[auto-rbi]: Update RBI files" || true
|
49
|
+
git push
|
@@ -0,0 +1,53 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
env:
|
11
|
+
RAILS_ENV: test
|
12
|
+
REDIS_URL: redis://localhost:6379/0
|
13
|
+
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
|
14
|
+
SLACK_LOG_URL: http://slack.com/the_log_room
|
15
|
+
|
16
|
+
# Service containers to run; note that this is duplicated
|
17
|
+
# in sorbet.yml due to a limitation in GitHub Actions
|
18
|
+
# (services can only be defined per job)
|
19
|
+
services:
|
20
|
+
redis:
|
21
|
+
# Docker Hub image name
|
22
|
+
image: redis:6.2-alpine
|
23
|
+
ports: ["6379:6379"]
|
24
|
+
# Set health checks to wait until redis has started
|
25
|
+
options: >-
|
26
|
+
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout
|
27
|
+
5s --health-retries 5
|
28
|
+
|
29
|
+
steps:
|
30
|
+
- uses: actions/checkout@v3
|
31
|
+
with:
|
32
|
+
ref: ${{github.ref}} # checkout branch not SHA
|
33
|
+
fetch-depth: 0
|
34
|
+
|
35
|
+
- uses: ./.github/actions/setup
|
36
|
+
|
37
|
+
- name: Run tests
|
38
|
+
run: |
|
39
|
+
script/ci
|
40
|
+
|
41
|
+
test-licenses:
|
42
|
+
needs: test
|
43
|
+
runs-on: ubuntu-latest
|
44
|
+
|
45
|
+
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
|
46
|
+
steps:
|
47
|
+
- uses: actions/checkout@v3
|
48
|
+
|
49
|
+
- uses: ./.github/actions/setup
|
50
|
+
|
51
|
+
- name: Verifying licenses
|
52
|
+
run: script/licenses --verify
|
53
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
cache_path: vendor/.licenses
|
2
|
+
|
3
|
+
allowed:
|
4
|
+
- apache-2.0
|
5
|
+
- bsd-2-clause
|
6
|
+
- bsd-3-clause
|
7
|
+
- isc
|
8
|
+
- mit
|
9
|
+
- cc0-1.0
|
10
|
+
- unlicense
|
11
|
+
|
12
|
+
ignored:
|
13
|
+
bundler:
|
14
|
+
- bundler-audit # GPL-3.0; but also, only used in CI/test
|
15
|
+
- ruby2_keywords # BSD-2-Clause; ignored because of custom LICENSE text
|
16
|
+
- sidekiq # LGPL-3.0; ignored because of custom LICENSE text
|
17
|
+
|
18
|
+
reviewed:
|
19
|
+
bundler:
|
20
|
+
- activerecord # MIT
|
21
|
+
- brakeman # BRAKEMAN PUBLIC USE LICENSE
|
22
|
+
- concurrent-ruby # MIT
|
23
|
+
- date # BSD-2-Clause
|
24
|
+
- dry-transformer # MIT
|
25
|
+
- json # BSD-2-Clause
|
26
|
+
- net-imap # BSD-2-Clause
|
27
|
+
- net-pop # BSD-2-Clause
|
28
|
+
- net-protocol # BSD-2-Clause
|
29
|
+
- net-smtp # BSD-2-Clause
|
30
|
+
- racc # BSD-2-Clause
|
31
|
+
- timeout # BSD-2-Clause
|
32
|
+
- websocket-driver # Apache-2.0
|
33
|
+
- websocket-extensions # Apache-2.0
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"type": "rdbg",
|
9
|
+
"name": "Attach rdbg",
|
10
|
+
"request": "attach"
|
11
|
+
},
|
12
|
+
]
|
13
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
{
|
2
|
+
"files.associations": {
|
3
|
+
"*.css": "tailwindcss",
|
4
|
+
"*.rbi": "ruby",
|
5
|
+
"*.rbupdated": "ruby",
|
6
|
+
"*.rbedited": "ruby"
|
7
|
+
},
|
8
|
+
"tailwindCSS.includeLanguages": {
|
9
|
+
"plaintext": "html"
|
10
|
+
},
|
11
|
+
"tailwindCSS.emmetCompletions": true,
|
12
|
+
"rubyLsp.enabledFeatures": {
|
13
|
+
"documentHighlights": true,
|
14
|
+
"documentLink": true,
|
15
|
+
"documentSymbols": true,
|
16
|
+
"foldingRanges": true,
|
17
|
+
"selectionRanges": true,
|
18
|
+
"semanticHighlighting": true,
|
19
|
+
"formatting": true,
|
20
|
+
"diagnostics": true,
|
21
|
+
"codeActions": true,
|
22
|
+
"onTypeFormatting": true
|
23
|
+
},
|
24
|
+
"[javascript]": {
|
25
|
+
"editor.codeActionsOnSave": {
|
26
|
+
"source.fixAll.eslint": true
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"[ruby]": {
|
30
|
+
"editor.defaultFormatter": "Shopify.ruby-lsp",
|
31
|
+
},
|
32
|
+
"peacock.color": "#26FF9A",
|
33
|
+
"workbench.colorCustomizations": {
|
34
|
+
"activityBar.activeBackground": "#59ffb2",
|
35
|
+
"activityBar.background": "#59ffb2",
|
36
|
+
"activityBar.foreground": "#15202b",
|
37
|
+
"activityBar.inactiveForeground": "#15202b99",
|
38
|
+
"activityBarBadge.background": "#c480ff",
|
39
|
+
"activityBarBadge.foreground": "#15202b",
|
40
|
+
"commandCenter.border": "#15202b99",
|
41
|
+
"sash.hoverBorder": "#59ffb2",
|
42
|
+
"statusBar.background": "#26ff9a",
|
43
|
+
"statusBar.foreground": "#15202b",
|
44
|
+
"statusBarItem.hoverBackground": "#00f281",
|
45
|
+
"statusBarItem.remoteBackground": "#26ff9a",
|
46
|
+
"statusBarItem.remoteForeground": "#15202b",
|
47
|
+
"titleBar.activeBackground": "#26ff9a",
|
48
|
+
"titleBar.activeForeground": "#15202b",
|
49
|
+
"titleBar.inactiveBackground": "#26ff9a99",
|
50
|
+
"titleBar.inactiveForeground": "#15202b99"
|
51
|
+
}
|
52
|
+
}
|
@@ -13,6 +13,7 @@ module PlugApp
|
|
13
13
|
attr_reader :app
|
14
14
|
|
15
15
|
HTTP_REQUEST_BODY = "http.request.body"
|
16
|
+
PLUG_APP_PATH_PREFIX = "/${app}/"
|
16
17
|
|
17
18
|
sig { params(app: T.untyped).void }
|
18
19
|
def initialize(app)
|
@@ -35,7 +36,11 @@ module PlugApp
|
|
35
36
|
|
36
37
|
def filtered_params(request)
|
37
38
|
params = request.params
|
38
|
-
|
39
|
+
if request.path.starts_with?(PLUG_APP_PATH_PREFIX)
|
40
|
+
{}
|
41
|
+
else
|
42
|
+
@filterer.filter(params)
|
43
|
+
end.to_json
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
@@ -1 +1,167 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"Create${APP}Message": {
|
3
|
+
"type": "object",
|
4
|
+
"required": [
|
5
|
+
"plug_installation",
|
6
|
+
"message",
|
7
|
+
"inbox"
|
8
|
+
],
|
9
|
+
"properties": {
|
10
|
+
"plug_installation": {
|
11
|
+
"type": "object",
|
12
|
+
"required": [
|
13
|
+
"id",
|
14
|
+
"settings"
|
15
|
+
],
|
16
|
+
"properties": {
|
17
|
+
"id": {
|
18
|
+
"type": "string",
|
19
|
+
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
20
|
+
},
|
21
|
+
"settings": {
|
22
|
+
"type": "object",
|
23
|
+
"required": [],
|
24
|
+
"properties": {}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"inbox": {
|
29
|
+
"type": "object",
|
30
|
+
"required": [
|
31
|
+
"id",
|
32
|
+
"organization"
|
33
|
+
],
|
34
|
+
"properties": {
|
35
|
+
"id": {
|
36
|
+
"type": "string",
|
37
|
+
"pattern": "^(?:ibx)_[A-Z0-9]{26}$"
|
38
|
+
},
|
39
|
+
"organization": {
|
40
|
+
"type": "object",
|
41
|
+
"required": [
|
42
|
+
"id",
|
43
|
+
"status"
|
44
|
+
],
|
45
|
+
"properties": {
|
46
|
+
"id": {
|
47
|
+
"type": "string",
|
48
|
+
"pattern": "^(?:org)_[A-Z0-9]{26}$"
|
49
|
+
},
|
50
|
+
"status": {
|
51
|
+
"type": "string"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
57
|
+
"message": {
|
58
|
+
"type": "object",
|
59
|
+
"required": [
|
60
|
+
"id",
|
61
|
+
"conversation",
|
62
|
+
"text_content",
|
63
|
+
"metadata"
|
64
|
+
],
|
65
|
+
"properties": {
|
66
|
+
"id": {
|
67
|
+
"type": "string",
|
68
|
+
"pattern": "^(?:msg)_[A-Z0-9]{26}$"
|
69
|
+
},
|
70
|
+
"text_content": {
|
71
|
+
"type": "string"
|
72
|
+
},
|
73
|
+
"metadata": {
|
74
|
+
"type": "object"
|
75
|
+
},
|
76
|
+
"conversation": {
|
77
|
+
"type": "object",
|
78
|
+
"required": [
|
79
|
+
"id",
|
80
|
+
"title",
|
81
|
+
"metadata"
|
82
|
+
],
|
83
|
+
"properties": {
|
84
|
+
"id": {
|
85
|
+
"type": "string",
|
86
|
+
"pattern": "^(?:cnv)_[A-Z0-9]{26}$"
|
87
|
+
},
|
88
|
+
"title": {
|
89
|
+
"type": "string"
|
90
|
+
},
|
91
|
+
"metadata": {
|
92
|
+
"type": "object"
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
},
|
99
|
+
"additionalProperties": false
|
100
|
+
},
|
101
|
+
"Create${APP}": {
|
102
|
+
"type": "object",
|
103
|
+
"required": [
|
104
|
+
"plug_installation",
|
105
|
+
"organization",
|
106
|
+
"plug",
|
107
|
+
"inbox"
|
108
|
+
],
|
109
|
+
"properties": {
|
110
|
+
"plug_installation": {
|
111
|
+
"type": "object",
|
112
|
+
"required": [
|
113
|
+
"id",
|
114
|
+
"settings"
|
115
|
+
],
|
116
|
+
"properties": {
|
117
|
+
"id": {
|
118
|
+
"type": "string",
|
119
|
+
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
120
|
+
},
|
121
|
+
"settings": {
|
122
|
+
"type": "object",
|
123
|
+
"required": [],
|
124
|
+
"properties": {}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
},
|
128
|
+
"organization": {
|
129
|
+
"type": "object",
|
130
|
+
"required": [
|
131
|
+
"id"
|
132
|
+
],
|
133
|
+
"properties": {
|
134
|
+
"id": {
|
135
|
+
"type": "string",
|
136
|
+
"pattern": "^(?:org)_[A-Z0-9]{26}$"
|
137
|
+
}
|
138
|
+
}
|
139
|
+
},
|
140
|
+
"plug": {
|
141
|
+
"type": "object",
|
142
|
+
"required": [
|
143
|
+
"id"
|
144
|
+
],
|
145
|
+
"properties": {
|
146
|
+
"id": {
|
147
|
+
"type": "string",
|
148
|
+
"pattern": "^(?:plg)_[A-Z0-9]{26}$"
|
149
|
+
}
|
150
|
+
}
|
151
|
+
},
|
152
|
+
"inbox": {
|
153
|
+
"type": "object",
|
154
|
+
"required": [
|
155
|
+
"id"
|
156
|
+
],
|
157
|
+
"properties": {
|
158
|
+
"id": {
|
159
|
+
"type": "string",
|
160
|
+
"pattern": "^(?:ibx)_[A-Z0-9]{26}$"
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
},
|
165
|
+
"additionalProperties": false
|
166
|
+
}
|
167
|
+
}
|
@@ -23,11 +23,10 @@
|
|
23
23
|
"message": {
|
24
24
|
"text_content": "Hello _World_",
|
25
25
|
"is_public": true,
|
26
|
-
"
|
27
|
-
"
|
28
|
-
|
29
|
-
|
30
|
-
}
|
26
|
+
"author": {
|
27
|
+
"name": "John Doe"
|
28
|
+
},
|
29
|
+
"metadata": {}
|
31
30
|
},
|
32
31
|
"creator": {
|
33
32
|
"id": "usr_1234567890"
|
@@ -4,7 +4,17 @@
|
|
4
4
|
"Yetto"
|
5
5
|
],
|
6
6
|
"description": "After a message is created in Yetto, this delivers it.",
|
7
|
-
"operationId": "Create a new
|
7
|
+
"operationId": "Create a new ${APP}",
|
8
|
+
"requestBody": {
|
9
|
+
"required": true,
|
10
|
+
"content": {
|
11
|
+
"application/json": {
|
12
|
+
"schema": {
|
13
|
+
"$ref": "../../components/schemas/yetto.json#/Create${APP}Message"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
},
|
8
18
|
"responses": {
|
9
19
|
"204": {
|
10
20
|
"description": "No Content",
|
data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/after_create_plug_installation.json
CHANGED
@@ -5,6 +5,16 @@
|
|
5
5
|
],
|
6
6
|
"description": "After a plug installation is created, this executes",
|
7
7
|
"operationId": "Post a thing",
|
8
|
+
"requestBody": {
|
9
|
+
"required": true,
|
10
|
+
"content": {
|
11
|
+
"application/json": {
|
12
|
+
"schema": {
|
13
|
+
"$ref": "../../components/schemas/yetto.json#/Create${APP}"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
},
|
8
18
|
"responses": {
|
9
19
|
"204": {
|
10
20
|
"description": "No Content",
|
data/templates/script/typecheck
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -26,12 +26,13 @@ module ActiveSupport
|
|
26
26
|
|
27
27
|
def assert_expected_args(expected_args)
|
28
28
|
lambda do |job_args_arr|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
expected_value = job_args_arr.first[key]
|
29
|
+
job_args_arr.first.each do |actual_args|
|
30
|
+
actual_key = actual_args.first
|
31
|
+
actual_value = actual_args.second
|
33
32
|
|
34
|
-
|
33
|
+
expected_value = expected_args[actual_key]
|
34
|
+
|
35
|
+
assert_equal(expected_value, actual_value)
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hephaestus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,6 +113,23 @@ files:
|
|
113
113
|
- lib/hephaestus/generators/rubocop_generator.rb
|
114
114
|
- lib/hephaestus/generators/sorbet_generator.rb
|
115
115
|
- lib/hephaestus/version.rb
|
116
|
+
- templates/.env.test
|
117
|
+
- templates/.github/actions/license/action.yml
|
118
|
+
- templates/.github/actions/setup/action.yml
|
119
|
+
- templates/.github/actions/sisyphus/action.yml
|
120
|
+
- templates/.github/actions/sorbet/action.yml
|
121
|
+
- templates/.github/dependabot.yml
|
122
|
+
- templates/.github/workflows/automerge.yml
|
123
|
+
- templates/.github/workflows/licenses.yml
|
124
|
+
- templates/.github/workflows/lint.yml
|
125
|
+
- templates/.github/workflows/security.yml
|
126
|
+
- templates/.github/workflows/sorbet.yml
|
127
|
+
- templates/.github/workflows/test.yml
|
128
|
+
- templates/.licensed.yml
|
129
|
+
- templates/.rubocop.yml
|
130
|
+
- templates/.vscode/extensions.json
|
131
|
+
- templates/.vscode/launch.json
|
132
|
+
- templates/.vscode/settings.json
|
116
133
|
- templates/Gemfile.erb
|
117
134
|
- templates/Procfile.debug
|
118
135
|
- templates/Procfile.dev
|
@@ -175,7 +192,10 @@ files:
|
|
175
192
|
- templates/test/controllers/root_controller_test.rb
|
176
193
|
- templates/test/controllers/settings_controller_test.rb
|
177
194
|
- templates/test/controllers/yetto_controller_test.rb
|
195
|
+
- templates/test/fixtures/files/.keep
|
196
|
+
- templates/test/integration/.keep
|
178
197
|
- templates/test/jobs/update_yetto_job_test.rb
|
198
|
+
- templates/test/mailers/.keep
|
179
199
|
- templates/test/support/api.rb
|
180
200
|
- templates/test/support/rails.rb
|
181
201
|
- templates/test/support/webmocks.rb
|
@@ -195,14 +215,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
215
|
requirements:
|
196
216
|
- - ">="
|
197
217
|
- !ruby/object:Gem::Version
|
198
|
-
version: 3.
|
218
|
+
version: 3.2.1
|
199
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
220
|
requirements:
|
201
|
-
- - "
|
221
|
+
- - ">="
|
202
222
|
- !ruby/object:Gem::Version
|
203
|
-
version:
|
223
|
+
version: 3.4.7
|
204
224
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
225
|
+
rubygems_version: 3.4.8
|
206
226
|
signing_key:
|
207
227
|
specification_version: 4
|
208
228
|
summary: Generate a Rails app that can be used to create plugs for Yetto.
|