Sha256: a3346d2f1bb1ee45098c1a8bb83b0881de30117ba52de953371dcbd7582ed093
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
# frozen_string_literal: true module StaffBar class << self def revision if File.exist?(File.join(Rails.root, "REVISION")) file = File.join(Rails.root, "REVISION") File.read(file).chomp.first(7) elsif File.exist?(File.join(Rails.root, ".git")) `git rev-parse --short HEAD`.chomp end end def branch if File.exist?(File.join(Rails.root, "BRANCH")) file = File.join(Rails.root, "BRANCH") File.read(file).chomp elsif File.exist?(File.join(Rails.root, ".git")) `git rev-parse --abbrev-ref HEAD`.chomp end end def ruby_version RUBY_VERSION end def rails_version Rails.version end def environment Rails.env end def highlight_env_class StaffBar.config.highlight_envs.include?(environment.to_sym) ? "staff-bar-red" : "" end def time Time.current.to_s end def time_zone Time.zone.tzinfo.identifier end def cache cache_enabled? ? "Caching enabled" : "Caching disabled" end def cache_class cache_enabled? ? "staff-bar-green" : "" end def position_class StaffBar.config.position == :top ? "staff-bar-top" : "staff-bar-bottom" end def theme_class StaffBar.config.theme == :light ? "staff-bar-inverse" : "" end private def cache_enabled? Rails.application.config.action_controller.perform_caching end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
staff_bar-0.3.0 | lib/staff_bar/core.rb |
staff_bar-0.2.0 | lib/staff_bar/core.rb |