-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use Pry instead of IRB * Provide helpers to access the registry * Add a helper to execute steps on a host
- Loading branch information
Showing
7 changed files
with
93 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ gem "byebug" | |
gem "dry-validation" | ||
|
||
gem "mocktail" | ||
|
||
gem "pry" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require "bundler/setup" | ||
require "cove" | ||
|
||
Thread.report_on_exception = false | ||
|
||
Cove.init | ||
|
||
Cove::CLI::Main.start(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module Cove | ||
module ConsoleHelpers | ||
class ConnectionWrapper | ||
include SSHKit::DSL | ||
|
||
def initialize(host, block) | ||
@host = host | ||
@block = block | ||
end | ||
|
||
def call | ||
block = @block | ||
result = nil | ||
|
||
on(@host) do |connection| | ||
result = block.call(self) | ||
end | ||
|
||
result | ||
end | ||
end | ||
|
||
def with_connection(host, &block) | ||
ConnectionWrapper.new(ssh_host(host), block).call | ||
end | ||
|
||
def reload! | ||
$zeitwerk_loader.reload | ||
end | ||
|
||
def ssh_host(name) | ||
hosts[name].sshkit_host | ||
end | ||
|
||
def hosts | ||
registry.hosts | ||
end | ||
|
||
def services | ||
registry.services | ||
end | ||
|
||
def roles | ||
registry.roles | ||
end | ||
|
||
def registry | ||
Cove.registry | ||
end | ||
end | ||
end |