-
Notifications
You must be signed in to change notification settings - Fork 6
/
Rakefile
39 lines (34 loc) · 1.05 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
Rails::Application.load_tasks
def to_string_hash(source, separator = ".", target = {}, namespace = nil)
prefix = "#{namespace}#{separator}" if namespace
case source
when Hash
source.each do |key, value|
to_string_hash(value, separator, target, "#{prefix}#{key}")
end
when Array
source.each_with_index do |value, index|
to_string_hash(value, separator, target, "#{prefix}#{index}")
end
else
target[namespace] = source
end
target
end
task :heroku_vars do
require 'config/initializers/authlogic_connect_config.rb'
puts AuthlogicConnect.config.inspect
vars = to_string_hash(AuthlogicConnect.config, "_")
command = "heroku config:add "
vars.each do |k,v|
command << "#{k.to_s.upcase}=#{v.to_s} "
end
puts "command"
puts command
end