Class | PhusionPassenger::Standalone::PackageRuntimeCommand
In: | lib/phusion_passenger/standalone/package_runtime_command.rb
Parent: | Command

### Methods

description run

### Public Class methods

description()

[Source]

        # File lib/phusion_passenger/standalone/package_runtime_command.rb, line 29
    29:         def self.description
    30:                 return "Package the Phusion Passenger Standalone runtime."
    31:         end

### Public Instance methods

run()

[Source]

        # File lib/phusion_passenger/standalone/package_runtime_command.rb, line 33
    33:         def run
    34:                 destdir = File.expand_path("passenger-standalone")
    35:                 description =
    36:                         "Package the Phusion Passenger Standalone runtime into the specified directory. If\n" <<
    37:                         "DIRECTORY is not given then #{destdir} will be used."
    38:                 parse_options!("package [directory]", description) do |opts|
    39:                         opts.on("--nginx-version VERSION", String,
    40:                                 wrap_desc("Nginx version to use as core (default: #{@options[:nginx_version]})")) do |value|
    41:                                 @options[:nginx_version] = value
    42:                         end
    43:                         opts.on("--nginx-tarball FILENAME", String,
    44:                                 wrap_desc("Use the given tarball instead of downloading from the Internet")) do |value|
    45:                                 @options[:nginx_tarball] = value
    46:                         end
    47:                 end
    48:
    49:                 destdir     = File.expand_path(@args[0]) if @args[0]
    50:                 runtime_dir = "#{destdir}/#{runtime_version_string}"
    51:                 support_dir = "#{runtime_dir}/support"
    52:                 nginx_dir   = "#{runtime_dir}/nginx-#{@options[:nginx_version]}"
    53:
    54:                 sh "rm", "-rf", support_dir
    55:                 sh "rm", "-rf", nginx_dir
    56:
    57:                 require 'phusion_passenger/standalone/runtime_installer'
    58:                 installer = RuntimeInstaller.new(
    59:                         :source_root => SOURCE_ROOT,
    60:                         :support_dir => support_dir,
    61:                         :nginx_dir   => nginx_dir,
    62:                         :version     => @options[:nginx_version],
    63:                         :tarball     => @options[:nginx_tarball],
    64:                         :download_binaries => false)
    65:                 installer.start
    66:
    67:                 Dir.chdir(support_dir) do
    68:                         support_dir_name = File.basename(support_dir)
    69:                         puts "cd #{support_dir}"
    70:                         sh "tar -c . | gzip --best > ../#{support_dir_name}.tar.gz"
    71:                 end
    72:                 Dir.chdir(nginx_dir) do
    73:                         nginx_dir_name   = File.basename(nginx_dir)
    74:                         puts "cd #{nginx_dir}"
    75:                         sh "tar -c . | gzip --best > ../#{nginx_dir_name}.tar.gz"
    76:                 end
    77:                 puts "cd #{runtime_dir}"
    78:                 sh "rm", "-rf", support_dir, nginx_dir
    79:         end

[Validate]