Sha256: ec9cfb6d6d555e0b267b97b0d3c8b94324a9d5aaf4f835d1a780a7906c770a47
Contents?: true
Size: 1.13 KB
Versions: 9
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true module RorVsWild module Host def self.load_config(config) @name = config.dig(:server, :name) end def self.os @os_description ||= `uname -sr`.strip rescue Exception => ex @os_description = RbConfig::CONFIG["host_os"] end def self.user Etc.getlogin end def self.ruby RUBY_DESCRIPTION end def self.rails Rails.version if defined?(Rails) end 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.pid Process.pid end def self.cwd Dir.pwd end def self.revision Deployment.revision end def self.revision_description Deployment.description end def self.to_h @to_h ||= {os: os, user: user, host: name, ruby: ruby, rails: rails, pid: pid, cwd: cwd, revision: revision}.compact end end end
Version data entries
9 entries across 9 versions & 1 rubygems