hephaestus 0.8.13 → 0.8.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/bin/hephaestus +10 -1
  4. data/config/queue.yml +1 -2
  5. data/lib/hephaestus/app_name.rb +4 -4
  6. data/lib/hephaestus/engine.rb +1 -1
  7. data/lib/hephaestus/generators/app_generator.rb +19 -10
  8. data/lib/hephaestus/middleware/openapi_validation.rb +1 -0
  9. data/lib/hephaestus/version.rb +1 -1
  10. data/script/templates/edit-credentials +38 -0
  11. data/script/templates/setup-vault +29 -0
  12. data/script/templates/vault.json +68 -0
  13. data/templates/app/controllers/concerns/authable.rb.tt +0 -1
  14. data/templates/app/jobs/application_job.rb +3 -6
  15. data/templates/config/locales/en.yml.tt +5 -0
  16. data/templates/config/locales/settings/en.yml.tt +6 -0
  17. data/templates/lib/schemas/api/2023-03-06/components/schemas/{yetto.json → yetto.json.tt} +2 -2
  18. data/templates/lib/schemas/api/2023-03-06/paths/yetto/plug_installation_created.json +1 -1
  19. data/templates/root/Procfile +1 -0
  20. data/templates/root/README.md.tt +4 -0
  21. data/templates/root/Rakefile +8 -0
  22. data/templates/root/hephaestus_gitignore +1 -0
  23. data/templates/script/edit-credentials +1 -34
  24. data/templates/script/ngrok.tt +1 -1
  25. data/templates/test/controllers/app_controller_test.rb.tt +8 -7
  26. data/templates/test/controllers/yetto_controller_test.rb +1 -1
  27. data/templates/test/jobs/some_job_test.rb +7 -0
  28. metadata +14 -20
  29. data/templates/config/locales/en.yml +0 -6
  30. data/templates/config/locales/settings/en.yml +0 -5
  31. data/templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/headers/yetto.json +0 -42
  32. data/templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/plugInstallation.json +0 -12
  33. data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/plug.json +0 -9
  34. data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/responses.json +0 -64
  35. data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/yetto.json +0 -116
  36. data/templates/lib/plug_app/schemas/api/2023-03-06/openapi.json +0 -30
  37. data/templates/lib/plug_app/schemas/api/2023-03-06/paths/plug.json +0 -90
  38. data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/message_created.json +0 -51
  39. data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/plug_installation_created.json +0 -51
  40. data/templates/script/ci +0 -7
  41. data/templates/script/test +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f10ca0de88c450f5e8febca532d785bb3e0b9ae1392e84a89e5bc69822936bf4
4
- data.tar.gz: 5558246e1b43416722c74d86f35527b39894834524bb863c9cc7380233b661c5
3
+ metadata.gz: 351e1e10bdbe87d1060a074493567578397261bc988cdfd9ad5e181f183aaadf
4
+ data.tar.gz: 3627d0becfc5c75f52f53d5d14edc7b60d413ed9ba3c07120b4e9f4072e923b7
5
5
  SHA512:
6
- metadata.gz: c38a22b9ac3409157e42f26aea6b82ea3b488c984b43e18918c8d4cf12aee16ec446fad81aa0d04cecad9ad5676130e4cc0990605d8502f2131af37e3d44d152
7
- data.tar.gz: 04aa1224bad239a6f7ef662d1f00a61ffb0a560ab882472e7afcad07f820600f7f3e6f2aa70ef639338abfa5264f6544b99e096f75f0b4922c79425a77598ed9
6
+ metadata.gz: ca673429b1da48268c99b94f2add25c2e874f45f7ee4f0203b48a1a7d4396fa7088a1b5564ee0108da962112b54f62bd7db92214671a9917a14b33cb65f273ea
7
+ data.tar.gz: 524baa78665bc9c78e270c16d5b12646ff0a749b46471d2b1670df04391c259649a8543666132389decebc6d0445eb861b0fd59aa9479628fafda9076f047a35
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [v0.8.15] - 15-01-2025
2
+ ## What's Changed
3
+ * Move hephaestus' plug scripts to subfolder + other fixups by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/104
4
+
5
+
6
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.14...v0.8.15
7
+ # [v0.8.14] - 19-12-2024
8
+ ## What's Changed
9
+ * Add scripting logic to Hephaestus by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/102
10
+
11
+
12
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.13...v0.8.14
1
13
  # [v0.8.13] - 17-12-2024
2
14
  ## What's Changed
3
15
  * Move content to clio by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/99
data/bin/hephaestus CHANGED
@@ -97,4 +97,13 @@ config.keys.each do |key|
97
97
  config.delete(key) if delete_keys
98
98
  end
99
99
 
100
- Hephaestus::AppGenerator.start
100
+
101
+ case ARGV[0]
102
+ when "run"
103
+ ENV["HEPHAESTUS_CAPITAL_PLUG_NAME"] = `grep 'module Plug\S*' config/application.rb | sed -E 's/module Plug//'`.strip
104
+ ENV["HEPHAESTUS_LOWERCASE_PLUG_NAME"] = ENV["HEPHAESTUS_CAPITAL_PLUG_NAME"].underscore
105
+ script_dir = File.join(ENGINE_ROOT, "script", "templates")
106
+ puts `#{File.join(script_dir, ARGV[1..-1].join(' '))}`
107
+ else
108
+ Hephaestus::AppGenerator.start
109
+ end
data/config/queue.yml CHANGED
@@ -4,9 +4,8 @@ default: &default
4
4
  batch_size: 500
5
5
  workers:
6
6
  - queues: [plug_<%= plug_shortname %>_high_priority*, plug_<%= plug_shortname %>_mid_priority*, plug_<%= plug_shortname %>_low_priority*]
7
- threads: 5
8
7
  - queues: "plug_<%= plug_shortname %>_*" # default, mailers, etc
9
- threads: 3
8
+ threads: 1
10
9
 
11
10
  development:
12
11
  <<: *default
@@ -10,22 +10,22 @@ module Hephaestus
10
10
  "plug-#{Rails.application.class.module_parent.name.underscore[5..-1]}"
11
11
  end
12
12
 
13
- # like, `slack`
13
+ # like, `slack`, `github`, or `html_proofer`
14
14
  def plug_name
15
15
  app_name.split("-", 2).last
16
16
  end
17
17
 
18
- # like, `Slack`, or `html_proofer => HtmlProofer`
18
+ # like, `Slack`, `GitHub`, or `HtmlProofer`
19
19
  def capital_plug_name
20
20
  plug_name.camelcase
21
21
  end
22
22
 
23
- # like, `SLACK`
23
+ # like, `SLACK` `GITHUB`, or `HTML_PROOFER`
24
24
  def upcase_plug_name
25
25
  plug_name.upcase
26
26
  end
27
27
 
28
- # like, `slack`, or `HTMLProofer => html_proofer``
28
+ # like, `slack`, `github`, or `html_proofer`
29
29
  def underscore_plug_name
30
30
  plug_name.underscore
31
31
  end
@@ -71,7 +71,7 @@ module Hephaestus
71
71
 
72
72
  def op_read(label)
73
73
  %x(#{include_sudo?}op read "#{label}").chomp.tap do
74
- raise "Failed to fetch `#{label}` from 1Password" unless $CHILD_STATUS.success?
74
+ Rails.logger.error("Failed to fetch `#{label}` from 1Password") && return unless $CHILD_STATUS.success?
75
75
  end
76
76
  end
77
77
 
@@ -142,7 +142,7 @@ module Hephaestus
142
142
  directory(source, "test", force: true)
143
143
 
144
144
  # This must be here, rather than a generator, because generators are run in a Rails environment,
145
- # and the OpenAPI middleware, which is loaded when the app boots, requires the schema files to be present.
145
+ # and the OpenAPI middleware, which is loaded when the app boots, requires the lib/schemas files to be present.
146
146
  directory("lib/schemas/api/2023-03-06", "lib/schemas/api/2023-03-06")
147
147
 
148
148
  # we do this to specify the template source, otherwise the generator wants to use Rails own `bin` dir
@@ -151,7 +151,7 @@ module Hephaestus
151
151
  chmod_dir("bin")
152
152
 
153
153
  # we do this to specify the template source, otherwise the generator wants to use Rails' own dir
154
- ["controllers", "jobs", "services", "views"].each do |dir|
154
+ ["controllers", "jobs", "lib", "services", "views"].each do |dir|
155
155
  source = File.join(Hephaestus::Engine.root, "templates", "app", dir)
156
156
  directory(source, "app/#{dir}", force: true)
157
157
  end
@@ -182,7 +182,9 @@ module Hephaestus
182
182
  File.rename(File.join(destination_root, "lib", "schemas", "api", "2023-03-06", "paths", "app.json"), File.join(destination_root, "lib", "schemas", "api", "2023-03-06", "paths", "#{plug_name}.json"))
183
183
 
184
184
  Dir.chdir(shell.base.result_dir) do
185
- unless ENV.fetch("HEPHAESTUS_NO_EXTERNAL", "0") == "1"
185
+ if ENV.fetch("HEPHAESTUS_NO_EXTERNAL", "0") == "1"
186
+ say(set_color("Not installing gems...", :yellow))
187
+ else
186
188
  say(set_color("Installing gems...", :cyan))
187
189
  capture_stdout do
188
190
  run("bundle install", abort_on_failure: false)
@@ -232,15 +234,22 @@ module Hephaestus
232
234
  def first_commit
233
235
  say(set_color("Creating first commit...", :cyan))
234
236
 
237
+ result = nil
235
238
  Dir.chdir(shell.base.result_dir) do
236
- capture_stdout do
237
- run("git init")
238
- run("git remote add origin https://github.com/yettoapp/#{app_name}.git")
239
- run("git branch -m production")
239
+ # capture_stdout do
240
+ run("git init")
241
+ run("git branch -m production")
240
242
 
241
- run("git add .")
242
- run("git commit -m 'Initial commit'", capture: true)
243
- end
243
+ run("git add .")
244
+ run("git commit -m 'Initial commit'", capture: true)
245
+
246
+ result = run("gh repo create yettoapp/#{app_name} --private --source . --push")
247
+ # end
248
+ end
249
+
250
+ unless result
251
+ say(set_color("Could not create repository on GitHub! Do you have the `gh` cli installed? ", :red))
252
+ sleep(3)
244
253
  end
245
254
  end
246
255
 
@@ -41,6 +41,7 @@ module Hephaestus
41
41
  else
42
42
  case validated_request.error.type
43
43
  when :not_found
44
+ Rails.logger.error("Request path not found. Is it defined in openai.json? ") if print_user_api_errors?
44
45
  [Hephaestus::HTTP::NOT_FOUND_I, { "Content-Type" => "application/json" }, [format_str("Not Found")]]
45
46
  else
46
47
  error_message = if validated_request.error.errors.present?
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Hephaestus
5
- VERSION = "0.8.13"
5
+ VERSION = "0.8.15"
6
6
  RAILS_VERSION = ">= 8.0"
7
7
  RUBY_VERSION = File
8
8
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ # Initialize flags
6
+ development=false
7
+ staging=false
8
+ production=false
9
+
10
+ # Check for and parse flags
11
+ for arg in "$@"
12
+ do
13
+ case $arg in
14
+ --development)
15
+ development=true
16
+ ;;
17
+ --staging)
18
+ staging=true
19
+ ;;
20
+ --production)
21
+ production=true
22
+ ;;
23
+ *)
24
+ # Unknown arguments can be ignored or handled here
25
+ ;;
26
+ esac
27
+ done
28
+
29
+ if [[ $development == true ]]; then
30
+ RAILS_MASTER_KEY=$(op read "op://Plug-$HEPHAESTUS_CAPITAL_PLUG_NAME/Development Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e development
31
+ elif [[ $staging == true ]]; then
32
+ RAILS_MASTER_KEY=$(op read "op://Plug-$HEPHAESTUS_CAPITAL_PLUG_NAME/Staging Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e staging
33
+ elif [[ $production == true ]]; then
34
+ RAILS_MASTER_KEY=$(op read "op://Plug-$HEPHAESTUS_CAPITAL_PLUG_NAME/Production Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e production
35
+ else
36
+ echo "Please specify a target environment with one of the following flags: --development, --staging, --production"
37
+ exit 1
38
+ fi
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+
6
+ # Get the current file location and its parent directory
7
+ current_file_location=$(realpath "$0")
8
+ parent_dir=$(dirname "$current_file_location")
9
+
10
+ vault_name="Plug-$HEPHAESTUS_CAPITAL_PLUG_NAME"
11
+ op vault create "$vault_name"
12
+
13
+ op item create \
14
+ --template="$parent_dir/vault.json" \
15
+ --vault "$vault_name" \
16
+ --title "Development secrets" \
17
+ --tags 'development'
18
+
19
+ op item create \
20
+ --template="$parent_dir/vault.json" \
21
+ --vault "$vault_name" \
22
+ --title "Staging secrets" \
23
+ --tags 'staging'
24
+
25
+ op item create \
26
+ --template="$parent_dir/vault.json" \
27
+ --vault "$vault_name" \
28
+ --title "Production secrets" \
29
+ --tags 'production'
@@ -0,0 +1,68 @@
1
+ {
2
+ "title": "",
3
+ "vault": {
4
+ "name": ""
5
+ },
6
+ "category": "SECURE_NOTE",
7
+ "sections": [
8
+ {
9
+ "id": "Yetto",
10
+ "label": "Yetto"
11
+ },
12
+ {
13
+ "id": "Unique",
14
+ "label": "Unique"
15
+ },
16
+ {
17
+ "id": "Common",
18
+ "label": "Common"
19
+ }
20
+ ],
21
+ "fields": [
22
+ {
23
+ "id": "YETTO_SIGNING_SECRET",
24
+ "section": {
25
+ "id": "Yetto"
26
+ },
27
+ "type": "CONCEALED",
28
+ "label": "YETTO_SIGNING_SECRET",
29
+ "value": "xxx"
30
+ },
31
+ {
32
+ "id": "YETTO_PLUG_PEM",
33
+ "section": {
34
+ "id": "Yetto"
35
+ },
36
+ "type": "CONCEALED",
37
+ "label": "YETTO_PLUG_PEM",
38
+ "value": "xxx"
39
+ },
40
+ {
41
+ "id": "YETTO_PLUG_ID",
42
+ "section": {
43
+ "id": "Yetto"
44
+ },
45
+ "type": "CONCEALED",
46
+ "label": "YETTO_PLUG_ID",
47
+ "value": "xxx"
48
+ },
49
+ {
50
+ "id": "NONCE",
51
+ "section": {
52
+ "id": "Unique"
53
+ },
54
+ "type": "CONCEALED",
55
+ "label": "NONCE",
56
+ "value": "xxx"
57
+ },
58
+ {
59
+ "id": "RAILS_MASTER_KEY",
60
+ "section": {
61
+ "id": "Common"
62
+ },
63
+ "type": "CONCEALED",
64
+ "label": "RAILS_MASTER_KEY",
65
+ "value": "xxx"
66
+ }
67
+ ]
68
+ }
@@ -15,7 +15,6 @@ module Authable
15
15
  sig { void }
16
16
  def <%= plug_name %>_calling_back?
17
17
  state = params.fetch(:state, "")
18
- state = params.fetch(:state, "")
19
18
 
20
19
  state_obj = parse_state(state)
21
20
  nonce = state_obj.fetch(:nonce, "")
@@ -1,10 +1,7 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
- class ApplicationJob < ActiveJob::Base
5
- # Automatically retry jobs that encountered a deadlock
6
- # retry_on ActiveRecord::Deadlocked
7
-
8
- # Most jobs are safe to ignore if the underlying records are no longer available
9
- # discard_on ActiveJob::DeserializationError
4
+ class ApplicationJob < Hephaestus::ApplicationJob
5
+ # TODO: Add whatever configuration you need here;
6
+ # note that Hephaestus sets some defaults for you already.
10
7
  end
@@ -0,0 +1,5 @@
1
+ # Files in the config/locales directory are used for internationalization and
2
+ # are automatically loaded by Rails. If you want to use locales other than
3
+ # English, add the necessary files in this directory.
4
+
5
+ en:
@@ -0,0 +1,6 @@
1
+ en:
2
+ new_step_one_heading: "Before you continue..."
3
+ new_step_one_text: "This plug will ask you if the Yetto app can authorize with your <%= capital_plug_name %> account. Make sure you're an admin who is able to install apps."
4
+ new_step_two_heading: "Authenticate with Yetto's <%= capital_plug_name %> app"
5
+ new_step_two_text: "This will connect our <%= capital_plug_name %> app with your Yetto org"
6
+ new_step_two_oauth_button: "Click to auth with <%= capital_plug_name %>"
@@ -1,5 +1,5 @@
1
1
  {
2
- "CreateAppMessage": {
2
+ "Create<%= capital_plug_name %>Message": {
3
3
  "type": "object",
4
4
  "required": [
5
5
  "yetto"
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "additionalProperties": false
79
79
  },
80
- "ConfigureApp": {
80
+ "CreatedPlugInstallation": {
81
81
  "type": "object",
82
82
  "required": [
83
83
  "yetto"
@@ -10,7 +10,7 @@
10
10
  "content": {
11
11
  "application/json": {
12
12
  "schema": {
13
- "$ref": "../../components/schemas/yetto.json#/ConfigureApp"
13
+ "$ref": "../../components/schemas/yetto.json#/CreatedPlugInstallation"
14
14
  }
15
15
  }
16
16
  }
@@ -1,2 +1,3 @@
1
1
  web: $SERVER_CMD # defined in script/server
2
2
  supervisor: bin/jobs -c "$(bundle show hephaestus)/config/queue.yml"
3
+ ngrok: script/ngrok
@@ -1 +1,5 @@
1
1
  # <%= app_name.titlecase %>
2
+
3
+ Start your server with `script/server`, or `script/server --debug` to enable debugging.
4
+
5
+ Your plug is available at `${hostname}-plug-<%= plug_name %>.ngrok.io:6661`.
@@ -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
@@ -294,3 +294,4 @@ app/javascript/controllers/*.js
294
294
  !app/javascript/controllers/index.js
295
295
 
296
296
  security_results.json
297
+ vendor/cache/
@@ -2,37 +2,4 @@
2
2
 
3
3
  set -e
4
4
 
5
- # Initialize flags
6
- development=false
7
- staging=false
8
- production=false
9
-
10
- # Check for and parse flags
11
- for arg in "$@"
12
- do
13
- case $arg in
14
- --development)
15
- development=true
16
- ;;
17
- --staging)
18
- staging=true
19
- ;;
20
- --production)
21
- production=true
22
- ;;
23
- *)
24
- # Unknown arguments can be ignored or handled here
25
- ;;
26
- esac
27
- done
28
-
29
- if [[ $development == true ]]; then
30
- RAILS_MASTER_KEY=$(op read "op://Plug-Email/Development Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e development
31
- elif [[ $staging == true ]]; then
32
- RAILS_MASTER_KEY=$(op read "op://Plug-Email/Staging Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e staging
33
- elif [[ $production == true ]]; then
34
- RAILS_MASTER_KEY=$(op read "op://Plug-Email/Production Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e production
35
- else
36
- echo "Please specify a target environment with one of the following flags: --development, --staging, --production"
37
- exit 1
38
- fi
5
+ bundle exec hephaestus run edit-credentials "$1"
@@ -4,4 +4,4 @@ set -e
4
4
 
5
5
  hostname="$(hostname | tr '[:upper:]' '[:lower:]' | tr '.' '-')"
6
6
 
7
- ngrok http --region=us --domain=${hostname}-plug-<%= plug_name %>.ngrok.io 6661
7
+ ngrok http --domain=${hostname}-plug-<%= plug_name %>.ngrok.io 6661
@@ -176,13 +176,14 @@ class <%= capital_plug_name %>ControllerTest < ActionDispatch::IntegrationTest
176
176
  assert_response :bad_request
177
177
  end
178
178
 
179
- test "webhook passes to job when issue_comment is created" do
180
- assert_enqueued_with(job: Process<%= capital_plug_name %>IssueCommentJob) do
181
- plug(:post, "/webhook", body: @valid_issue_comment_created_webhook_body, headers: { "HTTP_X_GITHUB_EVENT" => "issue_comment", "HTTP_X_HUB_SIGNATURE_256" => auth_header(@valid_issue_comment_created_webhook_body) })
182
- end
179
+ # TODO: Add your own controller tests here; for example
183
180
 
184
- assert_response :ok
185
- end
181
+ # test "webhook passes to job when issue_comment is created" do
182
+ # assert_enqueued_with(job: Process<%= capital_plug_name %>IssueCommentJob) do
183
+ # plug(:post, "/webhook", body: @valid_issue_comment_created_webhook_body, headers: { "HTTP_X_GITHUB_EVENT" => "issue_comment", "HTTP_X_HUB_SIGNATURE_256" => auth_header(@valid_issue_comment_created_webhook_body) })
184
+ # end
185
+ #
186
+ # assert_response :ok
187
+ # end
186
188
 
187
- # TODO: Add your own controller tests here
188
189
  end
@@ -104,7 +104,7 @@ class YettoControllerTest < ActionDispatch::IntegrationTest
104
104
  assert_response :bad_request
105
105
  end
106
106
 
107
- test "it performs some job to do something to your platform" do
107
+ test "it performs **SomeJob** to **do something** to your platform" do
108
108
  incoming_body = @after_create_message
109
109
 
110
110
  job_args = {
@@ -0,0 +1,7 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require "test_helper"
5
+
6
+ class SomeJobTest < ActiveJob::TestCase
7
+ 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.8.13
4
+ version: 0.8.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2025-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap
@@ -377,7 +377,7 @@ dependencies:
377
377
  description: 'Hephaestus is a Rails generator to create plugs for Yetto.
378
378
 
379
379
  '
380
- email:
380
+ email:
381
381
  executables:
382
382
  - hephaestus
383
383
  extensions: []
@@ -445,6 +445,9 @@ files:
445
445
  - lib/hephaestus/version.rb
446
446
  - lib/tasks/hephaestus_tasks.rake
447
447
  - lib/tasks/rubocop.rake
448
+ - script/templates/edit-credentials
449
+ - script/templates/setup-vault
450
+ - script/templates/vault.json
448
451
  - templates/app/controllers/app_controller.rb.tt
449
452
  - templates/app/controllers/application_controller.rb
450
453
  - templates/app/controllers/concerns/authable.rb.tt
@@ -470,8 +473,8 @@ files:
470
473
  - templates/config/environment.rb
471
474
  - templates/config/environments/blank.rb
472
475
  - templates/config/initializers/environment.rb
473
- - templates/config/locales/en.yml
474
- - templates/config/locales/settings/en.yml
476
+ - templates/config/locales/en.yml.tt
477
+ - templates/config/locales/settings/en.yml.tt
475
478
  - templates/config/puma.rb
476
479
  - templates/config/routes.rb.tt
477
480
  - templates/db/queue_schema.rb
@@ -488,20 +491,11 @@ files:
488
491
  - templates/hephaestus_vscode/extensions.json
489
492
  - templates/hephaestus_vscode/launch.json
490
493
  - templates/hephaestus_vscode/settings.json
491
- - templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/headers/yetto.json
492
- - templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/plugInstallation.json
493
- - templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/plug.json
494
- - templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/responses.json
495
- - templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/yetto.json
496
- - templates/lib/plug_app/schemas/api/2023-03-06/openapi.json
497
- - templates/lib/plug_app/schemas/api/2023-03-06/paths/plug.json
498
- - templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/message_created.json
499
- - templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/plug_installation_created.json
500
494
  - templates/lib/schemas/api/2023-03-06/components/parameters/headers/yetto.json
501
495
  - templates/lib/schemas/api/2023-03-06/components/parameters/plugInstallation.json
502
496
  - templates/lib/schemas/api/2023-03-06/components/schemas/plug.json
503
497
  - templates/lib/schemas/api/2023-03-06/components/schemas/responses.json
504
- - templates/lib/schemas/api/2023-03-06/components/schemas/yetto.json
498
+ - templates/lib/schemas/api/2023-03-06/components/schemas/yetto.json.tt
505
499
  - templates/lib/schemas/api/2023-03-06/openapi.json
506
500
  - templates/lib/schemas/api/2023-03-06/paths/app.json
507
501
  - templates/lib/schemas/api/2023-03-06/paths/yetto/message_created.json
@@ -511,6 +505,7 @@ files:
511
505
  - templates/root/Gemfile
512
506
  - templates/root/Procfile
513
507
  - templates/root/README.md.tt
508
+ - templates/root/Rakefile
514
509
  - templates/root/compose.yml
515
510
  - templates/root/config.ru
516
511
  - templates/root/hephaestus_dockerignore
@@ -520,7 +515,6 @@ files:
520
515
  - templates/root/hephaestus_licensed.yml
521
516
  - templates/root/hephaestus_rubocop.yml
522
517
  - templates/root/hephaestus_ruby-version
523
- - templates/script/ci
524
518
  - templates/script/docker-build-prod.tt
525
519
  - templates/script/docker-run.tt
526
520
  - templates/script/edit-credentials
@@ -529,7 +523,6 @@ files:
529
523
  - templates/script/ngrok.tt
530
524
  - templates/script/server
531
525
  - templates/script/sorbet
532
- - templates/script/test
533
526
  - templates/sorbet/custom.rbi
534
527
  - templates/test/controllers/app_controller_test.rb.tt
535
528
  - templates/test/controllers/application_controller_test.rb
@@ -539,6 +532,7 @@ files:
539
532
  - templates/test/fixtures/files/fake_pem_file/fake.pem
540
533
  - templates/test/fixtures/files/plug_installation_settings/invalid.json
541
534
  - templates/test/fixtures/files/plug_installation_settings/valid.json
535
+ - templates/test/jobs/some_job_test.rb
542
536
  - templates/test/support/rails.rb
543
537
  - templates/test/support/webmocks/app_webmock.rb.tt
544
538
  - templates/test/test_helper.rb
@@ -548,7 +542,7 @@ homepage: http://github.com/yettoapp/hephaestus
548
542
  licenses:
549
543
  - MIT
550
544
  metadata: {}
551
- post_install_message:
545
+ post_install_message:
552
546
  rdoc_options:
553
547
  - "--charset=UTF-8"
554
548
  require_paths:
@@ -566,7 +560,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
566
560
  version: 3.4.7
567
561
  requirements: []
568
562
  rubygems_version: 3.5.22
569
- signing_key:
563
+ signing_key:
570
564
  specification_version: 4
571
565
  summary: Generate a Rails app that can be used to create plugs for Yetto.
572
566
  test_files: []
@@ -1,6 +0,0 @@
1
- en:
2
- new_step_one_heading: "Before you continue..."
3
- new_step_one_text: "This plug can only be installed"
4
- new_step_two_heading: "Authenticate"
5
- new_step_two_text: "This will connect your previously installed app with your Yetto org"
6
- new_step_two_oauth_button: "Click to auth with"
@@ -1,5 +0,0 @@
1
- en:
2
- some_example_heading: "From name"
3
- some_example_label: "Some example"
4
- another_example_heading: "Reply-to email address"
5
- another_example_label: "Another example"
@@ -1,42 +0,0 @@
1
- {
2
- "Event": {
3
- "name": "X-Yetto-Event",
4
- "in": "header",
5
- "description": "The event from Yetto",
6
- "required": true,
7
- "schema": {
8
- "type": "string",
9
- "pattern": "^{created|updated|destroyed}$"
10
- }
11
- },
12
- "RecordType": {
13
- "name": "X-Yetto-RecordType",
14
- "in": "header",
15
- "description": "The record type from Yetto",
16
- "required": true,
17
- "schema": {
18
- "type": "string",
19
- "pattern": "^[a-z_]+$"
20
- }
21
- },
22
- "DeliveryID": {
23
- "name": "X-Yetto-DeliveryID",
24
- "in": "header",
25
- "description": "The delivery ID from Yetto",
26
- "required": true,
27
- "schema": {
28
- "type": "string",
29
- "pattern": "^[a-z0-9-]+$"
30
- }
31
- },
32
- "Signature": {
33
- "name": "X-Yetto-Signature",
34
- "in": "header",
35
- "description": "The signature from Yetto",
36
- "required": true,
37
- "schema": {
38
- "type": "string",
39
- "pattern": "^sha256=[a-f0-9]{64}$"
40
- }
41
- }
42
- }
@@ -1,12 +0,0 @@
1
- {
2
- "plugInstallationId": {
3
- "name": "plugInstallationId",
4
- "in": "path",
5
- "description": "The plug installation's unique ID",
6
- "required": true,
7
- "schema": {
8
- "type": "string",
9
- "pattern": "^pli_[A-Z0-9]{26}$"
10
- }
11
- }
12
- }
@@ -1,9 +0,0 @@
1
- {
2
- "InboundWebhook": {
3
- "type": "object",
4
- "required": [
5
- "From"
6
- ],
7
- "properties": {}
8
- }
9
- }
@@ -1,64 +0,0 @@
1
- {
2
- "202": {
3
- "type": "object",
4
- "required": [
5
- "message"
6
- ],
7
- "properties": {
8
- "message": {
9
- "type": "string",
10
- "value": "Accepted"
11
- }
12
- }
13
- },
14
- "204": {
15
- "type": "object",
16
- "required": [
17
- "message"
18
- ],
19
- "properties": {
20
- "message": {
21
- "type": "string",
22
- "value": "No Content"
23
- }
24
- }
25
- },
26
- "400": {
27
- "type": "object",
28
- "required": [
29
- "errors"
30
- ],
31
- "properties": {
32
- "errors": {
33
- "type": "array",
34
- "items": {
35
- "type": "object",
36
- "properties": {
37
- "message": {
38
- "type": "string"
39
- }
40
- }
41
- }
42
- }
43
- }
44
- },
45
- "404": {
46
- "type": "object",
47
- "required": [
48
- "errors"
49
- ],
50
- "properties": {
51
- "errors": {
52
- "type": "array",
53
- "items": {
54
- "type": "object",
55
- "properties": {
56
- "message": {
57
- "type": "string"
58
- }
59
- }
60
- }
61
- }
62
- }
63
- }
64
- }
@@ -1,116 +0,0 @@
1
- {
2
- "CreateAppMessage": {
3
- "type": "object",
4
- "required": [
5
- "yetto"
6
- ],
7
- "properties": {
8
- "yetto": {
9
- "type": "object",
10
- "required": [
11
- "plug_installation",
12
- "message"
13
- ],
14
- "properties": {
15
- "plug_installation": {
16
- "type": "object",
17
- "required": [
18
- "id",
19
- "settings"
20
- ],
21
- "properties": {
22
- "id": {
23
- "type": "string",
24
- "pattern": "^(?:pli)_[A-Z0-9]{26}$"
25
- },
26
- "settings": {
27
- "type": "object",
28
- "required": [],
29
- "properties": {}
30
- }
31
- }
32
- },
33
- "message": {
34
- "type": "object",
35
- "required": [
36
- "id",
37
- "conversation",
38
- "text_content",
39
- "metadata"
40
- ],
41
- "properties": {
42
- "id": {
43
- "type": "string",
44
- "pattern": "^(?:msg)_[A-Z0-9]{26}$"
45
- },
46
- "text_content": {
47
- "type": "string"
48
- },
49
- "metadata": {
50
- "type": "object"
51
- },
52
- "conversation": {
53
- "type": "object",
54
- "required": [
55
- "id",
56
- "title",
57
- "metadata"
58
- ],
59
- "properties": {
60
- "id": {
61
- "type": "string",
62
- "pattern": "^(?:cnv)_[A-Z0-9]{26}$"
63
- },
64
- "title": {
65
- "type": "string"
66
- },
67
- "metadata": {
68
- "type": "object"
69
- }
70
- }
71
- }
72
- }
73
- }
74
- },
75
- "additionalProperties": false
76
- }
77
- },
78
- "additionalProperties": false
79
- },
80
- "ConfigureApp": {
81
- "type": "object",
82
- "required": [
83
- "yetto"
84
- ],
85
- "properties": {
86
- "yetto": {
87
- "type": "object",
88
- "required": [
89
- "plug_installation",
90
- ],
91
- "properties": {
92
- "plug_installation": {
93
- "type": "object",
94
- "required": [
95
- "id",
96
- "settings"
97
- ],
98
- "properties": {
99
- "id": {
100
- "type": "string",
101
- "pattern": "^(?:pli)_[A-Z0-9]{26}$"
102
- },
103
- "settings": {
104
- "type": "object",
105
- "required": [],
106
- "properties": {}
107
- }
108
- }
109
- }
110
- },
111
- "additionalProperties": false
112
- }
113
- },
114
- "additionalProperties": false
115
- }
116
- }
@@ -1,30 +0,0 @@
1
- {
2
- "openapi": "3.0.0",
3
- "info": {
4
- "title": "App Plug API",
5
- "description": "An OpenAPI definition for the App Plug REST API.",
6
- "version": "2023-03-06",
7
- "termsOfService": "https://yetto.app/terms/",
8
- "license": {
9
- "name": "Apache 2.0",
10
- "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
11
- }
12
- },
13
- "servers": [
14
- {
15
- "url": "https://yetto.app/2023-03-06",
16
- "description": "Production basepath"
17
- }
18
- ],
19
- "paths": {
20
- "/api/2023-03-06/plug_installation/created": {
21
- "$ref": "paths/yetto/plug_installation_created.json"
22
- },
23
- "/api/2023-03-06/message/created": {
24
- "$ref": "paths/yetto/message_created.json"
25
- },
26
- "/app/2023-03-06/{plugInstallationId}": {
27
- "$ref": "paths/app.json"
28
- }
29
- }
30
- }
@@ -1,90 +0,0 @@
1
- {
2
- "post": {
3
- "tags": [
4
- "Inbound",
5
- "App"
6
- ],
7
- "description": "This represents something",
8
- "operationId": "Post a Yetto message",
9
- "parameters": [
10
- {
11
- "$ref": "../components/parameters/plugInstallation.json#/plugInstallationId"
12
- }
13
- ],
14
- "requestBody": {
15
- "required": true,
16
- "content": {
17
- "application/json": {
18
- "schema": {
19
- "$ref": "../components/schemas/plug.json#/something"
20
- }
21
- },
22
- "example": {
23
- "message": {
24
- "text_content": "Hello _World_",
25
- "is_public": true,
26
- "author": {
27
- "name": "John Doe"
28
- },
29
- "metadata": {}
30
- },
31
- "creator": {
32
- "id": "usr_1234567890"
33
- }
34
- }
35
- }
36
- },
37
- "responses": {
38
- "202": {
39
- "description": "Accepted",
40
- "content": {
41
- "application/json": {
42
- "schema": {
43
- "$ref": "../components/schemas/responses.json#/202"
44
- }
45
- }
46
- }
47
- },
48
- "204": {
49
- "description": "No Content",
50
- "content": {
51
- "application/json": {
52
- "schema": {
53
- "$ref": "../components/schemas/responses.json#/204"
54
- }
55
- }
56
- }
57
- },
58
- "400": {
59
- "description": "Bad Request",
60
- "content": {
61
- "application/json": {
62
- "schema": {
63
- "$ref": "../components/schemas/responses.json#/400"
64
- }
65
- }
66
- }
67
- },
68
- "403": {
69
- "description": "Forbidden",
70
- "content": {
71
- "application/json": {
72
- "schema": {
73
- "$ref": "../components/schemas/responses.json#/403"
74
- }
75
- }
76
- }
77
- },
78
- "503": {
79
- "description": "Service Unavailable",
80
- "content": {
81
- "application/json": {
82
- "schema": {
83
- "$ref": "../components/schemas/responses.json#/502"
84
- }
85
- }
86
- }
87
- }
88
- }
89
- }
90
- }
@@ -1,51 +0,0 @@
1
- {
2
- "post": {
3
- "tags": [
4
- "Yetto"
5
- ],
6
- "description": "After a message is created in Yetto, this delivers it.",
7
- "operationId": "Create a new message",
8
- "requestBody": {
9
- "required": true,
10
- "content": {
11
- "application/json": {
12
- "schema": {
13
- "$ref": "../../components/schemas/yetto.json#/CreateAppMessage"
14
- }
15
- }
16
- }
17
- },
18
- "responses": {
19
- "204": {
20
- "description": "No Content",
21
- "content": {
22
- "application/json": {
23
- "schema": {
24
- "$ref": "../../components/schemas/responses.json#/204"
25
- }
26
- }
27
- }
28
- },
29
- "400": {
30
- "description": "Bad Request",
31
- "content": {
32
- "application/json": {
33
- "schema": {
34
- "$ref": "../../components/schemas/responses.json#/400"
35
- }
36
- }
37
- }
38
- },
39
- "404": {
40
- "description": "Not Found",
41
- "content": {
42
- "application/json": {
43
- "schema": {
44
- "$ref": "../../components/schemas/responses.json#/404"
45
- }
46
- }
47
- }
48
- }
49
- }
50
- }
51
- }
@@ -1,51 +0,0 @@
1
- {
2
- "post": {
3
- "tags": [
4
- "Yetto"
5
- ],
6
- "description": "After a plug installation is created, this executes",
7
- "operationId": "Post a plug installation",
8
- "requestBody": {
9
- "required": true,
10
- "content": {
11
- "application/json": {
12
- "schema": {
13
- "$ref": "../../components/schemas/yetto.json#/ConfigureApp"
14
- }
15
- }
16
- }
17
- },
18
- "responses": {
19
- "204": {
20
- "description": "No Content",
21
- "content": {
22
- "application/json": {
23
- "schema": {
24
- "$ref": "../../components/schemas/responses.json#/204"
25
- }
26
- }
27
- }
28
- },
29
- "400": {
30
- "description": "Bad Request",
31
- "content": {
32
- "application/json": {
33
- "schema": {
34
- "$ref": "../../components/schemas/responses.json#/400"
35
- }
36
- }
37
- }
38
- },
39
- "404": {
40
- "description": "Not Found",
41
- "content": {
42
- "application/json": {
43
- "schema": {
44
- "$ref": "../../components/schemas/responses.json#/404"
45
- }
46
- }
47
- }
48
- }
49
- }
50
- }
51
- }
data/templates/script/ci DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e
4
-
5
- export CI=true
6
-
7
- script/test
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e
4
-
5
- bin/rails test "$@"