ribbonit 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -1
- data/CHANGELOG.md +19 -0
- data/README.md +23 -22
- data/lib/app/views/partials/_lines.html.erb +1 -1
- data/lib/app/views/partials/_ribbon.html.erb +1 -1
- data/lib/generators/ribbonit/templates/ribbonit.rb +0 -5
- data/lib/ribbonit/configuration.rb +15 -16
- data/lib/ribbonit/rails/engine.rb +1 -1
- data/lib/ribbonit/version.rb +1 -1
- data/lib/ribbonit/view_helpers.rb +15 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e312f51b512269d4ea31095f39b27c2d67e37a
|
4
|
+
data.tar.gz: 6e346df688f98baa773efda599fc5c46647452d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c14899ba350feb3d23f684a3c84f34e8227f1d475ea7ad484d5d34afbf1dc24fcde2c95df3790008d87901cc4bbd13c3fd9d280de70970c2a49a5ff27878771
|
7
|
+
data.tar.gz: 6fa6226506a52ef05c0d017e994bdb9a1770f5830bd2e27de73d3c26a84431d4a1f075a5ecd56364226a97a88836f54120e84f385c343ba212eaa8368546ebcf
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
inherit_from:
|
1
|
+
inherit_from:
|
2
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-bundler.yml
|
3
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-layout.yml
|
4
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-lint.yml
|
5
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-naming.yml
|
6
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-performance.yml
|
7
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-style.yml
|
8
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-rails.yml
|
2
9
|
|
3
10
|
AllCops:
|
11
|
+
DisabledByDefault: true
|
4
12
|
TargetRubyVersion: 2.4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.3.0](https://github.com/anthony-robin/Ribbonit/tree/v0.3.0) (2017-11-06)
|
4
|
+
[Full Changelog](https://github.com/anthony-robin/Ribbonit/compare/v0.2.1...v0.3.0)
|
5
|
+
|
6
|
+
**Implemented enhancements:**
|
7
|
+
|
8
|
+
- REFACTOR way to define environments to apply [\#25](https://github.com/anthony-robin/Ribbonit/pull/25) ([anthony-robin](https://github.com/anthony-robin))
|
9
|
+
- UPDATE Rubocop sources [\#24](https://github.com/anthony-robin/Ribbonit/pull/24) ([anthony-robin](https://github.com/anthony-robin))
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- CLEAN documentation options [\#26](https://github.com/anthony-robin/Ribbonit/pull/26) ([anthony-robin](https://github.com/anthony-robin))
|
14
|
+
|
15
|
+
## [v0.2.1](https://github.com/anthony-robin/Ribbonit/tree/v0.2.1) (2017-06-04)
|
16
|
+
[Full Changelog](https://github.com/anthony-robin/Ribbonit/compare/v0.2.0...v0.2.1)
|
17
|
+
|
18
|
+
**Fixed bugs:**
|
19
|
+
|
20
|
+
- FIX broken CSS [\#21](https://github.com/anthony-robin/Ribbonit/pull/21) ([anthony-robin](https://github.com/anthony-robin))
|
21
|
+
|
3
22
|
## [v0.2.0](https://github.com/anthony-robin/Ribbonit/tree/v0.2.0) (2017-05-28)
|
4
23
|
[Full Changelog](https://github.com/anthony-robin/Ribbonit/compare/v0.1.0...v0.2.0)
|
5
24
|
|
data/README.md
CHANGED
@@ -53,33 +53,34 @@ body
|
|
53
53
|
```
|
54
54
|
|
55
55
|
## Options
|
56
|
-
You can customize some options through the initializer. Here are the
|
56
|
+
You can customize some options through the initializer. Here are the default ones:
|
57
57
|
|
58
58
|
```ruby
|
59
59
|
# config/initializers/ribbonit.rb
|
60
|
-
|
61
|
-
# rails_version: Version of Ruby on Rails
|
62
|
-
# ruby_version: Version of Ruby
|
63
|
-
# git_branch: Current git branch (only displayed in development)
|
64
|
-
config.infos_to_display = %i[rails_version ruby_version git_branch]
|
65
|
-
|
66
|
-
config.root_link = false # Wrap ribbon with root_url link ?
|
67
|
-
|
68
|
-
hide_for_small = true # Display ribbon in small devices ?
|
69
|
-
position = 'top-left' # top-right, bottom-left, bottom-right
|
70
|
-
sticky = true # stick to page corner ?
|
71
|
-
|
72
|
-
# Available colors:
|
73
|
-
# orange, blue, green, red, purple, black, white
|
74
|
-
themes = {
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
staging_name = 'staging'
|
60
|
+
Ribbonit.configure do |config|
|
61
|
+
# rails_version: Version of Ruby on Rails
|
62
|
+
# ruby_version: Version of Ruby
|
63
|
+
# git_branch: Current git branch (only displayed in development)
|
64
|
+
config.infos_to_display = %i[rails_version ruby_version git_branch]
|
65
|
+
|
66
|
+
config.root_link = false # Wrap ribbon with root_url link ?
|
67
|
+
|
68
|
+
config.hide_for_small = true # Display ribbon in small devices ?
|
69
|
+
config.position = 'top-left' # top-right, bottom-left, bottom-right
|
70
|
+
config.sticky = true # stick to page corner ?
|
71
|
+
|
72
|
+
# Available colors:
|
73
|
+
# orange, blue, green, red, purple, black, white
|
74
|
+
config.themes = {
|
75
|
+
development: 'black',
|
76
|
+
staging: 'blue',
|
77
|
+
my_custom_environment: 'purple'
|
78
|
+
}
|
79
|
+
end
|
81
80
|
```
|
82
81
|
|
82
|
+
To add a custom environment, just add it inside the `themes` option and set the color you want (careful, if you define `config.themes` in your initializer it will erase default environments values so you will have to readd them).
|
83
|
+
|
83
84
|
## Screenshots
|
84
85
|
### Colors
|
85
86
|
<table>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<% end %>
|
11
11
|
</span>
|
12
12
|
|
13
|
-
<% if config.infos_to_display.include?(:git_branch)
|
13
|
+
<% if config.infos_to_display.include?(:git_branch) %>
|
14
14
|
<span class="ribbon__container__git">
|
15
15
|
Branch: <strong><%= branch_name %></strong>
|
16
16
|
</span>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% config = Ribbonit.configuration %>
|
2
2
|
|
3
|
-
<% if
|
3
|
+
<% if config.themes.keys.include? Rails.env.to_sym %>
|
4
4
|
|
5
5
|
<div id="ribbon" class="ribbon ribbon--<%= config.position %> <%= config.hide_for_small ? 'ribbon--hide-for-small' : '' %> <%= config.sticky ? 'ribbon--sticky' : '' %> ribbon--<%= line_count %>-lines">
|
6
6
|
<div class="ribbon__container ribbon__container--<%= config.themes[Rails.env.to_sym] %>">
|
@@ -8,23 +8,22 @@ module Ribbonit
|
|
8
8
|
def self.configure
|
9
9
|
yield configuration
|
10
10
|
end
|
11
|
-
end
|
12
11
|
|
13
|
-
class
|
14
|
-
|
12
|
+
class Configuration
|
13
|
+
include ActiveSupport::Configurable
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
15
|
+
config_accessor(:infos_to_display) do
|
16
|
+
%i[rails_version ruby_version]
|
17
|
+
end
|
18
|
+
config_accessor(:root_link) { false }
|
19
|
+
config_accessor(:hide_for_small) { true }
|
20
|
+
config_accessor(:position) { 'top-left' }
|
21
|
+
config_accessor(:sticky) { true }
|
22
|
+
config_accessor(:themes) do
|
23
|
+
{
|
24
|
+
development: 'black',
|
25
|
+
staging: 'blue'
|
26
|
+
}
|
27
|
+
end
|
28
28
|
end
|
29
|
-
config_accessor(:staging_name) { 'staging' }
|
30
29
|
end
|
@@ -4,7 +4,7 @@ require 'ribbonit/view_helpers'
|
|
4
4
|
module Ribbonit
|
5
5
|
module Rails
|
6
6
|
class Engine < ::Rails::Engine
|
7
|
-
initializer 'ribbonit.view_helpers' do |
|
7
|
+
initializer 'ribbonit.view_helpers' do |_app|
|
8
8
|
ActionView::Base.send :include, ViewHelpers
|
9
9
|
ActiveSupport.on_load(:action_controller) do
|
10
10
|
append_view_path "#{Gem.loaded_specs['ribbonit'].full_gem_path}/lib/app/views/partials"
|
data/lib/ribbonit/version.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
-
module Ribbonit
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Ribbonit
|
2
|
+
module ViewHelpers
|
3
|
+
def ribbonit
|
4
|
+
render '/ribbon'
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
def branch_name
|
8
|
+
`git rev-parse --abbrev-ref HEAD`.gsub('feature/', '')
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
def line_count
|
12
|
+
height = 1
|
13
|
+
items = Ribbonit.configuration.infos_to_display
|
14
|
+
height += 1 if items.include?(:ruby_version) || items.include?(:rails_version)
|
15
|
+
height += 1 if items.include?(:git_branch)
|
16
|
+
height
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ribbonit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Robin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06
|
11
|
+
date: 2017-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|