Sha256: 6c602e832757f45f9c7761bd53b8e0b114e9b3feb05ab43458ff24c9c57ed46d

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

require 'prettyprint'

Gem.pre_install do |installer|
  if installer.spec.metadata.dig("container") == "panamax"
    env = installer.spec.metadata.dig("env")
    destination = File.join(installer.spec.metadata.dig("destination"), env) 
    src = File.expand_path(File.join(File.dirname(__FILE__), '..', 'src'))
    system("rm -rf #{destination}")    
    puts "deploying #{installer.spec.name} to #{destination}"
  end

end

Gem.post_install do |installer|
  if installer.spec.metadata.dig("container") == "panamax"
    env = installer.spec.metadata.dig("env")
    destination = File.join(installer.spec.metadata.dig("destination"), env) 
    src = File.expand_path(File.join(File.dirname(__FILE__), '..', 'src'))

    
    if env == "live"
      puts "symlink files to #{destination}"
      system("ln -sf #{src} #{destination}")
    else
      puts "copy files #{destination}"
      system("cp -rf #{src}/ #{destination}") 
      puts "copy uploads"
      live = File.join(installer.spec.metadata.dig("destination"), "live") 
      system("cp -rf #{live}/public/uploads/ #{destination}/public/uploads/")
      puts "uploads synced"
    end 

    if File.exist?("#{destination}/bin/hoisted")
      system("chmod +x #{destination}/bin/hoisted")
      system("cd #{destination} && ./bin/hoisted")
    end

    puts "deployed #{installer.spec.name} to #{destination}"
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lbhrr-2.34.5 templates/lib/rubygems_plugin.rb.erb
lbhrr-2.34.4 templates/lib/rubygems_plugin.rb.erb
lbhrr-2.34.3 templates/lib/rubygems_plugin.rb.erb
lbhrr-2.34.1 templates/lib/rubygems_plugin.rb.erb