Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deployment path inference #56

Merged
merged 2 commits into from
Nov 1, 2024
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
2 changes: 1 addition & 1 deletion tasks/utils/artifact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def read_deployment_name
end

def common_root(filenames)
roots = filenames.select { |item| item[-1] == '/' }.map { |item| item.split('/', 2).first }.uniq
roots = filenames.map { |item| item.sub(%r{^\./}, '') }.select { |item| item[-1] == '/' }.map { |item| item.split('/', 2).first }.uniq

roots.first if roots.size == 1
end
Expand Down
9 changes: 7 additions & 2 deletions tasks/utils/deployment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Deployment
include Comparable

attr_reader :application, :name, :path
attr_reader :application, :name

def <=>(other)
res = application <=> other.application
Expand All @@ -20,7 +20,6 @@ def <=>(other)
def initialize(application, name)
@application = application
@name = name
@path = File.join(application.path, name)
end

def self.create(application, name, url, headers)
Expand All @@ -29,6 +28,12 @@ def self.create(application, name, url, headers)
deployment
end

def path
raise 'Deployment has currently no name' if name.nil?

@path ||= File.join(application.path, name)
end

def deploy(url, headers)
artifact = Artifact.new(url, headers)
@name ||= artifact.deployment_name
Expand Down
Loading