Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'release/0.1.0'

  • Loading branch information...
commit 440ed0b7d327998607e43e2a3a1c9bae574c6ccb 2 parents f6b12e1 + d2d9c3f
@spangenberg authored
View
4 .gitignore
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
View
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in heroku_env.gemspec
+gemspec
View
23 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>
View
2  Rakefile
@@ -0,0 +1,2 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
View
23 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
View
19 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
View
3  lib/heroku_env/version.rb
@@ -0,0 +1,3 @@
+module HerokuEnv
+ VERSION = "0.1.0"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.