uber_config 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  require 'yaml'
2
2
  require 'logger'
3
- require "uber_config/version"
3
+ require 'uber_config/version'
4
+ require 'open-uri'
4
5
 
5
6
  module UberConfig
6
7
 
@@ -0,0 +1,37 @@
1
+ # To use, add the following to your Rakefile
2
+ #desc 'Pushes config to IronCache and sets Heroku config variable.'
3
+ #namespace :config do
4
+ # task :push do
5
+ # UberConfig.push_heroku
6
+ # end
7
+ #end
8
+
9
+ module UberConfig
10
+
11
+ module Pusher
12
+
13
+ require 'iron_cache'
14
+
15
+ def self.push
16
+ config = UberConfig.load
17
+ raise "Config needs an app_name field." unless config['app_name']
18
+
19
+ c = IronCache::Client.new(config['iron'])
20
+ cache = c.cache("configs")
21
+ item = cache.put(config['app_name'], config.to_yaml)
22
+ p item
23
+
24
+ url = cache.url(config['app_name'])
25
+ url_with_token = url + "?oauth=#{c.token}"
26
+ url_with_token
27
+ end
28
+
29
+ def self.push_heroku
30
+ url_with_token = push
31
+
32
+ #puts url_with_token
33
+ puts `heroku config:add CONFIG_CACHE_KEY=#{url_with_token}`
34
+
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module UberConfig
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uber_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-26 00:00:00.000000000 Z
12
+ date: 2012-09-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Loads configs from common locations.
15
15
  email:
@@ -23,6 +23,7 @@ files:
23
23
  - README.md
24
24
  - Rakefile
25
25
  - lib/uber_config.rb
26
+ - lib/uber_config/pusher.rb
26
27
  - lib/uber_config/version.rb
27
28
  - test/config.json
28
29
  - test/config.yml