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.2.0'
- DATE =
'2013-09-01'
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
119 120 121 |
# File 'lib/localconfig/config.rb', line 119 def self.[](name) CONFIGS[name] ||= Config.new end |
._branch ⇒ Object
current git branch
140 141 142 143 144 |
# File 'lib/localconfig/config.rb', line 140 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
128 129 130 |
# File 'lib/localconfig/config.rb', line 128 def self.branch @branch ||= _branch end |
.env ⇒ Object
like Rails.env; (cached)
133 134 135 |
# File 'lib/localconfig/config.rb', line 133 def self.env @env ||= ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' end |