active_admin_environment 0.0.2 → 1.0.0
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +1 -0
- data/README.md +26 -9
- data/active_admin_environment.gemspec +2 -0
- data/images/develop.png +0 -0
- data/images/production.png +0 -0
- data/images/staging.png +0 -0
- data/lib/active_admin_environment.rb +10 -7
- data/lib/active_admin_environment/engine.rb +6 -3
- data/lib/active_admin_environment/version.rb +1 -1
- data/lib/generators/active_admin_environment/css_generator.rb +12 -0
- data/lib/generators/active_admin_environment/generator_base.rb +20 -0
- data/lib/generators/active_admin_environment/install_generator.rb +17 -0
- data/lib/{rails/generators/active_admin_environment/install/templates/active_admin_production.css.scss → generators/active_admin_environment/templates/active_admin_environment.css.scss.erb} +5 -4
- data/lib/generators/active_admin_environment/templates/initializer.rb +8 -0
- data/spec/active_admin_environment_spec.rb +0 -1
- data/spec/generators/active_admin_environment/css_generator_spec.rb +30 -0
- data/spec/generators/active_admin_environment/install_generator_spec.rb +43 -0
- data/spec/spec_helper.rb +5 -0
- metadata +43 -6
- data/lib/rails/generators/active_admin_environment/install/install_generator.rb +0 -18
- data/lib/rails/generators/active_admin_environment/install/templates/active_admin_development.css.scss +0 -28
- data/lib/rails/generators/active_admin_environment/install/templates/active_admin_staging.css.scss +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7230c3503b40013a5e8db94ff1e822c46e418073
|
4
|
+
data.tar.gz: 21320561204cdfca1775d19e9bb3f7efed9db1b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56e2e74f17102181c3beec7758931b5a4d41cb2ab9dd11ae1bfb2751ea1fee9500d24a832b0e7a8bff9fa2f376878f8c7c35232cf793bfe229130a04206507e5
|
7
|
+
data.tar.gz: 7846c3e4ac56dfb1ee1604a2fc3c467951096c928dd50ebd04246d0bbf8dee92e01386f6a62a8638f9a7e052893a5e173997e32d8e5c4431aa622372dc2b9715
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color -f d
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# ActiveAdminEnvironment
|
2
2
|
|
3
|
-
|
3
|
+
Change AcitiveAdmin appearance by rails environment.
|
4
|
+
|
5
|
+

|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -8,21 +10,35 @@ Add this line to your application's Gemfile:
|
|
8
10
|
|
9
11
|
gem 'active_admin_environment'
|
10
12
|
|
11
|
-
|
13
|
+
After installed gem, execute:
|
12
14
|
|
13
|
-
$
|
15
|
+
$ rails generate active_admin_environment:install
|
14
16
|
|
15
|
-
|
17
|
+
Generating default css and initializers:
|
16
18
|
|
17
|
-
|
19
|
+
app/assets/stylesheets/active_admin_environment
|
20
|
+
├── development.css.scss
|
21
|
+
└── production.css.scss
|
22
|
+
config/initializers
|
23
|
+
└── active_admin_environment.rb
|
18
24
|
|
19
|
-
|
25
|
+
## Usage
|
20
26
|
|
21
|
-
|
27
|
+
This gem is for environment named production, development.
|
22
28
|
|
23
|
-
|
29
|
+
development
|
30
|
+

|
31
|
+
|
32
|
+
production
|
33
|
+

|
34
|
+
|
35
|
+
### Change color or add different environment
|
24
36
|
|
25
|
-
|
37
|
+
Edit initializer (config/initializers/active_admin_environment.rb)
|
38
|
+
|
39
|
+
Execute bellow to regenerate css files :
|
40
|
+
|
41
|
+
$ rails generate active_admin_environment:css
|
26
42
|
|
27
43
|
## Contributing
|
28
44
|
|
@@ -31,3 +47,4 @@ TODO: Write usage instructions here
|
|
31
47
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
48
|
4. Push to the branch (`git push origin my-new-feature`)
|
33
49
|
5. Create new Pull Request
|
50
|
+
|
@@ -24,5 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "rspec-rails"
|
28
|
+
spec.add_development_dependency "ammeter"
|
27
29
|
|
28
30
|
end
|
data/images/develop.png
ADDED
Binary file
|
Binary file
|
data/images/staging.png
ADDED
Binary file
|
@@ -1,11 +1,14 @@
|
|
1
|
-
require
|
1
|
+
require 'active_admin_environment/version'
|
2
|
+
require 'rails/all'
|
2
3
|
|
4
|
+
module ActiveAdminEnvironment
|
5
|
+
DEFAULT_COLORS = { :development => "#5e6469", :production => "#ff0000" }
|
6
|
+
mattr_accessor :environment_colors
|
7
|
+
self.environment_colors = DEFAULT_COLORS
|
3
8
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# end
|
9
|
-
#end
|
9
|
+
def self.setup
|
10
|
+
yield self
|
11
|
+
end
|
12
|
+
end
|
10
13
|
|
11
14
|
require 'active_admin_environment/engine'
|
@@ -1,10 +1,13 @@
|
|
1
|
+
require 'rails/all'
|
2
|
+
|
1
3
|
module ActiveAdminEnvironment
|
2
4
|
class Engine < Rails::Engine
|
3
5
|
if Rails.version >= "3.1"
|
4
6
|
initializer "ActiveAdminEnvironment precompile hook" do |app|
|
5
|
-
|
6
|
-
|
7
|
-
|
7
|
+
define_envs = ActiveAdminEnvironment.environment_colors.keys.map(&:to_sym)
|
8
|
+
if define_envs.include?(Rails.env.to_sym)
|
9
|
+
app.config.assets.precompile += %W(active_admin_environment/#{Rails.env.to_s}.css)
|
10
|
+
ActiveAdmin.application.register_stylesheet "active_admin_environment/#{Rails.env.to_s}.css"
|
8
11
|
end
|
9
12
|
end
|
10
13
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'generators/active_admin_environment/generator_base'
|
2
|
+
|
3
|
+
module ActiveAdminEnvironment
|
4
|
+
module Generators
|
5
|
+
class CssGenerator < Base
|
6
|
+
desc "Generate CSS file each environment in a rails 3 application"
|
7
|
+
def copy_css_files
|
8
|
+
generate_css_files
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
module ActiveAdminEnvironment
|
3
|
+
module Generators
|
4
|
+
class Base < ::Rails::Generators::Base
|
5
|
+
def self.source_root
|
6
|
+
@_active_admin_environment_source_root ||= File.expand_path("../templates", __FILE__)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
def generate_css_files
|
11
|
+
remove_dir "app/assets/stylesheets/active_admin_environment"
|
12
|
+
ActiveAdminEnvironment.environment_colors.each do |env, color|
|
13
|
+
@env = env.to_s.camelize
|
14
|
+
@color = color
|
15
|
+
template "active_admin_environment.css.scss.erb", "app/assets/stylesheets/active_admin_environment/#{env}.css.scss"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'generators/active_admin_environment/generator_base'
|
2
|
+
|
3
|
+
module ActiveAdminEnvironment
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Base
|
6
|
+
desc "Installs ActiveAdminEnvironment in a rails 3 application"
|
7
|
+
|
8
|
+
def copy_Initializer
|
9
|
+
copy_file "initializer.rb", "config/initializers/active_admin_environment.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
def copy_css_files
|
13
|
+
generate_css_files
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
body.active_admin {
|
2
2
|
#header{
|
3
|
-
background: -webkit-linear-gradient(-90deg, #6a7176,
|
3
|
+
background: -webkit-linear-gradient(-90deg, #6a7176, <%= @color %>);
|
4
4
|
}
|
5
5
|
|
6
6
|
#page_title {
|
7
7
|
position: relative;
|
8
8
|
}
|
9
9
|
#page_title:before {
|
10
|
-
content: "
|
10
|
+
content: "<%= @env %> - ";
|
11
11
|
padding-left: 40px;
|
12
|
-
color:
|
12
|
+
color: <%= @color %>;
|
13
13
|
}
|
14
14
|
#page_title:after {
|
15
15
|
position: absolute;
|
@@ -21,7 +21,7 @@ body.active_admin {
|
|
21
21
|
-webkit-border-radius: 100%;
|
22
22
|
-moz-border-radius: 100%;
|
23
23
|
border-radius: 100%;
|
24
|
-
background:
|
24
|
+
background: <%= @color %>;
|
25
25
|
content: "!";
|
26
26
|
color: #ffffff;
|
27
27
|
text-align: center;
|
@@ -30,3 +30,4 @@ body.active_admin {
|
|
30
30
|
font-size: 24px
|
31
31
|
}
|
32
32
|
}
|
33
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'generators/active_admin_environment/css_generator'
|
3
|
+
|
4
|
+
describe ActiveAdminEnvironment::Generators::CssGenerator do
|
5
|
+
destination File.expand_path("../../../../tmp", __FILE__)
|
6
|
+
before do
|
7
|
+
prepare_destination
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "copy css files" do
|
11
|
+
describe "production.css" do
|
12
|
+
subject { file('app/assets/stylesheets/active_admin_environment/production.css.scss') }
|
13
|
+
before do
|
14
|
+
run_generator
|
15
|
+
end
|
16
|
+
it { should exist }
|
17
|
+
it { should contain(/Production/) }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "development.css" do
|
21
|
+
subject { file('app/assets/stylesheets/active_admin_environment/development.css.scss') }
|
22
|
+
before do
|
23
|
+
run_generator
|
24
|
+
end
|
25
|
+
it { should exist }
|
26
|
+
it { should contain(/Development/) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'generators/active_admin_environment/install_generator'
|
3
|
+
|
4
|
+
describe ActiveAdminEnvironment::Generators::InstallGenerator do
|
5
|
+
destination File.expand_path("../../../../tmp", __FILE__)
|
6
|
+
before do
|
7
|
+
prepare_destination
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "copy initializer" do
|
11
|
+
subject { file('config/initializers/active_admin_environment.rb') }
|
12
|
+
before do
|
13
|
+
run_generator
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'exists initilizer file' do
|
17
|
+
it { should exist }
|
18
|
+
it { should contain(/production/) }
|
19
|
+
it { should contain(/development/) }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "copy css files" do
|
24
|
+
describe "production.css" do
|
25
|
+
subject { file('app/assets/stylesheets/active_admin_environment/production.css.scss') }
|
26
|
+
before do
|
27
|
+
run_generator
|
28
|
+
end
|
29
|
+
it { should exist }
|
30
|
+
it { should contain(/Production/) }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "development.css" do
|
34
|
+
subject { file('app/assets/stylesheets/active_admin_environment/development.css.scss') }
|
35
|
+
before do
|
36
|
+
run_generator
|
37
|
+
end
|
38
|
+
it { should exist }
|
39
|
+
it { should contain(/Development/) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_admin_environment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keishake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
@@ -80,6 +80,34 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: ammeter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
description: Change ActiveAdmin page style by environment
|
84
112
|
email:
|
85
113
|
- keishake0925@gmail.com
|
@@ -88,20 +116,27 @@ extensions: []
|
|
88
116
|
extra_rdoc_files: []
|
89
117
|
files:
|
90
118
|
- .gitignore
|
119
|
+
- .rspec
|
91
120
|
- .ruby-version
|
92
121
|
- Gemfile
|
93
122
|
- LICENSE.txt
|
94
123
|
- README.md
|
95
124
|
- Rakefile
|
96
125
|
- active_admin_environment.gemspec
|
126
|
+
- images/develop.png
|
127
|
+
- images/production.png
|
128
|
+
- images/staging.png
|
97
129
|
- lib/active_admin_environment.rb
|
98
130
|
- lib/active_admin_environment/engine.rb
|
99
131
|
- lib/active_admin_environment/version.rb
|
100
|
-
- lib/
|
101
|
-
- lib/
|
102
|
-
- lib/
|
103
|
-
- lib/
|
132
|
+
- lib/generators/active_admin_environment/css_generator.rb
|
133
|
+
- lib/generators/active_admin_environment/generator_base.rb
|
134
|
+
- lib/generators/active_admin_environment/install_generator.rb
|
135
|
+
- lib/generators/active_admin_environment/templates/active_admin_environment.css.scss.erb
|
136
|
+
- lib/generators/active_admin_environment/templates/initializer.rb
|
104
137
|
- spec/active_admin_environment_spec.rb
|
138
|
+
- spec/generators/active_admin_environment/css_generator_spec.rb
|
139
|
+
- spec/generators/active_admin_environment/install_generator_spec.rb
|
105
140
|
- spec/spec_helper.rb
|
106
141
|
homepage: https://github.com/Keishake/active_admin_environment
|
107
142
|
licenses:
|
@@ -129,4 +164,6 @@ specification_version: 4
|
|
129
164
|
summary: Change ActiveAdmin page style by environment
|
130
165
|
test_files:
|
131
166
|
- spec/active_admin_environment_spec.rb
|
167
|
+
- spec/generators/active_admin_environment/css_generator_spec.rb
|
168
|
+
- spec/generators/active_admin_environment/install_generator_spec.rb
|
132
169
|
- spec/spec_helper.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module ActiveAdminEnvironment
|
2
|
-
module Generators
|
3
|
-
class InstallGenerator < Rails::Generators::Base
|
4
|
-
desc "Installs ActiveAdminEnvironment in a rails 3 application"
|
5
|
-
|
6
|
-
def self.source_root
|
7
|
-
@_active_admin_environment_source_root ||= File.expand_path("../templates", __FILE__)
|
8
|
-
end
|
9
|
-
|
10
|
-
def copy_css_files
|
11
|
-
%w(development staging production).each do |e|
|
12
|
-
template "active_admin_#{e}.css.scss", "app/assets/stylesheets/active_admin_#{e}.css.scss"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
body.active_admin {
|
2
|
-
#page_title {
|
3
|
-
position: relative;
|
4
|
-
}
|
5
|
-
#page_title:before {
|
6
|
-
content: "Development - ";
|
7
|
-
padding-left: 40px;
|
8
|
-
color: #5e6469;
|
9
|
-
}
|
10
|
-
#page_title:after {
|
11
|
-
position: absolute;
|
12
|
-
top: -8px;
|
13
|
-
left: 0;
|
14
|
-
width: 30px;
|
15
|
-
height: 30px;
|
16
|
-
padding: 0;
|
17
|
-
-webkit-border-radius: 100%;
|
18
|
-
-moz-border-radius: 100%;
|
19
|
-
border-radius: 100%;
|
20
|
-
background: #5e6469;
|
21
|
-
content: "!";
|
22
|
-
color: #ffffff;
|
23
|
-
text-align: center;
|
24
|
-
line-height: 30px;
|
25
|
-
font-weight: normal;
|
26
|
-
font-size: 24px
|
27
|
-
}
|
28
|
-
}
|
data/lib/rails/generators/active_admin_environment/install/templates/active_admin_staging.css.scss
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
body.active_admin {
|
2
|
-
#header{
|
3
|
-
background: -webkit-linear-gradient(-90deg, #6a7176, #0000ff);
|
4
|
-
}
|
5
|
-
|
6
|
-
#page_title {
|
7
|
-
position: relative;
|
8
|
-
}
|
9
|
-
#page_title:before {
|
10
|
-
content: "Staging - ";
|
11
|
-
padding-left: 40px;
|
12
|
-
color: #0066ff;
|
13
|
-
}
|
14
|
-
#page_title:after {
|
15
|
-
position: absolute;
|
16
|
-
top: -8px;
|
17
|
-
left: 0;
|
18
|
-
width: 30px;
|
19
|
-
height: 30px;
|
20
|
-
padding: 0;
|
21
|
-
-webkit-border-radius: 100%;
|
22
|
-
-moz-border-radius: 100%;
|
23
|
-
border-radius: 100%;
|
24
|
-
background: #0066ff;
|
25
|
-
content: "!";
|
26
|
-
color: #ffffff;
|
27
|
-
text-align: center;
|
28
|
-
line-height: 30px;
|
29
|
-
font-weight: normal;
|
30
|
-
font-size: 24px
|
31
|
-
}
|
32
|
-
}
|