Skip to content
Open
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
12 changes: 9 additions & 3 deletions lib/website/deployer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ def content_type(f)
CACHE_CONTROL = "public, max-age=60, s-maxage=60, stale-while-revalidate=60,"\
" stale-if-error=60"

def upload(domain, force_deploy: false)
output_dir = render
def upload(domain, force_deploy: false, output_dir: nil)
if output_dir
unless Dir.exist?(output_dir)
raise ArgumentError, "output_dir #{output_dir.inspect} does not exist"
end
else
output_dir = render
end
s3 = Aws::S3::Resource.new
bucket = s3.bucket(domain)
objects = bucket.objects
Expand All @@ -84,7 +90,7 @@ def upload(domain, force_deploy: false)
files = Dir["**/*"].select { |f| File.file? f }
unless files.any? { |f| f =~ /index\.html$/ }
puts "at=debug no index found, files=#{files}"
raise "Render failed!"
raise "No index.html found in #{output_dir}"
end
changed = []
objects.each do |obj|
Expand Down