diff --git a/Gemfile b/Gemfile index b5df343a6..80798761e 100644 --- a/Gemfile +++ b/Gemfile @@ -40,7 +40,7 @@ group :heroku do gem 'pg' end -gem 'settingslogic', '2.0.6' +gem 'settingslogic', :git => 'https://github.com/binarylogic/settingslogic.git' # database gem 'activerecord-import' diff --git a/Gemfile.lock b/Gemfile.lock index 6beb3d254..49bfd99df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,6 +40,12 @@ GIT specs: http_accept_language (1.0.1) +GIT + remote: https://github.com/binarylogic/settingslogic.git + revision: 4884d455bf18d92723cb8190cfd2dbf87f3aafd5 + specs: + settingslogic (2.0.8) + GEM remote: http://rubygems.org/ specs: @@ -360,7 +366,6 @@ GEM ffi (~> 1.0.9) multi_json (~> 1.0.4) rubyzip - settingslogic (2.0.6) simple_oauth (0.1.5) sinatra (1.2.8) rack (~> 1.1) @@ -479,7 +484,7 @@ DEPENDENCIES ruby-oembed sass selenium-webdriver (~> 2.16.0) - settingslogic (= 2.0.6) + settingslogic! sqlite3 thin (~> 1.3.1) timecop diff --git a/app/models/app_config.rb b/app/models/app_config.rb index 88857781e..12e266bac 100644 --- a/app/models/app_config.rb +++ b/app/models/app_config.rb @@ -6,9 +6,11 @@ require 'uri' require File.join(Rails.root, 'lib', 'enviroment_configuration') class AppConfig < Settingslogic - ARRAY_VARS = [:community_spotlight, :admins] - def self.source_file_name + if ENV['application_yml'].present? + puts "using remote application.yml" + return ENV['application_yml'] + end config_file = File.join(Rails.root, "config", "application.yml") if !File.exists?(config_file) && (Rails.env == 'test' || Rails.env.include?("integration") || EnviromentConfiguration.heroku?) config_file = File.join(Rails.root, "config", "application.yml.example") @@ -121,18 +123,9 @@ HELP def self.[] (key) return self.pod_uri if key == :pod_uri - return fetch_from_env(key.to_s) if EnviromentConfiguration.heroku? super end - def fetch_from_env(key) - if ARRAY_VARS.include?(key.to_sym) - ENV[key].split(EnviromentConfiguration::ARRAY_SEPERATOR) - else - ENV[key] if ENV[key] - end - end - def self.[]= (key, value) super if key.to_sym == :pod_url diff --git a/lib/tasks/heroku.rake b/lib/tasks/heroku.rake index b786eabb1..22ddd78c7 100644 --- a/lib/tasks/heroku.rake +++ b/lib/tasks/heroku.rake @@ -12,15 +12,15 @@ namespace :heroku do application_config = YAML.load_file('config/application.yml')['production'] rescue {} application_config.delete_if { |k, v| v.nil? or v.to_s.empty? } - heroku_env = application_config.map do|key, value| - value =value.join(EnviromentConfiguration::ARRAY_SEPERATOR) if value.respond_to?(:join) + #heroku_env = application_config.map do|key, value| + #value =value.join(EnviromentConfiguration::ARRAY_SEPERATOR) if value.respond_to?(:join) - "#{key}=\"#{value}\"" - end.join(' ') + #"#{key}=\"#{value}\"" + #end.join(' ') puts "Generating and setting a new secret token" token = ActiveSupport::SecureRandom.hex(40)#reloads secret token every time you reload vars.... this expires cookies, and kinda sucks - system "#{HEROKU_CONFIG_ADD_COMMAND} #{heroku_env} SECRET_TOKEN=#{token}" + system "#{HEROKU_CONFIG_ADD_COMMAND} HEROKU=true SECRET_TOKEN=#{token}" end task :install_requirements do