diff --git a/.gitignore b/.gitignore index 19fba485b..ea63e8b96 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ public/images/ball.png config/app_config.yml config/app.yml config/application.yml +config/heroku.yml config/script_server*.yml config/fb_config.yml config/oauth_keys.yml diff --git a/Gemfile b/Gemfile index a0ed8e234..7f0ba8430 100644 --- a/Gemfile +++ b/Gemfile @@ -139,6 +139,7 @@ end group :development do gem 'heroku' + gem 'heroku_san' gem 'capistrano', '~> 2.9.0', :require => false gem 'capistrano_colors', :require => false gem 'capistrano-ext', '1.2.1', :require => false diff --git a/Gemfile.lock b/Gemfile.lock index 18b202e1b..fd70d6ccc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -194,6 +194,9 @@ GEM rest-client (~> 1.6.1) rubyzip term-ansicolor (~> 1.0.5) + heroku_san (1.3.0) + heroku (>= 2) + rails (>= 2) highline (1.6.9) hoptoad_notifier (2.4.11) activesupport @@ -442,6 +445,7 @@ DEPENDENCIES fuubar (= 0.0.6) haml heroku + heroku_san hoptoad_notifier http_accept_language! i18n-inflector-rails (~> 1.0) diff --git a/config/heroku.yml.example b/config/heroku.yml.example new file mode 100644 index 000000000..332ed764a --- /dev/null +++ b/config/heroku.yml.example @@ -0,0 +1,15 @@ +defaults: &defaults + HEROKU: true + application_yml: <%= '../' + '../' +'config/' + 'application.yml.example' %> +production: + app: production + stack: cedar + config: + <<: *defaults + BUNDLE_WITHOUT: "development:test" +staging: + app: staging + stack: cedar + config: + <<: *defaults + BUNDLE_WITHOUT: "development:test" diff --git a/lib/tasks/heroku.rake b/lib/tasks/heroku.rake index 22ddd78c7..3b702d7fc 100644 --- a/lib/tasks/heroku.rake +++ b/lib/tasks/heroku.rake @@ -1,26 +1,18 @@ -# Copyright (c) 2012, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -# + #Copyright (c) 2012, Diaspora Inc. This file is + #licensed under the Affero General Public License version 3 or later. See + #the COPYRIGHT file. + require File.join(Rails.root, 'lib', 'enviroment_configuration') namespace :heroku do - HEROKU_CONFIG_ADD_COMMAND = "heroku config:add HEROKU=true" - - task :config do - puts "Reading config/application.yml and sending config vars to Heroku..." - 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) - - #"#{key}=\"#{value}\"" - #end.join(' ') + HEROKU_CONFIG_ADD_COMMAND = "heroku config:add" + task :generate_secret_token do 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=true SECRET_TOKEN=#{token}" + command = "#{HEROKU_CONFIG_ADD_COMMAND} SECRET_TOKEN=#{token}" + puts command + system command end task :install_requirements do