Class: BeamUp::Providers::Transporter

Inherits:
Base
  • Object
show all
Defined in:
lib/beam_up/providers/transporter.rb

Defined Under Namespace

Classes: Config

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from BeamUp::Providers::Base

Instance Method Details

#deploy!(path) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/beam_up/providers/transporter.rb', line 23

def deploy!(path)
  @path = path
  files = files_to_deploy

  puts "Energizing… 🚀"
  puts "Matter stream detected: #{files.length} files"

  FileUtils.mkdir_p(@configuration.target_directory)

  files.each do |file|
    relative_path = file.sub("#{@path}/", "")
    target_path = File.join(@configuration.target_directory, relative_path)

    FileUtils.mkdir_p(File.dirname(target_path))
    FileUtils.cp(file, target_path)

    puts "  Beaming: #{relative_path}"
  end

  puts "Transport complete. Files materialized at: #{@configuration.target_directory}"

  Result.new(
    provider: "Transporter",
    deploy_id: files.length.to_s,
    url: @configuration.target_directory
  )
rescue => error
  Result.new(provider: "Transporter", error: error.message)
end