hephaestus 0.8.22 → 0.8.23

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc3242552a959e97e1a48a750f3badbbb4fbf811c9c5c8aba11216c6946670bb
4
- data.tar.gz: 2a826bc6b2780ef913b8787e6a17888a140f0b5db2ebfbd254625cadac8ec7c5
3
+ metadata.gz: fa9f21425f766448e2c070b8fabe81fe73ea30084bd7d6fbff0caf9908aef0d0
4
+ data.tar.gz: d0456c6050bd9f866c63f67162b0ef9c70d61c708665f327e1a23ccf3e7ef15e
5
5
  SHA512:
6
- metadata.gz: 5d9a866a19947fc6bb91533bc9eb644aa2e564d446b4006db883c4388a388b0cfd5d1df5c0146e0f63cd154bbaaeef148ddca32fcf21afe8682934c631429f17
7
- data.tar.gz: 8f1a306e8c9f7c32dc6fdc07ebda0f782655d3439872688a23d746a490112996b224d9aec650089c69becdeb68ae8c227d689de84b30c8e4ba525e56bf92cb93
6
+ metadata.gz: 8f1bdfd55bd31163ae15f8a440705f54feed8b2758ee9d7b6495f46ac58d426eb8cc42286d8ae217a04847ad0c078401b623c9f976a4b9958b00a286ba62bb4e
7
+ data.tar.gz: ec00c5dc4d4fa067a984f7498ef2fbaea03b3ecead3266edfbeb4b2c5f42f224c0db703aacfa716aa5b3fc9b1d8d16f09d5ad6441ca87294d4d2fcc22f61aeb3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [v0.8.23] - 15-07-2025
2
+ ## What's Changed
3
+ * Send trigger event service by @balevine in https://github.com/yettoapp/hephaestus/pull/135
4
+
5
+
6
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.22.1...v0.8.23
7
+ # [v0.8.22.1] - 04-07-2025
8
+ ## What's Changed
9
+ * Revert bad lint by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/133
10
+
11
+
12
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.22...v0.8.22.1
1
13
  # [v0.8.22] - 02-07-2025
2
14
  ## What's Changed
3
15
  * change plugs to use solstice dependabot updates by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/130
@@ -21,7 +21,7 @@ module Hephaestus
21
21
  end
22
22
 
23
23
  def set_step
24
- @step = params.fetch(:step, 1).to_i || 1
24
+ @step = params.fetch(:step, 1).to_i
25
25
  end
26
26
  end
27
27
  end
@@ -21,7 +21,7 @@ module Hephaestus
21
21
 
22
22
  class << self
23
23
  def yetto_client
24
- @yetto_client ||= Httpsensible::Client.new(user_agent: "#{Rails.application.class.module_parent.name}/#{Hephaestus::Engine::GIT_SHA}")
24
+ Thread.current[:yetto_client] ||= Httpsensible::Client.new(user_agent: "#{Rails.application.class.module_parent.name}/#{Hephaestus::Engine::GIT_SHA}")
25
25
  end
26
26
 
27
27
  def encoded_jwt
@@ -89,6 +89,11 @@ module Hephaestus
89
89
  yetto_client.with_headers({ "Authorization" => "Bearer #{encoded_jwt}" }).get("#{YETTO_API_VERSION_URL}/plug/installations#{to_filter_query(filter)}")
90
90
  end
91
91
 
92
+ def send_trigger_event(plug_installation_id, integration_record, integration_event, payload: {})
93
+ trigger_url = "#{YETTO_API_VERSION_URL}/plug/installations/#{plug_installation_id}/triggers/#{integration_record}/#{integration_event}"
94
+ yetto_client.with_headers({ "Authorization" => "Bearer #{encoded_jwt}" }).post(trigger_url, json: payload)
95
+ end
96
+
92
97
  private def to_filter_query(hash)
93
98
  return "" if hash.nil?
94
99
 
@@ -9,7 +9,7 @@ Rails.application.config.after_initialize do
9
9
  class LogSubscriber < ActiveSupport::LogSubscriber
10
10
  alias_method :original_format, :format
11
11
 
12
- private define_method(:format) do |arg|
12
+ private def format(arg)
13
13
  if arg.is_a?(Hash)
14
14
  parameter_filter = ActiveSupport::ParameterFilter.new(Rails.application.config.filter_parameters)
15
15
  parameter_filter.filter(arg.transform_values { |value| original_format(value) })
@@ -75,7 +75,7 @@ module Hephaestus
75
75
 
76
76
  def op_read(label)
77
77
  if within_op_rate_limit?
78
- %x(#{include_sudo?}op read "#{label}").chomp.tap do
78
+ %x(#{sudo_ish}op read "#{label}").chomp.tap do
79
79
  Rails.logger.error("Failed to fetch `#{label}` from 1Password") && return unless $CHILD_STATUS.success?
80
80
  end
81
81
  end
@@ -85,7 +85,7 @@ module Hephaestus
85
85
  # skip this unless we're in a Docker container
86
86
  return true unless ENV.fetch("DOCKER", "0") == "1"
87
87
 
88
- results = %x(#{include_sudo?}op service-account ratelimit --format=json).chomp.tap do |_result|
88
+ results = %x(#{sudo_ish}op service-account ratelimit --format=json).chomp.tap do |_result|
89
89
  unless $CHILD_STATUS.success?
90
90
  Rails.logger.error("Failed to retrieve rate limits")
91
91
  return false
@@ -107,7 +107,7 @@ module Hephaestus
107
107
  end
108
108
 
109
109
  def cli_installed?
110
- %x(#{include_sudo?}op --version 2> /dev/null)
110
+ %x(#{sudo_ish}op --version 2> /dev/null)
111
111
  $CHILD_STATUS.success?
112
112
  end
113
113
 
@@ -115,7 +115,7 @@ module Hephaestus
115
115
  ENV.fetch("PRECOMPILING", nil).present?
116
116
  end
117
117
 
118
- def include_sudo?
118
+ def sudo_ish
119
119
  ENV.fetch("DOCKER", false) == "1" ? "sudo -E " : ""
120
120
  end
121
121
 
@@ -190,6 +190,18 @@ module Hephaestus
190
190
  body: response.to_json,
191
191
  )
192
192
  end
193
+
194
+ def stub_send_trigger_event(plug_installation_id, integration_record, integration_event, payload: {}, response: {}, status: 200)
195
+ stub_request(:post, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/plug/installations/#{plug_installation_id}/triggers/#{integration_record}/#{integration_event}")
196
+ .with(
197
+ body: payload,
198
+ )
199
+ .to_return(
200
+ status: status,
201
+ headers: { content_type: "application/json; charset=utf-8" },
202
+ body: response.to_json,
203
+ )
204
+ end
193
205
  end
194
206
  end
195
207
  end
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Hephaestus
5
- VERSION = "0.8.22"
5
+ VERSION = "0.8.23"
6
6
  RAILS_VERSION = ">= 8.0"
7
7
  RUBY_VERSION = File
8
8
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
@@ -8,7 +8,7 @@ class SettingsController < ApplicationController
8
8
 
9
9
  sig { void }
10
10
  def edit
11
- @step = params.fetch(:step, 1).to_i || 1
11
+ @step = params.fetch(:step, 1).to_i
12
12
 
13
13
  plug_installation_id = params[:plug_installation_id]
14
14
  response = ::Hephaestus::YettoService.get_plug_installation(plug_installation_id)
data/templates/bin/bundle CHANGED
@@ -13,15 +13,15 @@ require "rubygems"
13
13
  m = Module.new do
14
14
  module_function
15
15
 
16
- define_method(:invoked_as_script?) do
16
+ def invoked_as_script?
17
17
  File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
18
18
  end
19
19
 
20
- define_method(:env_var_version) do
20
+ def env_var_version
21
21
  ENV["BUNDLER_VERSION"]
22
22
  end
23
23
 
24
- define_method(:cli_arg_version) do
24
+ def cli_arg_version
25
25
  return unless invoked_as_script? # don't want to hijack other binstubs
26
26
  return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
27
 
@@ -39,14 +39,14 @@ m = Module.new do
39
39
  bundler_version
40
40
  end
41
41
 
42
- define_method(:gemfile) do
42
+ def gemfile
43
43
  gemfile = ENV["BUNDLE_GEMFILE"]
44
44
  return gemfile if gemfile && !gemfile.empty? # rubocop:disable Rails/Present
45
45
 
46
46
  File.expand_path("../Gemfile", __dir__)
47
47
  end
48
48
 
49
- define_method(:lockfile) do
49
+ def lockfile
50
50
  lockfile =
51
51
  case File.basename(gemfile)
52
52
  when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
@@ -55,7 +55,7 @@ m = Module.new do
55
55
  File.expand_path(lockfile)
56
56
  end
57
57
 
58
- define_method(:lockfile_version) do
58
+ def lockfile_version
59
59
  return unless File.file?(lockfile)
60
60
 
61
61
  lockfile_contents = File.read(lockfile)
@@ -64,14 +64,16 @@ m = Module.new do
64
64
  Regexp.last_match(1)
65
65
  end
66
66
 
67
- define_method(:bundler_requirement) do
67
+ # rubocop:disable ThreadSafety/ClassInstanceVariable
68
+ def bundler_requirement
68
69
  @bundler_requirement ||=
69
70
  env_var_version ||
70
71
  cli_arg_version ||
71
72
  bundler_requirement_for(lockfile_version)
72
73
  end
74
+ # rubocop:enable ThreadSafety/ClassInstanceVariable
73
75
 
74
- define_method(:bundler_requirement_for) do |version|
76
+ def bundler_requirement_for(version)
75
77
  return "#{Gem::Requirement.default}.a" unless version
76
78
 
77
79
  bundler_gem_version = Gem::Version.new(version)
@@ -79,13 +81,13 @@ m = Module.new do
79
81
  bundler_gem_version.approximate_recommendation
80
82
  end
81
83
 
82
- define_method(:load_bundler!) do
84
+ def load_bundler!
83
85
  ENV["BUNDLE_GEMFILE"] ||= gemfile
84
86
 
85
87
  activate_bundler
86
88
  end
87
89
 
88
- define_method(:activate_bundler) do
90
+ def activate_bundler
89
91
  gem_error = activation_error_handling do
90
92
  gem("bundler", bundler_requirement)
91
93
  end
@@ -100,7 +102,7 @@ m = Module.new do
100
102
  exit(42)
101
103
  end
102
104
 
103
- define_method(:activation_error_handling) do
105
+ def activation_error_handling
104
106
  yield
105
107
  nil
106
108
  rescue StandardError, LoadError => e
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.22
4
+ version: 0.8.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-02 00:00:00.000000000 Z
11
+ date: 2025-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap