Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved config settings into blue_light_special.yml

  • Loading branch information...
commit f0246bbe4596af037efe0b3e7d232991b4f9ccec 1 parent 65b1057
@markkendall markkendall authored
View
4 Rakefile
@@ -37,7 +37,7 @@ namespace :test do
end
end
-generators = %w(blue_light_special blue_light_special_tests)
+generators = %w(blue_light_special blue_light_special_tests blue_light_special_admin)
namespace :generator do
desc "Cleans up the test app before running the generator"
@@ -54,7 +54,7 @@ namespace :generator do
desc "Run the blue_light_special generator"
task :blue_light_special do
- system "cd test/rails_root && ./script/generate blue_light_special -f && ./script/generate delayed_job && ./script/generate facebook && rake gems:unpack && rake db:migrate db:test:prepare"
+ system "cd test/rails_root && ./script/generate blue_light_special -f && ./script/generate delayed_job && rake gems:unpack && rake db:migrate db:test:prepare"
end
desc "Run the blue_light_special tests generator"
View
6 app/controllers/blue_light_special/sessions_controller.rb
@@ -28,8 +28,10 @@ def create
end
def destroy
- cookies[BlueLightSpecial.configuration.facebook_api_key + "_user"] = nil
- cookies[BlueLightSpecial.configuration.facebook_api_key + "_session_key"] = nil
+ if BlueLightSpecial.configuration.use_facebook_connect
+ cookies[BlueLightSpecial.configuration.facebook_api_key + "_user"] = nil
+ cookies[BlueLightSpecial.configuration.facebook_api_key + "_session_key"] = nil
+ end
sign_out
flash_success_after_destroy
redirect_to(url_after_destroy)
View
7 blue_light_special.gemspec
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Nathaniel Bibler", "Mark Kendall"]
- s.date = %q{2010-03-16}
+ s.authors = ["Nathaniel Bibler", "Mark Kendall", "Caike Souza"]
+ s.date = %q{2010-03-17}
s.description = %q{Rails authentication by email and password with integrated dependencies to MadMimi. Also provides administrative user impersonation.}
s.email = %q{nate@envylabs.com}
s.extra_rdoc_files = [
@@ -45,6 +45,7 @@ Gem::Specification.new do |s|
"generators/blue_light_special/templates/README",
"generators/blue_light_special/templates/application.html.erb",
"generators/blue_light_special/templates/blue_light_special.rb",
+ "generators/blue_light_special/templates/blue_light_special.yml",
"generators/blue_light_special/templates/factories.rb",
"generators/blue_light_special/templates/migrations/create_users.rb",
"generators/blue_light_special/templates/migrations/update_users.rb",
@@ -115,8 +116,6 @@ Gem::Specification.new do |s|
"test/rails_root/config/initializers/requires.rb",
"test/rails_root/config/initializers/time_formats.rb",
"test/rails_root/config/routes.rb",
- "test/rails_root/db/migrate/20100316205122_blue_light_special_create_users.rb",
- "test/rails_root/db/migrate/20100316205123_create_delayed_jobs.rb",
"test/rails_root/public/dispatch.rb",
"test/rails_root/script/create_project.rb",
"test/rails_root/test/factories/user.rb",
View
3  generators/blue_light_special/blue_light_special_generator.rb
@@ -6,7 +6,8 @@ class BlueLightSpecialGenerator < Rails::Generator::Base
def manifest
record do |m|
m.directory File.join("config", "initializers")
- m.file "blue_light_special.rb", "config/initializers/blue_light_special.rb"
+ m.file "blue_light_special.rb", "config/initializers/blue_light_special.rb"
+ m.file "blue_light_special.yml", "config/blue_light_special.yml"
m.directory File.join("app", "views", "layouts")
m.file "application.html.erb", "app/views/layouts/application.html.erb"
View
26 generators/blue_light_special/templates/blue_light_special.rb
@@ -1,7 +1,21 @@
-BlueLightSpecial.configure do |config|
- config.mailer_sender = 'donotreply@example.com'
- config.impersonation_hash = 'REPLACE WITH A LONG HASH HERE'
- config.use_facebook_connect = true
- config.facebook_api_key = 'KEY'
- config.facebook_secret_key = 'SECRET'
+require 'yaml'
+
+begin
+ configuration = YAML.load_file("#{Rails.root}/config/blue_light_special.yml")[Rails.env]
+ configuration = HashWithIndifferentAccess.new(configuration)
+
+ BlueLightSpecial.configure do |config|
+ config.mailer_sender = configuration[:mailer_sender]
+ config.impersonation_hash = configuration[:impersonation_hash]
+ config.use_facebook_connect = configuration[:use_facebook_connect]
+ config.facebook_api_key = configuration[:facebook_api_key]
+ config.facebook_secret_key = configuration[:facebook_secret_key]
+ end
+
+ MadMimiMailer.api_settings = {
+ :username => configuration[:madmimi_username],
+ :api_key => configuration[:madmimi_api_key]
+ }
+rescue LoadError
+ puts "The /config/blue_light_special.yml file is missing or broken."
end
View
42 generators/blue_light_special/templates/blue_light_special.yml
@@ -0,0 +1,42 @@
+#
+# The mailer_sender is set as the reply address for all notification emails.
+#
+# Set madmimi_username and madmimi_api_key to your MadMimi account username
+# and API key.
+#
+# The impersonation_hash is used to secure user impersonations. Set it to
+# a long, random hash.
+#
+# To turn on Facebook Connect, set use_facebook_connect to true.
+#
+# If you are using Facebook Connect, you'll need to provide your
+# application's API and secret keys from your Facebook application
+# settings at http://facebook.com/developers.
+#
+
+development:
+ mailer_sender: donotreply@example.com
+ madmimi_username:
+ madmimi_api_key:
+ impersonation_hash:
+ use_facebook_connect: false
+ facebook_api_key:
+ facebook_secret_key:
+
+test:
+ mailer_sender: donotreply@example.com
+ madmimi_username:
+ madmimi_api_key:
+ impersonation_hash:
+ use_facebook_connect: false
+ facebook_api_key:
+ facebook_secret_key:
+
+production:
+ mailer_sender: donotreply@example.com
+ madmimi_username:
+ madmimi_api_key:
+ impersonation_hash:
+ use_facebook_connect: false
+ facebook_api_key:
+ facebook_secret_key:
Please sign in to comment.
Something went wrong with that request. Please try again.