envb-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +16 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Screenshot.jpg +0 -0
- data/app/views/envb/_banner.html.haml +2 -0
- data/envb-rails.gemspec +15 -0
- data/lib/assets/stylesheets/envb.css.scss +52 -0
- data/lib/envb/rails/engine.rb +7 -0
- data/lib/envb/rails/version.rb +5 -0
- data/lib/envb/rails/view_helper.rb +11 -0
- data/lib/envb/rails.rb +3 -0
- data/lib/envb-rails.rb +2 -0
- metadata +75 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Joe Bilt.
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# envb-rails
|
2
|
+
|
3
|
+
A super easy way to display what Rails environment you're currently running in.
|
4
|
+
|
5
|
+
*There were other gems that do this, but they are kind of ugly and display other extraneous information that I didn't find relevant.*
|
6
|
+
|
7
|
+
![envb-rails in action!](https://github.com/joedynamite/envb-rails/raw/master/Screenshot.jpg)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add the envb-rails gem to your Gemfile. Then run `bundle install`.
|
12
|
+
|
13
|
+
gem 'envb-rails'
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Require the envb stylesheet at the top of your asset manifest.
|
18
|
+
|
19
|
+
*= require envb
|
20
|
+
*= require_self
|
21
|
+
...
|
22
|
+
|
23
|
+
Use the envb helper method at the bottom of your layout right before the closing `<body>` tag.
|
24
|
+
|
25
|
+
...
|
26
|
+
<%= envb %>
|
27
|
+
</body>
|
28
|
+
|
29
|
+
### Excluding environment names
|
30
|
+
|
31
|
+
By default the `envb` helper method will not render a banner on the production environment.
|
32
|
+
|
33
|
+
The `envb` method can take an optional array of environment names you don't want the banner to render on. For example, to exclude on production and staging you can use:
|
34
|
+
|
35
|
+
<%= envb(['staging', 'production']) %>
|
36
|
+
|
37
|
+
Or to alternatively have it render on production as well, you can pass it an empty array:
|
38
|
+
|
39
|
+
<%= envb([]) %>
|
40
|
+
|
41
|
+
## Limitations
|
42
|
+
|
43
|
+
Currently envb-rails will colorize the banners for the following environments, `development` (purple), `acceptance` (aqua), `staging` (orange), and `production` (red). Other custom named environments will be a default (gray) color. In future versions I will make it easier to customize/replace these defaults.
|
44
|
+
|
45
|
+
## Attribution
|
46
|
+
|
47
|
+
Banner colors are *borrowed* from the Tomorrow Night theme in [chriskempson/tomorrow-theme](https://github.com/chriskempson/tomorrow-theme).
|
48
|
+
|
49
|
+
----
|
50
|
+
|
51
|
+
Copyright © 2012 Joe Bilt.
|
data/Screenshot.jpg
ADDED
Binary file
|
data/envb-rails.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../lib/envb/rails/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |g|
|
4
|
+
g.name = 'envb-rails'
|
5
|
+
g.version = Envb::Rails::VERSION
|
6
|
+
g.authors = 'Joe Bilt'
|
7
|
+
g.email = 'code@joebilt.com'
|
8
|
+
g.homepage = 'http://github.com/joedynamite/envb-rails'
|
9
|
+
g.summary = 'A simple way to display your Rails environment name.'
|
10
|
+
g.description = 'A banner that displays in your layout containing the Rails environment name.'
|
11
|
+
g.files = `git ls-files`.split("\n")
|
12
|
+
g.require_paths = ['lib']
|
13
|
+
|
14
|
+
g.add_dependency 'haml'
|
15
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/* Color Variables */
|
2
|
+
$envb_gray: #969896;
|
3
|
+
$envb_red: #cc6666;
|
4
|
+
$envb_orange: #de935f;
|
5
|
+
$envb_yellow: #f0c674;
|
6
|
+
$envb_green: #b5bd68;
|
7
|
+
$envb_aqua: #8abeb7;
|
8
|
+
$envb_blue: #81a2be;
|
9
|
+
$envb_purple: #b294bb;
|
10
|
+
|
11
|
+
/* Mixins */
|
12
|
+
@mixin set-color($color) {
|
13
|
+
background-color: $color;
|
14
|
+
border-color: darken($color, 20%);
|
15
|
+
}
|
16
|
+
|
17
|
+
/* Styles */
|
18
|
+
html { padding-bottom: 25px; }
|
19
|
+
|
20
|
+
#envb {
|
21
|
+
@include set-color($envb_gray);
|
22
|
+
|
23
|
+
border-top: 1px solid;
|
24
|
+
bottom: 0;
|
25
|
+
color: #fff;
|
26
|
+
left: 0;
|
27
|
+
position: fixed;
|
28
|
+
text: {
|
29
|
+
align: center;
|
30
|
+
shadow: 0 1px 1px #000;
|
31
|
+
transform: uppercase;
|
32
|
+
}
|
33
|
+
width: 100%;
|
34
|
+
z-index: 100;
|
35
|
+
-webkit-font-smoothing: antialiased;
|
36
|
+
|
37
|
+
p {
|
38
|
+
font: {
|
39
|
+
family: 'Helvetica Neue', Helvetica, sans-serif;
|
40
|
+
size: 14px;
|
41
|
+
weight: bold;
|
42
|
+
}
|
43
|
+
line-height: 24px;
|
44
|
+
margin: 0;
|
45
|
+
}
|
46
|
+
|
47
|
+
/* Environment Color Settings */
|
48
|
+
&.development { @include set-color($envb_purple); }
|
49
|
+
&.acceptance { @include set-color($envb_aqua); }
|
50
|
+
&.staging { @include set-color($envb_orange); }
|
51
|
+
&.production { @include set-color($envb_red); }
|
52
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Envb
|
2
|
+
module Rails
|
3
|
+
module ViewHelper
|
4
|
+
def envb(except=['production'])
|
5
|
+
render partial: 'envb/banner', locals: { env: ::Rails.env } unless except.include?(::Rails.env)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
ActionView::Base.send :include, Envb::Rails::ViewHelper
|
data/lib/envb/rails.rb
ADDED
data/lib/envb-rails.rb
ADDED
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: envb-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Joe Bilt
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: haml
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: A banner that displays in your layout containing the Rails environment
|
31
|
+
name.
|
32
|
+
email: code@joebilt.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- .gitignore
|
38
|
+
- Gemfile
|
39
|
+
- Gemfile.lock
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Screenshot.jpg
|
43
|
+
- app/views/envb/_banner.html.haml
|
44
|
+
- envb-rails.gemspec
|
45
|
+
- lib/assets/stylesheets/envb.css.scss
|
46
|
+
- lib/envb-rails.rb
|
47
|
+
- lib/envb/rails.rb
|
48
|
+
- lib/envb/rails/engine.rb
|
49
|
+
- lib/envb/rails/version.rb
|
50
|
+
- lib/envb/rails/view_helper.rb
|
51
|
+
homepage: http://github.com/joedynamite/envb-rails
|
52
|
+
licenses: []
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.8.24
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: A simple way to display your Rails environment name.
|
75
|
+
test_files: []
|