forked from travis-ci/travis-crowd
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
abstract settings for heroku, can use travis-cli for configuring and …
…deploying to heroku now
- Loading branch information
Sven Fuchs
committed
Jan 4, 2012
1 parent
692be63
commit db54363
Showing
16 changed files
with
49 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.bundle | ||
config/database.yml | ||
config/settings.yml | ||
config/travis.yml | ||
db/*.sqlite3 | ||
log/*.log | ||
tmp/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'settings' | ||
|
||
Rails.application.config.settings = Settings.new.load('config/settings.yml', Rails.env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
settings = Hashr.new(YAML.load(File.read('config/settings.yml'))) | ||
settings = Rails.application.config.settings | ||
|
||
Devise.setup do |c| | ||
require 'devise/orm/active_record' | ||
|
||
c.http_authenticatable = true | ||
|
||
c.omniauth :github, settings.github.client_id, settings.github.client_secret, :scope => settings.github.scope | ||
c.omniauth :twitter, settings.twitter.client_id, settings.twitter.client_secret | ||
# c.omniauth :github, settings.github.client_id, settings.github.client_secret, :scope => settings.github.scope | ||
# c.omniauth :twitter, settings.twitter.client_id, settings.twitter.client_secret | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
settings = Hashr.new(YAML.load(File.read('config/settings.yml'))) | ||
settings = Rails.application.config.settings | ||
|
||
Stripe.api_key = settings.stripe.secret_key | ||
STRIPE_PUBLIC_KEY = settings.stripe.public_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'hashr' | ||
require 'yaml' | ||
|
||
class Settings < Hashr | ||
extend Hashr::EnvDefaults | ||
|
||
self.env_namespace = 'travis' | ||
|
||
define :stripe => { secret_key: '', public_key: '' } | ||
|
||
def load(filename, env = nil) | ||
settings = File.exists?(filename) ? YAML.load(File.read(filename)) : {} | ||
settings = settings[env.to_s] || {} if env | ||
settings.each { |key, value| self[key] = value } | ||
self | ||
end | ||
|
||
def export_env! | ||
export_env.each { |key, value| ENV[key] = value } | ||
end | ||
|
||
def export_env | ||
collector = lambda do |hash, stack| | ||
hash.map do |key, value| | ||
stack.push(key.to_s.upcase) | ||
result = value.is_a?(Hash) ? collector.call(value, stack) : [stack.join('_'), value] | ||
result.tap { stack.pop } | ||
end | ||
end | ||
Hash[*collector.call(self, [self.class.env_namespace].compact).flatten] | ||
end | ||
end |