class Rinfo
Constants
- VERSION
Attributes
filename[W]
Public Class Methods
env_blacklist()
click to toggle source
# File lib/rinfo.rb, line 26 def env_blacklist @env_blacklist ||= [:prod, :production] end
env_blacklist=(args)
click to toggle source
# File lib/rinfo.rb, line 30 def env_blacklist=(args) @env_blacklist = [*args].map(&:to_sym) end
filename()
click to toggle source
# File lib/rinfo.rb, line 34 def filename @filename ||= 'rinfo.json' end
inform!()
click to toggle source
# File lib/rinfo.rb, line 14 def inform! if should_inform? JSON.pretty_generate(rinfo) else fail ActionController::RoutingError, 'Not Found' end end
should_inform?()
click to toggle source
# File lib/rinfo.rb, line 22 def should_inform? ([:all, env.to_sym] & env_blacklist).empty? end
Private Class Methods
branch()
click to toggle source
# File lib/rinfo.rb, line 71 def branch git.lib.branch_current end
date()
click to toggle source
# File lib/rinfo.rb, line 67 def date git.log.first.date.iso8601 end
env()
click to toggle source
# File lib/rinfo.rb, line 58 def env Rails.env end
git()
click to toggle source
# File lib/rinfo.rb, line 50 def git @git ||= Git.open(root) end
rev()
click to toggle source
# File lib/rinfo.rb, line 75 def rev git.revparse('HEAD') end
rinfo()
click to toggle source
# File lib/rinfo.rb, line 40 def rinfo { deployed_by: author, deployed_at: date, rails_env: env, branch: branch, rev: rev } end
root()
click to toggle source
# File lib/rinfo.rb, line 54 def root Rails.root end