heroku_env 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -2
- data/lib/heroku_env.rb +24 -9
- data/lib/heroku_env/version.rb +1 -1
- metadata +2 -2
data/README.textile
CHANGED
@@ -19,5 +19,5 @@ without changing herokus or your variables
|
|
19
19
|
FOO: BAR
|
20
20
|
</code></pre>
|
21
21
|
|
22
|
-
|
23
|
-
<code>config
|
22
|
+
You can generate a default <code>heroku_env.yml</code> file with a rake task:
|
23
|
+
<code>rake heroku_env:config:create</code>
|
data/lib/heroku_env.rb
CHANGED
@@ -1,16 +1,31 @@
|
|
1
1
|
module HerokuEnv
|
2
2
|
module Rails
|
3
3
|
class Railtie < ::Rails::Railtie
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
config
|
8
|
-
|
4
|
+
|
5
|
+
rake_tasks do
|
6
|
+
namespace :heroku_env do
|
7
|
+
namespace :config do
|
8
|
+
desc "Create heroku_env.yml from heroku config"
|
9
|
+
task :create => :environment do
|
10
|
+
heroku_config = `heroku config --shell`.split("\n").inject({}) do |config, item|
|
11
|
+
key, value = item.split(/\s+\=\>\s+/, 2)
|
12
|
+
config[key] = value
|
13
|
+
config
|
14
|
+
end
|
15
|
+
heroku_env = { :development => heroku_config.clone, :test => heroku_config.clone }
|
16
|
+
puts heroku_env.to_yaml
|
17
|
+
end
|
18
|
+
end
|
9
19
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
20
|
+
end
|
21
|
+
|
22
|
+
unless ENV.include?('HEROKU_UPID')
|
23
|
+
config.before_configuration do
|
24
|
+
if heroku_config = YAML.load_file(File.join(::Rails.root, "config", "heroku_env.yml"))[::Rails.env] rescue nil || {}
|
25
|
+
heroku_config.each do |key, value|
|
26
|
+
ENV[key] = value if !ENV.has_key?(key) && !["BUNDLE_WITHOUT", "RACK_ENV"].include?(key)
|
27
|
+
end
|
28
|
+
end
|
14
29
|
end
|
15
30
|
end
|
16
31
|
|
data/lib/heroku_env/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: heroku_env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Daniel Spangenberg
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-20 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: heroku
|