Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Spangenberg committed Apr 16, 2011
2 parents f6b12e1 + d2d9c3f commit 440ed0b
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source "http://rubygems.org"

# Specify your gem's dependencies in heroku_env.gemspec
gemspec
23 changes: 23 additions & 0 deletions README.textile
@@ -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>
2 changes: 2 additions & 0 deletions Rakefile
@@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks
23 changes: 23 additions & 0 deletions heroku_env.gemspec
@@ -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
19 changes: 19 additions & 0 deletions lib/heroku_env.rb
@@ -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
3 changes: 3 additions & 0 deletions lib/heroku_env/version.rb
@@ -0,0 +1,3 @@
module HerokuEnv
VERSION = "0.1.0"
end

0 comments on commit 440ed0b

Please sign in to comment.