Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
*.gem | |||
.bundle | |||
Gemfile.lock | |||
pkg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
source "http://rubygems.org" | |||
|
|||
# Specify your gem's dependencies in heroku_env.gemspec | |||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
h1. Heroku Env - Easy heroku environment variables in development mode | |||
|
|||
h2. About | |||
|
|||
Heroku Env fetchs all your heroku config variables and set up them in your | |||
local development environment. | |||
|
|||
h2. Usage | |||
|
|||
Add the the gem to your <code>Gemfile</code> | |||
|
|||
<code>gem "heroku_env"</code> | |||
|
|||
Configure <code>config/heroku_env.yml</code> optionaly to customize the variables | |||
without changing herokus or your variables | |||
|
|||
<pre><code>development: | |||
GOOGLE_ANALYTICS: nil | |||
FOO: BAR | |||
</code></pre> | |||
|
|||
Heroku Env will overwrite herokus environment variables with yours in | |||
<code>config/heroku_env.yml</code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
require 'bundler' | |||
Bundler::GemHelper.install_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
# -*- encoding: utf-8 -*- | |||
$:.push File.expand_path("../lib", __FILE__) | |||
require "heroku_env/version" | |||
|
|||
Gem::Specification.new do |s| | |||
s.name = "heroku_env" | |||
s.version = HerokuEnv::VERSION | |||
s.platform = Gem::Platform::RUBY | |||
s.authors = ["Daniel Spangenberg"] | |||
s.email = ["daniel.spangenberg@parcydo.com"] | |||
s.homepage = "http://neonlex.github.com" | |||
s.summary = %q{With this gem you can develop with environment variables local like you would do on heroku.} | |||
s.description = %q{This gem provides heroku environment variables in your local development environment.} | |||
|
|||
s.add_dependency "heroku" | |||
|
|||
s.rubyforge_project = "heroku_env" | |||
|
|||
s.files = `git ls-files`.split("\n") | |||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | |||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | |||
s.require_paths = ["lib"] | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
module HerokuEnv | |||
module Rails | |||
class Railtie < ::Rails::Railtie | |||
config.before_configuration do | |||
heroku_config = `heroku config --shell`.split("\n").inject({}) do |config, item| | |||
key, value = item.split("=", 2) | |||
config[key] = value | |||
config | |||
end | |||
custom_config = YAML.load_file(File.join(::Rails.root, "config", "heroku_env.yml"))[::Rails.env] rescue {} | |||
config = heroku_config.merge(custom_config) | |||
config.each do |key, value| | |||
ENV[key] = value if !ENV.has_key?(key) && key != "BUNDLE_WITHOUT" | |||
end | |||
end | |||
|
|||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
module HerokuEnv | |||
VERSION = "0.1.0" | |||
end |