envb-rails 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +28 -11
- data/Screenshot.jpg +0 -0
- data/app/assets/stylesheets/envb.css.scss.erb +47 -0
- data/app/assets/stylesheets/envb_mixins.css.scss +15 -3
- data/envb-rails.gemspec +2 -4
- data/lib/envb-rails.rb +0 -1
- data/lib/envb/rails.rb +1 -1
- data/lib/envb/rails/options.rb +17 -0
- data/lib/envb/rails/version.rb +3 -1
- metadata +5 -26
- data/.gitignore +0 -11
- data/Gemfile.lock +0 -16
- data/app/assets/stylesheets/envb.css.scss +0 -38
- data/app/views/envb/_banner.html.haml +0 -2
- data/lib/envb/rails/view_helper.rb +0 -11
- data/lib/generators/envb/stylesheet/stylesheet_generator.rb +0 -14
- data/lib/generators/envb/stylesheet/templates/envb_custom.css.scss +0 -15
data/README.md
CHANGED
@@ -20,29 +20,46 @@ Require the envb stylesheet at the top of your asset manifest.
|
|
20
20
|
*= require_self
|
21
21
|
...
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
...
|
26
|
-
<%= envb %>
|
27
|
-
</body>
|
23
|
+
As long as you don't want to customize any default behavior, that's it!
|
28
24
|
|
29
25
|
### Excluding environment names
|
30
26
|
|
31
|
-
By default
|
27
|
+
By default envb-rails will not render a banner on the production environment.
|
32
28
|
|
33
|
-
|
29
|
+
To exclude the banner from other environments you can create `config/initializers/envb.rb` and modify the array of excluded environment names. For example, if you wanted to exclude on staging as well as production:
|
34
30
|
|
35
|
-
|
31
|
+
Envb::Rails.options[:excludes] = %w(production staging)
|
36
32
|
|
37
|
-
Or to alternatively have it render on production as well, you can
|
33
|
+
Or to alternatively have it render on production as well, you can use an empty array:
|
38
34
|
|
39
|
-
|
35
|
+
Envb::Rails.options[:excludes] = []
|
36
|
+
|
37
|
+
After creating or changing this initializer you must recompile your assets. In development mode this is as easy as running `rake assets:clean`. For non-local environments, most deployment systems will recompile with every deploy or you should be able to set them to.
|
40
38
|
|
41
39
|
## Customization
|
42
40
|
|
43
41
|
By default envb-rails will colorize the environment banners in the following combinations, development:purple, acceptance:aqua, staging:orange, and production:red. Other custom named environments will be a default (gray) color.
|
44
42
|
|
45
|
-
If you would like to customize the colors or add environment names you can
|
43
|
+
If you would like to customize the colors or add environment names you can further modify your `config/initializers/envb.rb` file with the following:
|
44
|
+
|
45
|
+
Envb::Rails.options[:colors].update({
|
46
|
+
custom_name: '#xxxxxx',
|
47
|
+
another_name: 'rgb(x, x, x)',
|
48
|
+
one_more: '$envb_green'
|
49
|
+
})
|
50
|
+
|
51
|
+
As you can see, you should be able to use any valid CSS color model to specify the color of the banner. You may also use the built in envb color variables which are:
|
52
|
+
|
53
|
+
$envb_gray: #969896;
|
54
|
+
$envb_red: #cc6666;
|
55
|
+
$envb_orange: #de935f;
|
56
|
+
$envb_yellow: #f0c674;
|
57
|
+
$envb_green: #b5bd68;
|
58
|
+
$envb_aqua: #8abeb7;
|
59
|
+
$envb_blue: #81a2be;
|
60
|
+
$envb_purple: #b294bb;
|
61
|
+
|
62
|
+
As with excluding environments, when you change the initializer you must recompile your assets.
|
46
63
|
|
47
64
|
## Attribution
|
48
65
|
|
data/Screenshot.jpg
CHANGED
Binary file
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<% unless Envb::Rails.options[:excludes].include?(::Rails.env) %>
|
2
|
+
|
3
|
+
@import 'envb_mixins';
|
4
|
+
|
5
|
+
// A fixed gray banner used for displaying your current Rails environment name.
|
6
|
+
//
|
7
|
+
// .development - Changes banner color to purple.
|
8
|
+
// .acceptance - Changes banner color to aqua.
|
9
|
+
// .staging - Changes banner color to orange.
|
10
|
+
// .production - Changes banner color to red.
|
11
|
+
//
|
12
|
+
// No styleguide reference.
|
13
|
+
html {
|
14
|
+
padding-bottom: 29px;
|
15
|
+
|
16
|
+
&:after {
|
17
|
+
@include colors(<%= Envb::Rails.options[:colors][::Rails.env.to_sym] || '$envb_gray' %>);
|
18
|
+
|
19
|
+
border-top: {
|
20
|
+
style: solid;
|
21
|
+
width: 1px;
|
22
|
+
}
|
23
|
+
bottom: 0;
|
24
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
|
25
|
+
color: #fff;
|
26
|
+
content: '<%= ::Rails.env %>';
|
27
|
+
font: {
|
28
|
+
family: 'Helvetica Neue', Helvetica, sans-serif;
|
29
|
+
size: 16px;
|
30
|
+
weight: bold;
|
31
|
+
}
|
32
|
+
left: 0;
|
33
|
+
line-height: 28px;
|
34
|
+
margin: 0;
|
35
|
+
position: fixed;
|
36
|
+
text: {
|
37
|
+
align: center;
|
38
|
+
shadow: 0 1px 1px #000;
|
39
|
+
transform: uppercase;
|
40
|
+
}
|
41
|
+
width: 100%;
|
42
|
+
z-index: 100;
|
43
|
+
-webkit-font-smoothing: antialiased;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
// Variables
|
2
2
|
$envb_gray: #969896;
|
3
3
|
$envb_red: #cc6666;
|
4
4
|
$envb_orange: #de935f;
|
@@ -8,8 +8,20 @@ $envb_aqua: #8abeb7;
|
|
8
8
|
$envb_blue: #81a2be;
|
9
9
|
$envb_purple: #b294bb;
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
// Sets a solid background color, and a darker border color.
|
12
|
+
//
|
13
|
+
// $color - The color value to use for the background and border.
|
14
|
+
//
|
15
|
+
// Compatible in all browser.
|
16
|
+
@mixin colors($color: $envb_gray) {
|
17
|
+
$gradient_top: lighten($color, 5%);
|
18
|
+
$gradient_bottom: darken($color, 5%);
|
19
|
+
|
13
20
|
background-color: $color;
|
21
|
+
background-image: -ms-linear-gradient(bottom, $gradient_bottom 0%, $gradient_top 100%);
|
22
|
+
background-image: -moz-linear-gradient(bottom, $gradient_bottom 0%, $gradient_top 100%);
|
23
|
+
background-image: -webkit-linear-gradient(bottom, $gradient_bottom 0%, $gradient_top 100%);
|
24
|
+
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, $gradient_bottom), color-stop(1, $gradient_top));
|
25
|
+
background-image: linear-gradient(bottom, $gradient_bottom 0%, $gradient_top 100%);
|
14
26
|
border-color: darken($color, 20%);
|
15
27
|
}
|
data/envb-rails.gemspec
CHANGED
@@ -8,8 +8,6 @@ Gem::Specification.new do |g|
|
|
8
8
|
g.homepage = 'http://github.com/joedynamite/envb-rails'
|
9
9
|
g.summary = 'A simple way to display your Rails environment name.'
|
10
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 =
|
13
|
-
|
14
|
-
g.add_dependency 'haml'
|
11
|
+
g.files = `git ls-files`.split("\n") - %w(.gitignore)
|
12
|
+
g.require_paths = %w(lib)
|
15
13
|
end
|
data/lib/envb-rails.rb
CHANGED
data/lib/envb/rails.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Envb
|
2
|
+
module Rails
|
3
|
+
extend self
|
4
|
+
|
5
|
+
@options = {
|
6
|
+
excludes: ['production'],
|
7
|
+
colors: {
|
8
|
+
development: '$envb_purple',
|
9
|
+
acceptance: '$envb_aqua',
|
10
|
+
staging: '$envb_orange',
|
11
|
+
production: '$envb_red'
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
attr_accessor :options
|
16
|
+
end
|
17
|
+
end
|
data/lib/envb/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: envb-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
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'
|
12
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
30
14
|
description: A banner that displays in your layout containing the Rails environment
|
31
15
|
name.
|
32
16
|
email: code@joebilt.com
|
@@ -34,23 +18,18 @@ executables: []
|
|
34
18
|
extensions: []
|
35
19
|
extra_rdoc_files: []
|
36
20
|
files:
|
37
|
-
- .gitignore
|
38
21
|
- Gemfile
|
39
|
-
- Gemfile.lock
|
40
22
|
- LICENSE.txt
|
41
23
|
- README.md
|
42
24
|
- Screenshot.jpg
|
43
|
-
- app/assets/stylesheets/envb.css.scss
|
25
|
+
- app/assets/stylesheets/envb.css.scss.erb
|
44
26
|
- app/assets/stylesheets/envb_mixins.css.scss
|
45
|
-
- app/views/envb/_banner.html.haml
|
46
27
|
- envb-rails.gemspec
|
47
28
|
- lib/envb-rails.rb
|
48
29
|
- lib/envb/rails.rb
|
49
30
|
- lib/envb/rails/engine.rb
|
31
|
+
- lib/envb/rails/options.rb
|
50
32
|
- lib/envb/rails/version.rb
|
51
|
-
- lib/envb/rails/view_helper.rb
|
52
|
-
- lib/generators/envb/stylesheet/stylesheet_generator.rb
|
53
|
-
- lib/generators/envb/stylesheet/templates/envb_custom.css.scss
|
54
33
|
homepage: http://github.com/joedynamite/envb-rails
|
55
34
|
licenses: []
|
56
35
|
post_install_message:
|
data/.gitignore
DELETED
data/Gemfile.lock
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
@import 'envb_mixins';
|
2
|
-
|
3
|
-
/* Styles */
|
4
|
-
html { padding-bottom: 25px; }
|
5
|
-
|
6
|
-
#envb {
|
7
|
-
@include banner-color($envb_gray);
|
8
|
-
|
9
|
-
border-top: 1px solid;
|
10
|
-
bottom: 0;
|
11
|
-
color: #fff;
|
12
|
-
left: 0;
|
13
|
-
position: fixed;
|
14
|
-
text: {
|
15
|
-
align: center;
|
16
|
-
shadow: 0 1px 1px #000;
|
17
|
-
transform: uppercase;
|
18
|
-
}
|
19
|
-
width: 100%;
|
20
|
-
z-index: 100;
|
21
|
-
-webkit-font-smoothing: antialiased;
|
22
|
-
|
23
|
-
p {
|
24
|
-
font: {
|
25
|
-
family: 'Helvetica Neue', Helvetica, sans-serif;
|
26
|
-
size: 14px;
|
27
|
-
weight: bold;
|
28
|
-
}
|
29
|
-
line-height: 24px;
|
30
|
-
margin: 0;
|
31
|
-
}
|
32
|
-
|
33
|
-
/* Environment Color Settings */
|
34
|
-
&.development { @include banner-color($envb_purple); }
|
35
|
-
&.acceptance { @include banner-color($envb_aqua); }
|
36
|
-
&.staging { @include banner-color($envb_orange); }
|
37
|
-
&.production { @include banner-color($envb_red); }
|
38
|
-
}
|
@@ -1,11 +0,0 @@
|
|
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
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'rails'
|
2
|
-
|
3
|
-
module Envb
|
4
|
-
module Generators
|
5
|
-
class StylesheetGenerator < ::Rails::Generators::Base
|
6
|
-
desc 'Copies an envb-rails customization stylesheet into your application.'
|
7
|
-
source_root File.expand_path('../templates/', __FILE__)
|
8
|
-
|
9
|
-
def copy_stylesheet_file
|
10
|
-
copy_file 'envb_custom.css.scss', 'app/assets/stylesheets/envb_custom.css.scss'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
@import 'envb_mixins';
|
2
|
-
|
3
|
-
/* Color presets are $envb_gray, $envb_red, $envb_orange, $envb_yellow,
|
4
|
-
* $envb_green, $envb_aqua, $envb_blue, and $envb_purple. Or you can pass in a
|
5
|
-
* custom color value
|
6
|
-
*/
|
7
|
-
|
8
|
-
#envb {
|
9
|
-
/* default */ @include banner-color($envb_gray);
|
10
|
-
|
11
|
-
&.development { @include banner-color($envb_purple); }
|
12
|
-
&.acceptance { @include banner-color($envb_aqua); }
|
13
|
-
&.staging { @include banner-color($envb_orange); }
|
14
|
-
&.production { @include banner-color($envb_red); }
|
15
|
-
}
|