From 48c04cbf423ac57f7152ba5160187d8bbe60e18c Mon Sep 17 00:00:00 2001 From: chubchenko Date: Thu, 28 Oct 2021 16:57:03 +0300 Subject: [PATCH 1/3] Use `1st` role in case of a primary role is absent --- lib/capistrano/slacky/on.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/capistrano/slacky/on.rb b/lib/capistrano/slacky/on.rb index a0f42b5..eee5937 100644 --- a/lib/capistrano/slacky/on.rb +++ b/lib/capistrano/slacky/on.rb @@ -18,7 +18,9 @@ class Path module_function def on(within:, &block) - ::Capistrano::DSL.on(::Capistrano::Configuration.env.primary(:app)) do + role = ::Capistrano::Configuration.env.primary(:app) || ::Capistrano::Configuration.env.roles(:all).first + + ::Capistrano::DSL.on(role) do ::SSHKit::Backend.current.within(PATH_MAP.fetch(within).call, &block) end end From bc6b9895fdc2a243f17938db14ec2abb6db66a3e Mon Sep 17 00:00:00 2001 From: chubchenko Date: Mon, 1 Nov 2021 18:30:10 +0200 Subject: [PATCH 2/3] Require `json` --- lib/capistrano/slacky/payload.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/capistrano/slacky/payload.rb b/lib/capistrano/slacky/payload.rb index 7be28eb..e461d6d 100644 --- a/lib/capistrano/slacky/payload.rb +++ b/lib/capistrano/slacky/payload.rb @@ -5,6 +5,8 @@ module Capistrano module Slacky class Payload + require "json" + def initialize(env:, action:) @env = env @action = action From 9d086dac76e182b1d88d32d1cf51f2107ba4e31b Mon Sep 17 00:00:00 2001 From: chubchenko Date: Thu, 11 Nov 2021 13:40:52 +0200 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90cf32a..3671958 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Add fall back in case of the primary server is not defined. ([@chubchenko][]) +- Require `json` to convert `Hash` object to `JSON`. ([@chubchenko][]) ## [0.1.4] - 2021-07-27 ### Fixed