Module: LocalConfig
- Defined in:
- lib/localconfig/rake.rb,
lib/localconfig/admin.rb,
lib/localconfig/rails.rb,
lib/localconfig/config.rb,
lib/localconfig/version.rb
Overview
namespace
Defined Under Namespace
Modules: Rake Classes: Config, Railtie
Constant Summary collapse
- CONFIGS =
{}
- VERSION =
'0.3.0'
- DATE =
'2014-10-21'
Class Method Summary collapse
-
.[](name) ⇒ Object
get (new) Config by name.
-
._branch ⇒ Object
current git branch.
-
.branch ⇒ Object
either the current git branch, '(HEAD)' for a detached head, or nil if not in a git repo; (cached);.
-
.env ⇒ Object
like Rails.env; (cached).
Class Method Details
.[](name) ⇒ Object
get (new) Config by name
211 212 213 |
# File 'lib/localconfig/config.rb', line 211 def self.[](name) CONFIGS[name] ||= Config.new end |
._branch ⇒ Object
current git branch
232 233 234 235 236 |
# File 'lib/localconfig/config.rb', line 232 def self._branch c = 'git symbolic-ref -q HEAD 2>/dev/null' b = %x[#{c}].chomp.sub %r{^refs/heads/}, '' [0,1].include?($?.exitstatus) ? (b.empty? ? '(HEAD)' : b) : nil end |
.branch ⇒ Object
either the current git branch, '(HEAD)' for a detached head, or nil if not in a git repo; (cached);
to use this in a Gemfile, you will need to have the localconfig gem installed locally before running bundle
220 221 222 |
# File 'lib/localconfig/config.rb', line 220 def self.branch @branch ||= _branch end |
.env ⇒ Object
like Rails.env; (cached)
225 226 227 |
# File 'lib/localconfig/config.rb', line 225 def self.env @env ||= ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' end |