Class: Rinfo

Inherits:
Object
  • Object
show all
Defined in:
lib/rinfo.rb,
lib/rinfo/engine.rb,
lib/rinfo/version.rb

Defined Under Namespace

Classes: Engine

Constant Summary collapse

VERSION =
'0.1.1'

Class Method Summary collapse

Class Method Details

.env_blacklistObject



28
29
30
# File 'lib/rinfo.rb', line 28

def env_blacklist
  @env_blacklist ||= [:prod, :production]
end

.env_blacklist=(args) ⇒ Object



32
33
34
# File 'lib/rinfo.rb', line 32

def env_blacklist=(args)
  @env_blacklist = [*args].map(&:to_sym)
end

.inform!Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rinfo.rb', line 11

def inform!
  fail ActionController::RoutingError 'Not Found' unless should_inform?
  <<-RINFO.gsub(/^ {6}/, '')
  {
    "Deployed By": "#{author}",
    "Deployed At": "#{date}",
    "Rails Env": "#{env}",
    "Branch": "#{branch}",
    "Rev": "#{rev}"
  }
  RINFO
end

.should_inform?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/rinfo.rb', line 24

def should_inform?
  ([:all, env.to_sym] & env_blacklist).empty?
end