module RorVsWild::Host
def self.cwd
def self.cwd Dir.pwd end
def self.load_config(config)
def self.load_config(config) @name = config.dig(:server, :name) end
def self.name
def self.name @name ||= if gae_instance = ENV["GAE_INSTANCE"] || ENV["CLOUD_RUN_EXECUTION"] gae_instance elsif dyno = ENV["DYNO"] # Heroku dyno.start_with?("run.") ? "run.*" : dyno.start_with?("release.") ? "release.*" : dyno else Socket.gethostname end end
def self.os
def self.os @os_description ||= `uname -sr`.strip rescue Exception => ex @os_description = RbConfig::CONFIG["host_os"] end
def self.pid
def self.pid Process.pid end
def self.rails
def self.rails Rails.version if defined?(Rails) end
def self.revision
def self.revision Deployment.revision end
def self.revision_description
def self.revision_description Deployment.description end
def self.ruby
def self.ruby RUBY_DESCRIPTION end
def self.to_h
def self.to_h @to_h ||= {os: os, user: user, host: name, ruby: ruby, rails: rails, pid: pid, cwd: cwd, revision: revision}.compact end
def self.user
def self.user Etc.getlogin end