Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 16 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# DeployHQ API library and CLI client

> **DEPRECATED:** The CLI in this gem is deprecated and will be removed in a future release.
> Please use the new [DeployHQ CLI](https://github.com/deployhq/deployhq-cli) instead,
> which offers more features, fewer dependencies, and first-class support for AI-assisted workflows.
>
> The Ruby API library (`Deploy::Resource`, etc.) remains available for programmatic use.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
## Installation

You'll need Ruby installed on your system. We've tested on `2.7.8` and later.
Expand All @@ -20,53 +26,22 @@ username and API key are user specific.

## Usage

### CLI client
### CLI (deprecated)

The CLI client is still experimental and requires some work. Currently it has
the ability to list all of the servers on a project, and make a new deployment
to the most recent revison of a repository.
The CLI bundled in this gem is deprecated. Please use the
[new DeployHQ CLI](https://github.com/deployhq/deployhq-cli) instead.

#### List servers
```
$ deployhq servers
Ungrouped Servers
Name : localhost
Type : SSH/SFTP
Path : /home/dan/testing/deploytest
Branch : master
Current Revision : 70039facbbfb014e4e57ff0bea2c7f6ec5e48e0a
Hostname : localhost:22
```
### Ruby API

#### Make a deployment
```
$ deployhq deploy
1. localhost (branch: master) (currently: 70039facbbfb014e4e57ff0bea2c7f6ec5e48e0a)
2. List Server Details
Please choose a server or group to deploy to:
1
Waiting for deployment capacity......
Running pre-deployment checks...
Checking access to repository
Checking start and revisions are valid
Checking connection to server localhost
Beginning deployment from 70039facbbfb014e4e57ff0bea2c7f6ec5e48e0a to 70039facbbfb014e4e57ff0bea2c7f6ec5e48e0a
Deployment started by Dan Wentworth
Calculating changes required for deployment
[ localhost ] Connecting to server at localhost:22
[ localhost ] Connected to SFTP/SSH server at localhost:22
[ localhost ] 0 file(s) are no longer required and will be removed
[ localhost ] 0 file(s) have been changed and will be uploaded
[ localhost ] 0 config file(s) need to be uploaded
[ localhost ] Disconnected from SFTP/SSH server
Deployment complete!
Delivered notification to git-http-test-2 in test-repositories project.
```
The `Deploy::Resource` API library remains available for programmatic access
to the DeployHQ platform. See the source under `lib/deploy/` for available
resources (Project, Deployment, Server, ServerGroup, etc.).

## Development

The CLI client in particular is a bit experimental, and not yet finished. Any
pull-requests to improve it would be greatly welcomed.
CLI improvements and new features should be directed to the
[deployhq-cli](https://github.com/deployhq/deployhq-cli) repository.
This gem will continue to receive maintenance updates for the Ruby API library.

## Release

Expand Down
10 changes: 8 additions & 2 deletions deployhq.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '>= 2.7'
s.licenses = ['MIT']
s.summary = 'API and CLI client for the DeployHQ'
s.description = 'API and CLI client for the DeployHQ deployment platform. Provides the deployhq executable.'
s.summary = 'API and CLI client for the DeployHQ (CLI deprecated)'
s.description = 'API and CLI client for the DeployHQ deployment platform. ' \
'NOTE: The CLI is deprecated. ' \
'Please use https://github.com/deployhq/deployhq-cli instead.'
s.files = Dir.glob('{lib,bin}/**/*')
s.require_paths = ['lib']
s.bindir = 'bin'
Expand All @@ -22,4 +24,8 @@ Gem::Specification.new do |s|
s.authors = ['DeployHQ Team']
s.email = ['support@deployhq.com']
s.homepage = 'https://github.com/deployhq/deployhq-lib'
s.post_install_message = <<~MSG
WARNING: The DeployHQ CLI bundled in this gem is deprecated.
Please migrate to the new CLI: https://github.com/deployhq/deployhq-cli
MSG
end
12 changes: 12 additions & 0 deletions lib/deploy/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ class CLI

class << self

DEPRECATION_NOTICE = <<~MSG
\e[33m╔══════════════════════════════════════════════════════════════════╗
║ DEPRECATED: This CLI is deprecated and will be removed in a ║
║ future release. Please migrate to the new DeployHQ CLI: ║
║ ║
║ https://github.com/deployhq/deployhq-cli ║
║ ║
║ More features, fewer dependencies, and built for the AI era. ║
╚══════════════════════════════════════════════════════════════════╝\e[0m
MSG

def invoke(args)
warn DEPRECATION_NOTICE
@options = OptionsStruct.new

parser = OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
Expand Down
6 changes: 3 additions & 3 deletions lib/deploy/cli/deployment_progress_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class DeploymentProgressOutput
def initialize(deployment)
@deployment = deployment

@step_index = @deployment.steps.each_with_object({}) { |s, hsh| hsh[s.identifier] = s }
@server_tags = @deployment.servers.each_with_object({}) do |s, hsh|
hsh[s.id] = "\e[#{SERVER_TAG_COLOURS.next};1m[#{s.name}]\e[0m "
@step_index = @deployment.steps.to_h { |s| [s.identifier, s] }
@server_tags = @deployment.servers.to_h do |s|
[s.id, "\e[#{SERVER_TAG_COLOURS.next};1m[#{s.name}]\e[0m "]
end
end

Expand Down
Loading