Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<% unless Rails.env.production? %> | ||
<div style='background-color: darkcyan; | ||
color: white; | ||
font-family: monospace; | ||
font-size: 1.25em; | ||
height: 45px; | ||
padding: .75em; | ||
position: fixed; | ||
text-align: center; | ||
width: 100%; | ||
z-index: 100; | ||
'> | ||
🐈 😃 👍 <%= Rails.env.upcase %>: <%= "#{EnvironmentBanner.current_branch}" %> 👍 😃 🐈 | ||
</div> | ||
<div style='height: 45px;'></div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title><%= raw page_title %></title> | ||
<link href='https://fonts.googleapis.com/css?family=Nixie+One|Open+Sans:400,600,700' rel='stylesheet' type='text/css'> | ||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"> | ||
|
||
<%= stylesheet_link_tag 'application', media: 'all'%> | ||
<%= javascript_include_tag 'application'%> | ||
<%= csrf_meta_tags %> | ||
|
||
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script> | ||
<script src="//use.fontawesome.com/16a020f0b8.js"></script> | ||
|
||
<!-- Check device width for responsive media queries --> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
|
||
<%= favicon_link_tag "favicon.png" %> | ||
|
||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="shover"></div> <!-- shover --> | ||
|
||
<p id="notice"><%= notice %></p> | ||
<p id="alert"><%= alert %></p> | ||
|
||
<%= render "layouts/header" %> | ||
<%= render "shared/overlay_modal" %> | ||
<%= yield %> | ||
|
||
</div> <!-- container --> | ||
|
||
</body> | ||
<head> | ||
<title><%= raw page_title %></title> | ||
<link href='https://fonts.googleapis.com/css?family=Nixie+One|Open+Sans:400,600,700' rel='stylesheet' type='text/css'> | ||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"> | ||
|
||
<%= stylesheet_link_tag 'application', media: 'all'%> | ||
<%= javascript_include_tag 'application'%> | ||
<%= csrf_meta_tags %> | ||
|
||
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script> | ||
<script src="//use.fontawesome.com/16a020f0b8.js"></script> | ||
|
||
<!-- Check device width for responsive media queries --> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
|
||
<%= favicon_link_tag "favicon.png" %> | ||
|
||
</head> | ||
<body> | ||
<%= render "layouts/environment_banner" %> | ||
<%= render "layouts/header" %> | ||
<div class="container"> | ||
<p id="notice"><%= notice %></p> | ||
<p id="alert"><%= alert %></p> | ||
<%= render "shared/overlay_modal" %> | ||
<%= yield %> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
module EnvironmentBanner | ||
class << self | ||
def current_branch | ||
if git_available? | ||
`git rev-parse --abbrev-ref HEAD`.chomp | ||
else | ||
ENV.fetch('CURRENT_BRANCH', '--branch-not-found--') | ||
end | ||
end | ||
|
||
def current_sha | ||
if git_available? | ||
`git log --oneline -1` | ||
else | ||
ENV.fetch('CURRENT_SHA', '--sha-not-found--') | ||
end | ||
end | ||
|
||
def git_available? | ||
to_dev_null = '> /dev/null 2>&1' | ||
system("which git #{to_dev_null} && git rev-parse --git-dir #{to_dev_null}") | ||
end | ||
end | ||
end |