staff_bar 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +149 -0
- data/LICENSE +20 -0
- data/README.md +59 -0
- data/Rakefile +27 -0
- data/app/assets/stylesheets/staff_bar.scss +89 -0
- data/app/helpers/staff_bar_helper.rb +7 -0
- data/app/views/staff_bar/_staff_bar.html.erb +22 -0
- data/bin/test +5 -0
- data/lib/staff_bar/capistrano/tasks/staff_bar.rake +12 -0
- data/lib/staff_bar/capistrano.rb +1 -0
- data/lib/staff_bar/config.rb +23 -0
- data/lib/staff_bar/core.rb +64 -0
- data/lib/staff_bar/engine.rb +5 -0
- data/lib/staff_bar/version.rb +3 -0
- data/lib/staff_bar.rb +8 -0
- data/preview-sm.png +0 -0
- data/preview.png +0 -0
- data/staff_bar.gemspec +24 -0
- data/test/dummy/.ruby-version +1 -0
- data/test/dummy/BRANCH +1 -0
- data/test/dummy/REVISION +1 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +2 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/javascript/packs/application.js +15 -0
- data/test/dummy/app/jobs/application_job.rb +7 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +33 -0
- data/test/dummy/config/application.rb +19 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +62 -0
- data/test/dummy/config/environments/production.rb +112 -0
- data/test/dummy/config/environments/test.rb +48 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +12 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/content_security_policy.rb +28 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +38 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config/storage.yml +34 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/staff_bar_test.rb +67 -0
- data/test/test_helper.rb +20 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4db3ef168d66ec2267f51e512ac985f2648ef78f0e738f0089aa7641391bff93
|
4
|
+
data.tar.gz: 694ff72e8cada965044590c90fe071bf28d4bcfbe53bb25bbacb932b6a409607
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8eb796c4d0c8b16f35169525ef4773607385d6c28327d3dc56cdbe2d85b600badc776663f42ee5b7817baf0b04c09372cdfe59a96a7cce71ba2e07aed0d3ca6a
|
7
|
+
data.tar.gz: 45ef7137eab96f78a1dd2c6b87ea3f8b941d7f17d8025fd9397662751708852851807455ddba216a0bfc40d0c48a589fd4f649da42457390e91a2c9be6c2c39d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
# Declare your gem's dependencies in staff_bar.gemspec.
|
5
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
6
|
+
# development dependencies will be added by default to the :development group.
|
7
|
+
gemspec
|
8
|
+
|
9
|
+
# Declare any dependencies that are still in development here instead of in
|
10
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
11
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
12
|
+
# your gem to rubygems.org.
|
13
|
+
|
14
|
+
# To use a debugger
|
15
|
+
# gem 'byebug', group: [:development, :test]
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
staff_bar (0.1.0)
|
5
|
+
octicons_helper (~> 9)
|
6
|
+
rails (>= 5.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (6.0.0)
|
12
|
+
actionpack (= 6.0.0)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (6.0.0)
|
16
|
+
actionpack (= 6.0.0)
|
17
|
+
activejob (= 6.0.0)
|
18
|
+
activerecord (= 6.0.0)
|
19
|
+
activestorage (= 6.0.0)
|
20
|
+
activesupport (= 6.0.0)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
actionmailer (6.0.0)
|
23
|
+
actionpack (= 6.0.0)
|
24
|
+
actionview (= 6.0.0)
|
25
|
+
activejob (= 6.0.0)
|
26
|
+
mail (~> 2.5, >= 2.5.4)
|
27
|
+
rails-dom-testing (~> 2.0)
|
28
|
+
actionpack (6.0.0)
|
29
|
+
actionview (= 6.0.0)
|
30
|
+
activesupport (= 6.0.0)
|
31
|
+
rack (~> 2.0)
|
32
|
+
rack-test (>= 0.6.3)
|
33
|
+
rails-dom-testing (~> 2.0)
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
+
actiontext (6.0.0)
|
36
|
+
actionpack (= 6.0.0)
|
37
|
+
activerecord (= 6.0.0)
|
38
|
+
activestorage (= 6.0.0)
|
39
|
+
activesupport (= 6.0.0)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
actionview (6.0.0)
|
42
|
+
activesupport (= 6.0.0)
|
43
|
+
builder (~> 3.1)
|
44
|
+
erubi (~> 1.4)
|
45
|
+
rails-dom-testing (~> 2.0)
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
+
activejob (6.0.0)
|
48
|
+
activesupport (= 6.0.0)
|
49
|
+
globalid (>= 0.3.6)
|
50
|
+
activemodel (6.0.0)
|
51
|
+
activesupport (= 6.0.0)
|
52
|
+
activerecord (6.0.0)
|
53
|
+
activemodel (= 6.0.0)
|
54
|
+
activesupport (= 6.0.0)
|
55
|
+
activestorage (6.0.0)
|
56
|
+
actionpack (= 6.0.0)
|
57
|
+
activejob (= 6.0.0)
|
58
|
+
activerecord (= 6.0.0)
|
59
|
+
marcel (~> 0.3.1)
|
60
|
+
activesupport (6.0.0)
|
61
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
|
+
i18n (>= 0.7, < 2)
|
63
|
+
minitest (~> 5.1)
|
64
|
+
tzinfo (~> 1.1)
|
65
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
66
|
+
builder (3.2.3)
|
67
|
+
concurrent-ruby (1.1.5)
|
68
|
+
crass (1.0.5)
|
69
|
+
erubi (1.9.0)
|
70
|
+
globalid (0.4.2)
|
71
|
+
activesupport (>= 4.2.0)
|
72
|
+
i18n (1.7.0)
|
73
|
+
concurrent-ruby (~> 1.0)
|
74
|
+
loofah (2.3.1)
|
75
|
+
crass (~> 1.0.2)
|
76
|
+
nokogiri (>= 1.5.9)
|
77
|
+
mail (2.7.1)
|
78
|
+
mini_mime (>= 0.1.1)
|
79
|
+
marcel (0.3.3)
|
80
|
+
mimemagic (~> 0.3.2)
|
81
|
+
method_source (0.9.2)
|
82
|
+
mimemagic (0.3.3)
|
83
|
+
mini_mime (1.0.2)
|
84
|
+
mini_portile2 (2.4.0)
|
85
|
+
minitest (5.12.2)
|
86
|
+
nio4r (2.5.2)
|
87
|
+
nokogiri (1.10.4)
|
88
|
+
mini_portile2 (~> 2.4.0)
|
89
|
+
octicons (9.2.0)
|
90
|
+
nokogiri (>= 1.6.3.1)
|
91
|
+
octicons_helper (9.2.0)
|
92
|
+
octicons (= 9.2.0)
|
93
|
+
rails
|
94
|
+
rack (2.0.7)
|
95
|
+
rack-test (1.1.0)
|
96
|
+
rack (>= 1.0, < 3)
|
97
|
+
rails (6.0.0)
|
98
|
+
actioncable (= 6.0.0)
|
99
|
+
actionmailbox (= 6.0.0)
|
100
|
+
actionmailer (= 6.0.0)
|
101
|
+
actionpack (= 6.0.0)
|
102
|
+
actiontext (= 6.0.0)
|
103
|
+
actionview (= 6.0.0)
|
104
|
+
activejob (= 6.0.0)
|
105
|
+
activemodel (= 6.0.0)
|
106
|
+
activerecord (= 6.0.0)
|
107
|
+
activestorage (= 6.0.0)
|
108
|
+
activesupport (= 6.0.0)
|
109
|
+
bundler (>= 1.3.0)
|
110
|
+
railties (= 6.0.0)
|
111
|
+
sprockets-rails (>= 2.0.0)
|
112
|
+
rails-dom-testing (2.0.3)
|
113
|
+
activesupport (>= 4.2.0)
|
114
|
+
nokogiri (>= 1.6)
|
115
|
+
rails-html-sanitizer (1.3.0)
|
116
|
+
loofah (~> 2.3)
|
117
|
+
railties (6.0.0)
|
118
|
+
actionpack (= 6.0.0)
|
119
|
+
activesupport (= 6.0.0)
|
120
|
+
method_source
|
121
|
+
rake (>= 0.8.7)
|
122
|
+
thor (>= 0.20.3, < 2.0)
|
123
|
+
rake (13.0.0)
|
124
|
+
sprockets (4.0.0)
|
125
|
+
concurrent-ruby (~> 1.0)
|
126
|
+
rack (> 1, < 3)
|
127
|
+
sprockets-rails (3.2.1)
|
128
|
+
actionpack (>= 4.0)
|
129
|
+
activesupport (>= 4.0)
|
130
|
+
sprockets (>= 3.0.0)
|
131
|
+
sqlite3 (1.4.1)
|
132
|
+
thor (0.20.3)
|
133
|
+
thread_safe (0.3.6)
|
134
|
+
tzinfo (1.2.5)
|
135
|
+
thread_safe (~> 0.1)
|
136
|
+
websocket-driver (0.7.1)
|
137
|
+
websocket-extensions (>= 0.1.0)
|
138
|
+
websocket-extensions (0.1.4)
|
139
|
+
zeitwerk (2.2.0)
|
140
|
+
|
141
|
+
PLATFORMS
|
142
|
+
ruby
|
143
|
+
|
144
|
+
DEPENDENCIES
|
145
|
+
sqlite3
|
146
|
+
staff_bar!
|
147
|
+
|
148
|
+
BUNDLED WITH
|
149
|
+
2.0.2
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2019 Rolandas Barysas
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Staff bar
|
2
|
+
|
3
|
+
[![Preview](preview-sm.png)](preview.png)
|
4
|
+
|
5
|
+
Staff bar is a tiny utility for Ruby on Rails projects. It shows a bar with some basic project information: commit hash, branch, Ruby & Rails versions, environment and caching status. You can also make a list of links that you want to show on a bar for a quick access to your internal tools.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
```ruby
|
9
|
+
# Add this to Gemfile
|
10
|
+
gem 'staff_bar'
|
11
|
+
|
12
|
+
# Install dependencies
|
13
|
+
bundle
|
14
|
+
```
|
15
|
+
|
16
|
+
Add this to `app/views/layouts/application.html.erb`:
|
17
|
+
```ruby
|
18
|
+
...
|
19
|
+
</head>
|
20
|
+
|
21
|
+
<body>
|
22
|
+
<%= staff_bar if current_user.staff? %>
|
23
|
+
|
24
|
+
<%= yield %>
|
25
|
+
</body>
|
26
|
+
...
|
27
|
+
```
|
28
|
+
|
29
|
+
(you can change `current_user.staff?` to whatever your administrators logic is of course.)
|
30
|
+
|
31
|
+
Add this to your `application.css` to use default styles:
|
32
|
+
```css
|
33
|
+
*= require staff_bar
|
34
|
+
```
|
35
|
+
|
36
|
+
To show current branch, add staff_bar capistrano tasks in `Capfile`
|
37
|
+
```ruby
|
38
|
+
require "staff_bar/capistrano"
|
39
|
+
```
|
40
|
+
|
41
|
+
This will create `BRANCH` file when depoying, which will staff bar use to show the branch.
|
42
|
+
|
43
|
+
## Configuration
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# app/config/initializers/staff_bar.rb
|
47
|
+
StaffBar.configure do |config|
|
48
|
+
config.links = [
|
49
|
+
{ url: '/jobs', title: 'Jobs queue' },
|
50
|
+
{ url: '/logs', title: 'Open logs' }
|
51
|
+
];
|
52
|
+
|
53
|
+
config.theme = :dark # or :light
|
54
|
+
config.position = :bottom # or :top
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
## License
|
59
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'StaffBar'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'bundler/gem_tasks'
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
|
21
|
+
Rake::TestTask.new(:test) do |t|
|
22
|
+
t.libs << 'test'
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
t.verbose = false
|
25
|
+
end
|
26
|
+
|
27
|
+
task default: :test
|
@@ -0,0 +1,89 @@
|
|
1
|
+
$bg: #222;
|
2
|
+
$bg-inverse: #f5f5f5;
|
3
|
+
|
4
|
+
$color: #f2f2f2;
|
5
|
+
$color-inverse: black;
|
6
|
+
|
7
|
+
$link-color: #b8e8ff;
|
8
|
+
$link-color-inverse: #166083;
|
9
|
+
|
10
|
+
$border-color: black;
|
11
|
+
$border-color-inverse: #ccc;
|
12
|
+
|
13
|
+
$green: #8cfb84;
|
14
|
+
$green-inverse: green;
|
15
|
+
|
16
|
+
.staff-bar {
|
17
|
+
position: relative;
|
18
|
+
z-index: 9999;
|
19
|
+
display: flex;
|
20
|
+
justify-content: space-between;
|
21
|
+
width: 100%;
|
22
|
+
padding: 5px 10px;
|
23
|
+
background: $bg;
|
24
|
+
color: $color;
|
25
|
+
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
26
|
+
font-size: 12px;
|
27
|
+
border-style: solid;
|
28
|
+
border-color: $border-color;
|
29
|
+
box-shadow: 0 0 5px rgba(0,0,0,.1);
|
30
|
+
|
31
|
+
.octicon {
|
32
|
+
fill: darken($color, 25%);
|
33
|
+
}
|
34
|
+
|
35
|
+
a {
|
36
|
+
color: $link-color;
|
37
|
+
text-decoration: none;
|
38
|
+
|
39
|
+
&:hover {
|
40
|
+
color: $link-color;
|
41
|
+
text-decoration: underline;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
.staff-bar-green {
|
46
|
+
color: $green;
|
47
|
+
}
|
48
|
+
|
49
|
+
&-inverse {
|
50
|
+
background: $bg-inverse;
|
51
|
+
color: $color-inverse;
|
52
|
+
border-color: $border-color-inverse;
|
53
|
+
|
54
|
+
.octicon {
|
55
|
+
fill: lighten($color-inverse, 25%);
|
56
|
+
}
|
57
|
+
|
58
|
+
a {
|
59
|
+
color: $link-color-inverse;
|
60
|
+
|
61
|
+
&:hover {
|
62
|
+
color: $link-color-inverse;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
.staff-bar-green {
|
67
|
+
color: $green-inverse;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
&-top {
|
72
|
+
border-width: 0 0 1px;
|
73
|
+
}
|
74
|
+
|
75
|
+
&-bottom {
|
76
|
+
position: fixed;
|
77
|
+
bottom: 0;
|
78
|
+
left: 0;
|
79
|
+
border-width: 1px 0 0;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
.staff-bar-list {
|
84
|
+
display: flex;
|
85
|
+
}
|
86
|
+
|
87
|
+
.staff-bar-list-item {
|
88
|
+
padding-right: 15px;
|
89
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="staff-bar <%= StaffBar.position_class %> <%= StaffBar.theme_class %>">
|
2
|
+
<div class="staff-bar-list">
|
3
|
+
<% if StaffBar.revision.present? %>
|
4
|
+
<div class="staff-bar-list-item"><%= octicon "git-commit" %> <%= StaffBar.revision %></div>
|
5
|
+
<% end %>
|
6
|
+
<% if StaffBar.branch.present? %>
|
7
|
+
<div class="staff-bar-list-item"><%= octicon "git-branch" %> <%= StaffBar.branch %></div>
|
8
|
+
<% end %>
|
9
|
+
<div class="staff-bar-list-item"><%= octicon "ruby" %> ruby-<%= StaffBar.ruby_version %> rails-<%= StaffBar.rails_version %></div>
|
10
|
+
<div class="staff-bar-list-item"><%= octicon "globe" %> <%= StaffBar.environment %></div>
|
11
|
+
<div class="staff-bar-list-item"><%= octicon "gear" %> <span class="<%= StaffBar.cache_class %>"><%= StaffBar.cache %></span></div>
|
12
|
+
<div class="staff-bar-list-item"><%= octicon "clock" %> <%= StaffBar.time %> (<%= StaffBar.time_zone %>)</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="staff-bar-list">
|
16
|
+
<% StaffBar.config.links.each do |link| %>
|
17
|
+
<div class="staff-bar-list-item">
|
18
|
+
<a href="<%= link[:url] %>" target="_blank" rel="noopener"><%= link[:title] %></a>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
</div>
|
data/bin/test
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
namespace :staff_bar do
|
2
|
+
desc "Place a BRANCH file with the current branch in the current release path"
|
3
|
+
task :set_current_branch do
|
4
|
+
on roles(:app) do
|
5
|
+
within release_path do
|
6
|
+
execute :echo, "\"#{fetch(:branch)}\" >> BRANCH"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
after 'deploy:finished', 'staff_bar:set_current_branch'
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../capistrano/tasks/staff_bar.rake", __FILE__)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module StaffBar
|
4
|
+
class << self
|
5
|
+
def configure
|
6
|
+
yield config
|
7
|
+
end
|
8
|
+
|
9
|
+
def config
|
10
|
+
@_config ||= Config.new
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Config
|
15
|
+
attr_accessor :links, :theme, :position
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@links = []
|
19
|
+
@theme = :dark
|
20
|
+
@position = :bottom
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module StaffBar
|
4
|
+
class << self
|
5
|
+
def revision
|
6
|
+
if File.exist?(File.join(Rails.root, "REVISION"))
|
7
|
+
file = File.join(Rails.root, "REVISION")
|
8
|
+
File.read(file).chomp.first(7)
|
9
|
+
elsif File.exist?(File.join(Rails.root, ".git"))
|
10
|
+
`git rev-parse --short HEAD`.chomp
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def branch
|
15
|
+
if File.exist?(File.join(Rails.root, "BRANCH"))
|
16
|
+
file = File.join(Rails.root, "BRANCH")
|
17
|
+
File.read(file).chomp
|
18
|
+
elsif File.exist?(File.join(Rails.root, ".git"))
|
19
|
+
`git rev-parse --abbrev-ref HEAD`.chomp
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def ruby_version
|
24
|
+
RUBY_VERSION
|
25
|
+
end
|
26
|
+
|
27
|
+
def rails_version
|
28
|
+
Rails.version
|
29
|
+
end
|
30
|
+
|
31
|
+
def environment
|
32
|
+
Rails.env
|
33
|
+
end
|
34
|
+
|
35
|
+
def time
|
36
|
+
Time.current.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def time_zone
|
40
|
+
Time.zone.tzinfo.identifier
|
41
|
+
end
|
42
|
+
|
43
|
+
def cache
|
44
|
+
cache_enabled? ? "Caching enabled" : "Caching disabled"
|
45
|
+
end
|
46
|
+
|
47
|
+
def cache_class
|
48
|
+
cache_enabled? ? "staff-bar-green" : ""
|
49
|
+
end
|
50
|
+
|
51
|
+
def position_class
|
52
|
+
StaffBar.config.position == :top ? "staff-bar-top" : "staff-bar-bottom"
|
53
|
+
end
|
54
|
+
|
55
|
+
def theme_class
|
56
|
+
StaffBar.config.theme == :light ? "staff-bar-inverse" : ""
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
def cache_enabled?
|
61
|
+
Rails.application.config.action_controller.perform_caching
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/staff_bar.rb
ADDED
data/preview-sm.png
ADDED
Binary file
|
data/preview.png
ADDED
Binary file
|
data/staff_bar.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
$:.push File.expand_path("lib", __dir__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "staff_bar/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "staff_bar"
|
9
|
+
spec.version = StaffBar::VERSION
|
10
|
+
spec.authors = ["Rolandas Barysas"]
|
11
|
+
spec.email = ["rolandas@rolandasb.com"]
|
12
|
+
spec.homepage = "https://github.com/decentbudget/staff_bar"
|
13
|
+
spec.summary = "Show a bar with general project information for administrators."
|
14
|
+
spec.description = "Show a bar with general project information for administrators."
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split("\n")
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "rails", ">= 5.0.0"
|
21
|
+
spec.add_dependency "octicons_helper", "~> 9"
|
22
|
+
|
23
|
+
spec.add_development_dependency "sqlite3"
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
2.5.3
|
data/test/dummy/BRANCH
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
foo-branch
|
data/test/dummy/REVISION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
abcd1234
|
data/test/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require activestorage
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
4
|
+
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
7
|
+
end
|