Skip to content

Commit 1db6ce1

Browse files
committed
feat: Allow config files deployment.
1 parent 98b0898 commit 1db6ce1

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

lib/deploy/cli.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
require 'deploy/cli/websocket_client'
88
require 'deploy/cli/deployment_progress_output'
99

10-
OptionsStruct = Struct.new(:config_file, :project)
10+
OptionsStruct = Struct.new(:config_file, :project, :config_files_deployment)
1111

1212
# rubocop:disable Metrics/ClassLength
1313
# rubocop:disable Metrics/AbcSize
@@ -25,7 +25,7 @@ class << self
2525
def invoke(args)
2626
@options = OptionsStruct.new
2727

28-
parser = OptionParser.new do |opts|
28+
parser = OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
2929
opts.banner = 'Usage: deployhq [options] command'
3030
opts.separator ''
3131
opts.separator 'Commands:'
@@ -45,6 +45,11 @@ def invoke(args)
4545
@options.project = project_permalink
4646
end
4747

48+
@options.config_files_deployment = false
49+
opts.on('--config-files', 'Config files deployment') do |_config_files_deployment|
50+
@options.config_files_deployment = true
51+
end
52+
4853
opts.on_tail('-v', '--version', 'Shows Version') do
4954
puts Deploy::VERSION
5055
exit
@@ -127,8 +132,14 @@ def deploy
127132
end
128133
end
129134

130-
latest_revision = @project.latest_revision(parent.preferred_branch)
131-
deployment = @project.deploy(parent.identifier, parent.last_revision, latest_revision)
135+
if @options.config_files_deployment
136+
$stdout.print "\nStarting config files deployment\n"
137+
deployment = @project.config_files_deployment(parent.identifier)
138+
else
139+
$stdout.print "\nStarting deployment\n"
140+
latest_revision = @project.latest_revision(parent.preferred_branch)
141+
deployment = @project.deploy(parent.identifier, parent.last_revision, latest_revision)
142+
end
132143

133144
$stdout.print 'Waiting for an available deployment slot...'
134145
DeploymentProgressOutput.new(deployment).monitor

lib/deploy/cli/websocket_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def authenticate
9595
end
9696

9797
def request_subscriptions
98-
subscriptions.each do |_key, subscription|
98+
subscriptions.each_value do |subscription|
9999
send('Subscribe', exchange: subscription.exchange, routing_key: subscription.routing_key)
100100
end
101101
end

lib/deploy/resources/project.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ def latest_revision(branch = '')
2121
end
2222

2323
# Create a deployment in this project (and queue it to run)
24-
def deploy(server, start_revision, end_revision)
24+
def deploy(server, start_revision, end_revision, config_files_only: false)
2525
run_deployment(server, start_revision, end_revision) do |d|
2626
d.mode = 'queue'
27+
d.config_files_deployment = '1' if config_files_only
2728
end
2829
end
2930

31+
def config_files_deployment(server)
32+
deploy(server, nil, nil, config_files_only: true)
33+
end
34+
3035
# Create a deployment preview
3136
def preview(server, start_revision, end_revision)
3237
run_deployment(server, start_revision, end_revision) do |d|

0 commit comments

Comments
 (0)