Permalink
Browse files

Final cleanup

-- Update readme regarding site deployment
-- Make Configs class the primary interface for env variables
-- Use admin email address for notifications
  • Loading branch information...
1 parent 6a095b0 commit 7e8151d04df59087a42e32b5d70a2093e161681d @mattolson committed Oct 7, 2010
View
@@ -42,15 +42,16 @@ How To Get Started
==================
- Fork this project
-- Customize the CSS to add your company branding
-- Sign up for Heroku and Amazon S3
-- Copy config/heroku_env.rb.template to config/heroku_env.rb and update accordingly
-- Add config variables to Heroku env with heroku config:add
-- Push to Heroku
-- Create admin account with console: heroku console, then Admin.create(:email => 'youremail', :password => 'yourpassword')
+- Sign up for Heroku and follow the Getting Started Guide: http://docs.heroku.com/quickstart
+- Sign up for Amazon S3: http://aws.amazon.com/
+- Copy config/heroku_env.rb.template to config/heroku_env.rb and update accordingly.
+ These values are used for local development.
+- Add corresponding config variables to Heroku environment with heroku config:add
+- Create admin account with heroku console: Admin.create(:email => 'youremail', :password => 'yourpassword')
- Customize site settings
- Customize Devise settings
- Customize config.action_mailer.default_url_options in environments/production.rb
+- Customize the CSS to add your company branding
- Publish your data
View
@@ -8,9 +8,9 @@ class App < ActiveRecord::Base
:convert_options => { :thumb => "-background transparent -gravity center -extent 100x100" },
:storage => :s3,
:path => "#{ ENV['RAILS_ENV'] }/apps/:id/:style_:filename",
- :bucket => ENV['S3_BUCKET'],
- :s3_credentials => { :access_key_id => ENV['S3_KEY'],
- :secret_access_key => ENV['S3_SECRET'] }
+ :bucket => Configs.s3_bucket,
+ :s3_credentials => { :access_key_id => Configs.s3_key,
+ :secret_access_key => Configs.s3_secret }
# Validation
validates_presence_of :title, :description, :submitter_name, :datasets
View
@@ -7,9 +7,9 @@ class Attachment < ActiveRecord::Base
:storage => :s3,
:path => "#{ ENV['RAILS_ENV'] }/datasets/attachments/:id/:filename",
:s3_headers => {'Content-Disposition' => 'attachment'},
- :bucket => ENV['S3_BUCKET'],
- :s3_credentials => { :access_key_id => ENV['S3_KEY'],
- :secret_access_key => ENV['S3_SECRET'] }
+ :bucket => Configs.s3_bucket,
+ :s3_credentials => { :access_key_id => Configs.s3_key,
+ :secret_access_key => Configs.s3_secret }
# Validations
validates_attachment_presence :attachment
validates_attachment_size :attachment, :less_than => 50.megabytes
View
@@ -5,9 +5,9 @@ class Company < ActiveRecord::Base
:convert_options => { :thumb => "-background transparent -gravity center -extent 150x150" },
:storage => :s3,
:path => "#{ ENV['RAILS_ENV'] }/companies/:id/:style_:filename",
- :bucket => ENV['S3_BUCKET'],
- :s3_credentials => { :access_key_id => ENV['S3_KEY'],
- :secret_access_key => ENV['S3_SECRET'] }
+ :bucket => Configs.s3_bucket,
+ :s3_credentials => { :access_key_id => Configs.s3_key,
+ :secret_access_key => Configs.s3_secret }
# Validation
validates_presence_of :name, :submitter_name
@@ -1,6 +1,6 @@
class ContactForm < MailForm
- sender Configs.notification_email_from
- recipients Configs.notification_email_to
+ sender Configs.notification_email
+ recipients Configs.notification_email
subject "Contact - Open Data Project"
attribute :name, :validate => true
View
@@ -15,9 +15,9 @@ class Dataset < ActiveRecord::Base
:convert_options => { :thumb => "-background transparent -gravity center -extent 100x100" },
:storage => :s3,
:path => "#{ ENV['RAILS_ENV'] }/datasets/:id/:style_:filename",
- :bucket => ENV['S3_BUCKET'],
- :s3_credentials => { :access_key_id => ENV['S3_KEY'],
- :secret_access_key => ENV['S3_SECRET'] }
+ :bucket => Configs.s3_bucket,
+ :s3_credentials => { :access_key_id => Configs.s3_key,
+ :secret_access_key => Configs.s3_secret }
# Validations
validates_presence_of :title, :description
View
@@ -11,7 +11,7 @@ def new_app
private
def setup
- from Configs.notification_email_from
- recipients Configs.notification_email_to
+ from Configs.notification_email
+ recipients Configs.notification_email
end
end
@@ -1,6 +1,6 @@
class SignupForm < MailForm
- sender Configs.notification_email_from
- recipients Configs.notification_email_to
+ sender Configs.notification_email
+ recipients Configs.notification_email
subject "Email Signup - Open Data Project"
attribute :email, :validate => ARValidation::EMAIL_RE
@@ -10,7 +10,7 @@
-%>
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
- dsq.src = 'http://<%= ENV["DISQUS_SHORTNAME"] %>.disqus.com/get_num_replies.js?<%= replies_query %>';
+ dsq.src = 'http://<%= Configs.disqus_shortname %>.disqus.com/get_num_replies.js?<%= replies_query %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
<% end -%>
@@ -3,7 +3,7 @@
<% if ENV["RAILS_ENV"] != "production" %>var disqus_developer = 1;<% end %>
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
- dsq.src = 'http://<%= ENV["DISQUS_SHORTNAME"] %>.disqus.com/embed.js';
+ dsq.src = 'http://<%= Configs.disqus_shortname %>.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
View
@@ -45,21 +45,41 @@ def self.dataset_certifications
@@DATASET_CERTIFICATIONS = [{}]
end
- # Name of company running this site (for press items and such)
- def self.company_name
- return @@COMPANY_NAME if defined?(@@COMPANY_NAME)
- @@COMPANY_NAME = 'Seventh Generation'
+ # S3 access key id
+ def self.s3_key
+ return @@S3_KEY if defined?(@@S3_KEY)
+ @@S3_KEY = ENV['S3_KEY']
end
- # Email address to use for site notifications
- def self.notification_email_from
- return @@NOTIFICATION_EMAIL_FROM if defined?(@@NOTIFICATION_EMAIL_FROM)
- @@NOTIFICATION_EMAIL_FROM = '"Open Data App" <app@rubycloud.com>'
+ # S3 access key secret
+ def self.s3_secret
+ return @@S3_SECRET if defined?(@@S3_SECRET)
+ @@S3_SECRET = ENV['S3_SECRET']
+ end
+
+ # S3 bucket
+ def self.s3_bucket
+ return @@S3_BUCKET if defined?(@@S3_BUCKET)
+ @@S3_BUCKET = ENV['S3_BUCKET']
+ end
+
+ # Disqus shortname
+ def self.disqus_shortname
+ return @@DISQUS_SHORTNAME if defined?(@@DISQUS_SHORTNAME)
+ @@DISQUS_SHORTNAME = ENV['DISQUS_SHORTNAME']
+ end
+
+ # Name of company running this site (for press items related to dataset updates)
+ def self.company_name
+ return @@COMPANY_NAME if defined?(@@COMPANY_NAME)
+ @@COMPANY_NAME = ENV['COMPANY_NAME']
end
# Email address to use for site notifications
- def self.notification_email_to
- return @@NOTIFICATION_EMAIL_TO if defined?(@@NOTIFICATION_EMAIL_TO)
- @@NOTIFICATION_EMAIL_TO = '"Matt Olson" <molson@rubycloud.com>'
+ def self.notification_email
+ return @@NOTIFICATION_EMAIL if defined?(@@NOTIFICATION_EMAIL)
+ admin = Admin.find(:first)
+ admin_email = admin ? admin.email : ''
+ @@NOTIFICATION_EMAIL = "\"#{self.company_name} Open Data Project\" <#{admin_email}>"
end
end
@@ -23,7 +23,7 @@
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
-config.action_mailer.default_url_options = { :host => 'rubycloud-opendata.heroku.com' }
+config.action_mailer.default_url_options = { :host => 'svg-opendata.heroku.com' }
# Enable threaded mode
# config.threadsafe!
@@ -8,3 +8,4 @@ ENV['S3_KEY'] = 'seekrit'
ENV['S3_SECRET'] = 'seekrit'
ENV['S3_BUCKET'] = 'seekrit'
ENV['DISQUS_SHORTNAME'] = 'seekrit'
+ENV['COMPANY_NAME'] = 'My Company'

0 comments on commit 7e8151d

Please sign in to comment.