Module: StaffBar
- Defined in:
- lib/staff_bar.rb,
lib/staff_bar/core.rb,
lib/staff_bar/config.rb,
lib/staff_bar/engine.rb,
lib/staff_bar/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.1.1'
Class Method Summary collapse
- .branch ⇒ Object
- .cache ⇒ Object
- .cache_class ⇒ Object
- .config ⇒ Object
- .configure {|config| ... } ⇒ Object
- .environment ⇒ Object
- .position_class ⇒ Object
- .rails_version ⇒ Object
- .revision ⇒ Object
- .ruby_version ⇒ Object
- .theme_class ⇒ Object
- .time ⇒ Object
- .time_zone ⇒ Object
Class Method Details
.branch ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/staff_bar/core.rb', line 14 def branch if File.exist?(File.join(Rails.root, "BRANCH")) file = File.join(Rails.root, "BRANCH") File.read(file).chomp elsif File.exist?(File.join(Rails.root, ".git")) `git rev-parse --abbrev-ref HEAD`.chomp end end |
.cache ⇒ Object
43 44 45 |
# File 'lib/staff_bar/core.rb', line 43 def cache cache_enabled? ? "Caching enabled" : "Caching disabled" end |
.cache_class ⇒ Object
47 48 49 |
# File 'lib/staff_bar/core.rb', line 47 def cache_class cache_enabled? ? "staff-bar-green" : "" end |
.config ⇒ Object
9 10 11 |
# File 'lib/staff_bar/config.rb', line 9 def config @_config ||= Config.new end |
.configure {|config| ... } ⇒ Object
5 6 7 |
# File 'lib/staff_bar/config.rb', line 5 def configure yield config end |
.environment ⇒ Object
31 32 33 |
# File 'lib/staff_bar/core.rb', line 31 def environment Rails.env end |
.position_class ⇒ Object
51 52 53 |
# File 'lib/staff_bar/core.rb', line 51 def position_class StaffBar.config.position == :top ? "staff-bar-top" : "staff-bar-bottom" end |
.rails_version ⇒ Object
27 28 29 |
# File 'lib/staff_bar/core.rb', line 27 def rails_version Rails.version end |
.revision ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/staff_bar/core.rb', line 5 def revision if File.exist?(File.join(Rails.root, "REVISION")) file = File.join(Rails.root, "REVISION") File.read(file).chomp.first(7) elsif File.exist?(File.join(Rails.root, ".git")) `git rev-parse --short HEAD`.chomp end end |
.ruby_version ⇒ Object
23 24 25 |
# File 'lib/staff_bar/core.rb', line 23 def ruby_version RUBY_VERSION end |
.theme_class ⇒ Object
55 56 57 |
# File 'lib/staff_bar/core.rb', line 55 def theme_class StaffBar.config.theme == :light ? "staff-bar-inverse" : "" end |
.time ⇒ Object
35 36 37 |
# File 'lib/staff_bar/core.rb', line 35 def time Time.current.to_s end |
.time_zone ⇒ Object
39 40 41 |
# File 'lib/staff_bar/core.rb', line 39 def time_zone Time.zone.tzinfo.identifier end |