Skip to content

Commit

Permalink
rename config/app_config.yml to config/app.yml in accordance to The R…
Browse files Browse the repository at this point in the history
…edundant Rendundacy Act of 2011
  • Loading branch information
veganstraightedge committed May 18, 2011
1 parent 6cda0bf commit 910cc52
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public/images/ball_small.png
public/images/ball.png
# Configuration files
config/app_config.yml
config/app.yml
config/fb_config.yml
config/oauth_keys.yml
config/initializers/secret_token.rb
Expand Down
8 changes: 4 additions & 4 deletions config/app_config.yml.example → config/app.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ default:

#google analytics key, if false, it won't include the javascript
google_a_site: false

#piwik integration if not set, no javascript included
piwik_id:
piwik_id:
# the site url in raw format (e.g. pikwik.examplehost.com)
piwik_url:
piwik_url:


#cloudfiles username and api-key, used for backups
cloudfiles_username: 'example'
Expand Down
2 changes: 1 addition & 1 deletion config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace :deploy do
task :symlink_config_files do
run "ln -s -f #{shared_path}/config/database.yml #{current_path}/config/database.yml"
run "ln -s -f #{shared_path}/config/app_config.yml #{current_path}/config/app_config.yml"
run "ln -s -f #{shared_path}/config/app.yml #{current_path}/config/app.yml"
run "ln -s -f #{shared_path}/config/oauth_keys.yml #{current_path}/config/oauth_keys.yml"
end

Expand Down
4 changes: 2 additions & 2 deletions config/initializers/_load_app_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# the COPYRIGHT file.
#
# Sets up AppConfig. Unless stated below, each entry is a the string in
# the file app_config.yml, as applicable for current environment.
# the file app.yml, as applicable for current environment.
#
# Specific items
# * pod_url: As in app_config.yml, normalized with a trailing /.
# * pod_url: As in app.yml, normalized with a trailing /.
# * pod_uri: An uri object derived from pod_url.

require File.join(Rails.root, 'lib', 'app_config')
Expand Down
8 changes: 4 additions & 4 deletions db/seeds/backer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def create

#set pod url
username = backer_info[backer_number]['username'].gsub(/ /,'').downcase
set_app_config username unless File.exists?(Rails.root.join('config', 'app_config.yml'))
set_app_config username unless File.exists?(Rails.root.join('config', 'app.yml'))

require File.join(File.dirname(__FILE__), "..", "..", "config", "initializers", "_load_app_config.rb")
require File.join(File.dirname(__FILE__), "..", "..", "config", "initializers", "_load_app.rb")

# Create seed user
user = User.build(:email => "#{username}@#{username}.joindiaspora.com",
Expand All @@ -36,11 +36,11 @@ def create
end

def set_app_config username
current_config = YAML.load(File.read(Rails.root.join('config', 'app_config.yml.example')))
current_config = YAML.load(File.read(Rails.root.join('config', 'app.yml.example')))
current_config[Rails.env.to_s] ||= {}
current_config[Rails.env.to_s]['pod_url'] = "http://#{username}.joindiaspora.com/"
current_config['default']['pod_url'] = "http://#{username}.joindiaspora.com/"
file = File.new(Rails.root.join('..','..','shared','app_config.yml'),'w')
file = File.new(Rails.root.join('..','..','shared','app.yml'),'w')
file.write(current_config.to_yaml)
file.close
end
6 changes: 3 additions & 3 deletions db/seeds/dev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods")

def set_app_config username
current_config = YAML.load(File.read(Rails.root.join('config', 'app_config.yml.example')))
current_config = YAML.load(File.read(Rails.root.join('config', 'app.yml.example')))
current_config[Rails.env.to_s] ||= {}
current_config[Rails.env.to_s]['pod_url'] ||= "#{username}.joindiaspora.com"
current_config['default']['pod_url'] ||= "#{username}.joindiaspora.com"
file = File.new(Rails.root.join('config','app_config.yml'),'w')
file = File.new(Rails.root.join('config','app.yml'),'w')
file.write(current_config.to_yaml)
file.close
end

username = "tom"
set_app_config username unless File.exists?(Rails.root.join('config', 'app_config.yml'))
set_app_config username unless File.exists?(Rails.root.join('config', 'app.yml'))

require Rails.root.join('config', "initializers", "_load_app_config.rb")
include HelperMethods
Expand Down
6 changes: 3 additions & 3 deletions db/seeds/tom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods")

def set_app_config username
current_config = YAML.load(File.read(Rails.root.join('config', 'app_config.yml.example')))
current_config = YAML.load(File.read(Rails.root.join('config', 'app.yml.example')))
current_config[Rails.env.to_s] ||= {}
current_config[Rails.env.to_s]['pod_url'] = "http://#{username}.joindiaspora.com/"
current_config['default']['pod_url'] = "http://#{username}.joindiaspora.com/"
file = File.new(Rails.root.join('..','..','shared','app_config.yml'),'w')
file = File.new(Rails.root.join('..','..','shared','app.yml'),'w')
file.write(current_config.to_yaml)
file.close
end

set_app_config "tom" unless File.exists?(Rails.root.join('config', 'app_config.yml'))
set_app_config "tom" unless File.exists?(Rails.root.join('config', 'app.yml'))

require 'config/initializers/_load_app_config.rb'
include HelperMethods
Expand Down
12 changes: 6 additions & 6 deletions lib/app_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ def self.configure_for_environment(env)

def self.load_config_for_environment(env)
if File.exist? "#{Rails.root}/config/app_config.yml.example"
all_envs = load_config_yaml "#{Rails.root}/config/app_config.yml.example"
all_envs = load_config_yaml "#{Rails.root}/config/app.yml.example"
else
$stderr.puts "ERROR: Why have you deleted config/app_config.yml.example?"
$stderr.puts "ERROR: Why have you deleted config/app.yml.example?"
all_envs = {}
end
if File.exist? "#{Rails.root}/config/app_config.yml"
all_envs_custom = load_config_yaml "#{Rails.root}/config/app_config.yml"
if File.exist? "#{Rails.root}/config/app.yml"
all_envs_custom = load_config_yaml "#{Rails.root}/config/app.yml"
all_envs.deep_merge!(all_envs_custom)
else
unless Rails.env == "development" || Rails.env == "test"
$stderr.puts "WARNING: No config/app_config.yml found! Look at config/app_config.yml.example for help."
$stderr.puts "WARNING: No config/app.yml found! Look at config/app_config.yml.example for help."
end
end

Expand Down Expand Up @@ -68,7 +68,7 @@ def self.normalize_pod_url

def self.check_pod_uri
if self.config_vars[:pod_uri].host == "example.org" && Rails.env != "test"
puts "WARNING: Please modify your app_config.yml to have a proper pod_url!"
puts "WARNING: Please modify your app.yml to have a proper pod_url!"
end
end

Expand Down
2 changes: 1 addition & 1 deletion public/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h3>You're about to change the Internet. Let's get you set up, shall we?</h3>
<li>
<h2>Configure your <abbr class="helpful" title="A Diaspora installation">pod</abbr></h2>
<img src='images/icons/cog.png'/>
<p>Look at <code class="helpful" title='General pod configuration (location to upload photos, SSL certs, etc.)'>config/app_config.yml.example</code> and <code class="helpful" title="mySQL username/password">config/database.yml.example</code> for help.</p>
<p>Look at <code class="helpful" title='General pod configuration (location to upload photos, SSL certs, etc.)'>config/app.yml.example</code> and <code class="helpful" title="mySQL username/password">config/database.yml.example</code> for help.</p>
</li>

<li>
Expand Down
4 changes: 2 additions & 2 deletions script/server
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ fi


# Check if config files exists
if [ ! -e 'config/app_config.yml' ]; then
echo "FATAL: config/app_config.yml is missing! Copy over config/app_config.yml.example to config/app_config.yml and edit it properly!" >&2
if [ ! -e 'config/app.yml' ]; then
echo "FATAL: config/app.yml is missing! Copy over config/app.yml.example to config/app.yml and edit it properly!" >&2
exit 67
fi

Expand Down

0 comments on commit 910cc52

Please sign in to comment.