Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonne Haß <me@mrzyx.de>2013-05-05 15:45:49 +0400
committerJonne Haß <me@mrzyx.de>2013-05-19 20:54:54 +0400
commitac147cc9f438f0d7a374b27a155d8e1fc4952df7 (patch)
treed90e2ce7912634e3d99911a8380333cb48ece78e
parentbf90dfffbda9219d59c020b1babafbec5c2bbfc8 (diff)
Refactor config/ directory
* Get rid of early pathname requirement * Use require_relative where approciate * Drop unused files * Imported new application.rb, environment.rb and environments/* from fresh Rails app * Cleaned up boot.rb * Load config in boot.rb * Deduplicate environments/integration*.rb * Move username blacklist into defaults.yml * Ruby 1.9 Hash syntax everywhere * Reorganize lib/diaspora/markdownify to match conventions * Get rid of full path requires where possible * Add dummy content to production section diaspora.yml.example to prevent warning * Drop sqlite? method * Move postgres? method into ConfigurationMethods * Drop token authentication from User
-rw-r--r--Changelog.md4
-rw-r--r--app/models/person.rb4
-rw-r--r--app/models/share_visibility.rb2
-rw-r--r--app/models/user.rb5
-rw-r--r--config/application.rb112
-rw-r--r--config/boot.rb24
-rw-r--r--config/defaults.yml25
-rw-r--r--config/diaspora.yml.example2
-rw-r--r--config/environment.rb41
-rw-r--r--config/environments/development.rb49
-rw-r--r--config/environments/integration.rb6
l---------[-rw-r--r--]config/environments/integration1.rb40
l---------[-rw-r--r--]config/environments/integration2.rb40
-rw-r--r--config/environments/production.rb72
-rw-r--r--config/environments/staging.rb50
-rw-r--r--config/environments/test.rb38
-rw-r--r--config/initializers/acts_as_taggable_on.rb2
-rw-r--r--config/initializers/backtrace_silencers.rb11
-rw-r--r--config/initializers/carrierwave.rb8
-rw-r--r--config/initializers/check_session_secret.rb2
-rw-r--r--config/initializers/direction_detector.rb5
-rw-r--r--config/initializers/faraday.rb8
-rw-r--r--config/initializers/haml.rb2
-rw-r--r--config/initializers/inflections.rb14
-rw-r--r--config/initializers/json_patch.rb6
-rw-r--r--config/initializers/load_analyitics.rb9
-rw-r--r--config/initializers/load_libraries.rb2
-rw-r--r--config/initializers/mailer_config.rb26
-rw-r--r--config/initializers/markerb.rb4
-rw-r--r--config/initializers/mime_types.rb9
-rw-r--r--config/initializers/omniauth.rb12
-rw-r--r--config/initializers/session_store.rb2
-rw-r--r--config/initializers/setup_mail.rb2
-rw-r--r--config/load_config.rb27
-rw-r--r--config/unicorn.rb3
-rw-r--r--lib/configuration_methods.rb7
-rw-r--r--lib/diaspora/markdownify.rb11
-rw-r--r--lib/diaspora/markdownify/email.rb (renamed from lib/diaspora/markdownify_email.rb)0
-rw-r--r--lib/diaspora/markdownify/html.rb13
-rw-r--r--lib/statistics.rb4
40 files changed, 257 insertions, 446 deletions
diff --git a/Changelog.md b/Changelog.md
index d880cf2af..cf62724cc 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,8 +2,12 @@
## Refactor
+* Refactored config/ directory [#4145](https://github.com/diaspora/diaspora/pull/4145).
+
## Bug fixes
+* Don't use Pathname early to circumvent some rare initialization errors [#3816](https://github.com/diaspora/diaspora/issues/3816)
+
## Features
diff --git a/app/models/person.rb b/app/models/person.rb
index 0e1dbb40c..87de1e532 100644
--- a/app/models/person.rb
+++ b/app/models/person.rb
@@ -126,7 +126,7 @@ class Person < ActiveRecord::Base
def self.search_query_string(query)
query = query.downcase
- like_operator = postgres? ? "ILIKE" : "LIKE"
+ like_operator = AppConfig.postgres? ? "ILIKE" : "LIKE"
where_clause = <<-SQL
profiles.full_name #{like_operator} ? OR
@@ -155,7 +155,7 @@ class Person < ActiveRecord::Base
# @return [Array<String>] postgreSQL and mysql deal with null values in orders differently, it seems.
def self.search_order
@search_order ||= Proc.new {
- order = if postgres?
+ order = if AppConfig.postgres?
"ASC"
else
"DESC"
diff --git a/app/models/share_visibility.rb b/app/models/share_visibility.rb
index 8ca3ee8b6..67f42661a 100644
--- a/app/models/share_visibility.rb
+++ b/app/models/share_visibility.rb
@@ -23,7 +23,7 @@ class ShareVisibility < ActiveRecord::Base
def self.batch_import(contact_ids, share)
return false unless ShareVisibility.new(:shareable_id => share.id, :shareable_type => share.class.to_s).valid?
- if postgres?
+ if AppConfig.postgres?
contact_ids.each do |contact_id|
ShareVisibility.find_or_create_by_contact_id_and_shareable_id_and_shareable_type(contact_id, share.id, share.class.base_class.to_s)
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 0ddfba2f0..faca1f6af 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -15,8 +15,7 @@ class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
- :token_authenticatable, :lockable, :lock_strategy => :none,
- :unlock_strategy => :none
+ :lockable, :lock_strategy => :none, :unlock_strategy => :none
before_validation :strip_and_downcase_username
before_validation :set_current_language, :on => :create
@@ -24,7 +23,7 @@ class User < ActiveRecord::Base
validates :username, :presence => true, :uniqueness => true
validates_format_of :username, :with => /\A[A-Za-z0-9_]+\z/
validates_length_of :username, :maximum => 32
- validates_exclusion_of :username, :in => USERNAME_BLACKLIST
+ validates_exclusion_of :username, :in => AppConfig.settings.username_blacklist
validates_inclusion_of :language, :in => AVAILABLE_LANGUAGE_CODES
validates_format_of :unconfirmed_email, :with => Devise.email_regexp, :allow_blank => true
diff --git a/config/application.rb b/config/application.rb
index 2f14c8c41..6fb1650b0 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,23 +1,7 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-require 'pathname'
-require Pathname.new(__FILE__).expand_path.dirname.join('boot')
-
-require 'yaml'
+require_relative 'boot'
require 'rails/all'
-
-# Sanitize groups to make matching :assets easier
-RAILS_GROUPS = Rails.groups(:assets => %w(development test)).map { |group| group.to_sym }
-
-if defined?(Bundler)
- # If you precompile assets before deploying to production, use this line
- Bundler.require(*RAILS_GROUPS)
- # If you want your assets lazily compiled in production, use this line
- # Bundler.require(:default, :assets, Rails.env)
-end
+Bundler.require(*Rails.groups(:assets => %w(development test))) if defined?(Bundler)
module Diaspora
class Application < Rails::Application
@@ -25,15 +9,15 @@ module Diaspora
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
- # Add additional load paths for your own custom dirs
- config.autoload_paths += %W{#{config.root}/app/presenters #{config.root}/app}
- config.autoload_once_paths += %W{#{config.root}/lib}
+ # Custom directories with classes and modules you want to be autoloadable.
+ config.autoload_paths += %W{#{config.root}/app}
+ config.autoload_once_paths += %W{#{config.root}/lib}
# Only load the plugins named here, in the order given (default is alphabetical).
- # :all can be used as a placeholder for all plugins not explicitly named
+ # :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
- # Activate observers that should always be running
+ # Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
@@ -44,47 +28,71 @@ module Diaspora
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
- # Configure generators values. Many other options are available, be sure to check the documentation.
- config.generators do |g|
- g.template_engine :haml
- g.test_framework :rspec
- end
-
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
- config.filter_parameters += [:password]
- config.filter_parameters += [:xml]
- config.filter_parameters += [:message]
- config.filter_parameters += [:text]
- config.filter_parameters += [:bio]
+ config.filter_parameters += [:password, :xml,:message, :text, :bio]
+
+ # Enable escaping HTML in JSON.
+ config.active_support.escape_html_entities_in_json = true
+
+ # Use SQL instead of Active Record's schema dumper when creating the database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Enforce whitelist mode for mass assignment.
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
+ # parameters by using an attr_accessible or attr_protected declaration.
+ #config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true
- config.assets.initialize_on_precompile = false
-
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
- # Javascripts
- config.assets.precompile += [ "aspect-contacts.js", "contact-list.js", "finder.js",
- "home.js", "ie.js", "inbox.js", "jquery.js", "jquery_ujs.js", "jquery.textchange.js",
- "login.js", "mailchimp.js", "main.js", "mobile.js", "profile.js", "people.js", "photos.js",
- "profile.js", "publisher.js", "templates.js", "validation.js" ]
-
- # Stylesheets
- config.assets.precompile += [ "blueprint.css", "bootstrap.css", "bootstrap-complete.css",
- "bootstrap-responsive.css", "default.css", "error_pages.css", "login.css", "mobile.css",
- "new-templates.css", "rtl.css" ]
-
- # Rails Admin - these assets need to be added here since the Engine initializer
- # doesn't run with initialize_on_precompile disabled. This list is taken
- # directly from the Rails Admin Engine initializer.
- config.assets.precompile += ['rails_admin/rails_admin.js', 'rails_admin/rails_admin.css',
- 'rails_admin/jquery.colorpicker.js', 'rails_admin/jquery.colorpicker.css']
+ config.assets.precompile += %w{
+ aspect-contacts.js
+ contact-list.js
+ finder.js
+ home.js
+ ie.js
+ inbox.js
+ jquery.js
+ jquery_ujs.js
+ jquery.textchange.js
+ login.js
+ mailchimp.js
+ main.js
+ mobile.js
+ profile.js
+ people.js
+ photos.js
+ profile.js
+ publisher.js
+ templates.js
+ validation.js
+
+ blueprint.css
+ bootstrap.css
+ bootstrap-complete.css
+ bootstrap-responsive.css
+ default.css
+ error_pages.css
+ login.css
+ mobile.css
+ new-templates.css
+ rtl.css
+ }
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
+ # Configure generators values. Many other options are available, be sure to check the documentation.
+ config.generators do |g|
+ g.template_engine :haml
+ g.test_framework :rspec
+ end
end
end
diff --git a/config/boot.rb b/config/boot.rb
index 5caea9de0..0eee595af 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,17 +1,11 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-require 'pathname'
+require 'rubygems'
# Set up gems listed in the Gemfile.
-gemfile = Pathname.new(__FILE__).dirname.join('..').expand_path.join('Gemfile')
-begin
- ENV['BUNDLE_GEMFILE'] = gemfile.to_s
- require 'bundler'
- Bundler.setup
-rescue Bundler::GemNotFound => e
- STDERR.puts e.message
- STDERR.puts "Try running `bundle install`."
- exit!
-end if File.exist?(gemfile)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
+
+# Ensure Builder is loaded
+require 'active_support/builder' unless defined?(Builder)
+
+# Load configuration early
+require_relative 'load_config'
diff --git a/config/defaults.yml b/config/defaults.yml
index d4b0ecde9..4c7ec4817 100644
--- a/config/defaults.yml
+++ b/config/defaults.yml
@@ -17,7 +17,7 @@ defaults:
concurrency: 5
retry: 10
backtrace: 15
- log: "log/sidekiq.log"
+ log: 'log/sidekiq.log'
s3:
enable: false
key:
@@ -50,7 +50,7 @@ defaults:
mixpanel_uid:
chartbeat_uid:
settings:
- pod_name: "Diaspora*"
+ pod_name: 'Diaspora*'
enable_registrations: true
follow_diasporahq: true
invitations:
@@ -61,6 +61,21 @@ defaults:
enable: false
suggest_email:
typhoeus_verbose: false
+ username_blacklist:
+ - 'admin'
+ - 'administrator'
+ - 'hostmaster'
+ - 'info'
+ - 'postmaster'
+ - 'root'
+ - 'ssladmin'
+ - 'ssladministrator'
+ - 'sslwebmaster'
+ - 'sysadmin'
+ - 'webmaster'
+ - 'support'
+ - 'contact'
+ - 'example_user1dsioaioedfhgoiesajdigtoearogjaidofgjo'
services:
facebook:
enable: false
@@ -109,7 +124,7 @@ production:
i_am_a_dummy: # Remove if you add an actual override
test:
environment:
- url: "http://localhost:9887/"
+ url: 'http://localhost:9887/'
single_process_mode: true
require_ssl: false
assets:
@@ -127,14 +142,14 @@ test:
enable: true
integration1:
environment:
- url: "http://localhost:45789/"
+ url: 'http://localhost:45789/'
single_process_mode: true
assets:
serve: true
require_ssl: false
integration2:
environment:
- url: "http://localhost:34658/"
+ url: 'http://localhost:34658/'
single_process_mode: true
assets:
serve: true
diff --git a/config/diaspora.yml.example b/config/diaspora.yml.example
index 82beb6143..3449c28b0 100644
--- a/config/diaspora.yml.example
+++ b/config/diaspora.yml.example
@@ -328,6 +328,8 @@ configuration: ## Section
## Here you can make overides to settings defined above if you need
## to have them different in different environments.
production: ## Section
+ environment: ## Section
+ #redis_url: 'redis://production.example.org:6379'
development: ## Section
environment: ## Section
diff --git a/config/environment.rb b/config/environment.rb
index 4731a494a..c9482d0ee 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,44 +1,5 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-# check what database you have
-def postgres?
- @using_postgres ||= defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
-end
-
-def sqlite?
- @using_sqlite ||= defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) && ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter
-end
-
# Load the rails application
-require Pathname.new(__FILE__).dirname.expand_path.join('application')
-
-# Load configuration system early
-require Rails.root.join('config', 'load_config')
-
-Haml::Template.options[:format] = :html5
-Haml::Template.options[:escape_html] = true
-
-# Blacklist of usernames
-USERNAME_BLACKLIST = ['admin', 'administrator', 'hostmaster', 'info', 'postmaster', 'root', 'ssladmin',
- 'ssladministrator', 'sslwebmaster', 'sysadmin', 'webmaster', 'support', 'contact', 'example_user1dsioaioedfhgoiesajdigtoearogjaidofgjo']
+require_relative 'application'
# Initialize the rails application
Diaspora::Application.initialize!
-
-# allow token auth only for posting activitystream photos
-module Devise
- module Strategies
- class TokenAuthenticatable < Authenticatable
- private
- def valid_params_request?
- params[:controller] == "activity_streams/photos" && params[:action] == "create"
- end
- end
- end
-end
-
-
-# Ensure Builder is loaded
-require 'active_support/builder' unless defined?(Builder)
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 58735ae07..8c22c98c9 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,12 +1,9 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
Diaspora::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
+ # Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
- # every request. This slows down response time but is perfect for development
- # since you don't have to restart the webserver when you make code changes.
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
@@ -16,41 +13,25 @@ Diaspora::Application.configure do
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
- # Do not compress assets
- config.assets.compress = false
-
- # Expands the lines which load the assets
- config.assets.debug = false
-
- # Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
- config.assets.allow_debugging = true
-
-
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
- config.active_support.deprecation = [:stderr, :log]
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
- # Raise exception on mass assignment protection for Active Record models
- # config.active_record.mass_assignment_sanitizer = :strict
+ # Raise exception on mass assignment protection for Active Record models
+ #config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
- #config.threadsafe!
-
- # Monkeypatch around the nasty "2.5MB exception page" issue, caused by very large environment vars
- # This snippet via: http://stackoverflow.com/questions/3114993/exception-pages-in-development-mode-take-upwards-of-15-30-seconds-to-render-why
- # Relevant Rails ticket: https://rails.lighthouseapp.com/projects/8994/tickets/5027-_request_and_responseerb-and-diagnosticserb-take-an-increasingly-long-time-to-render-in-development-with-multiple-show-tables-calls
- config.after_initialize do
- module SmallInspect
- def inspect
- "<#{self.class.name} - tooooo long>"
- end
- end
- [ActionController::Base, OmniAuth::Strategy, Warden::Proxy].each do |klazz|
- klazz.send(:include, SmallInspect)
- end
- end
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
end
diff --git a/config/environments/integration.rb b/config/environments/integration.rb
new file mode 100644
index 000000000..0a1b06f80
--- /dev/null
+++ b/config/environments/integration.rb
@@ -0,0 +1,6 @@
+require Rails.root.join('config', 'environment', 'development')
+
+Diaspora::Application.configure do
+ # Enable threaded mode
+ config.threadsafe!
+end
diff --git a/config/environments/integration1.rb b/config/environments/integration1.rb
index 974d6b472..cddadc746 100644..120000
--- a/config/environments/integration1.rb
+++ b/config/environments/integration1.rb
@@ -1,39 +1 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-Diaspora::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
-
- # In the development environment your application's code is reloaded on
- # every request. This slows down response time but is perfect for development
- # since you don't have to restart the webserver when you make code changes.
- config.cache_classes = false
-
- # Log error messages when you accidentally call methods on nil.
- config.whiny_nils = true
-
- # Show full error reports and disable caching
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
-
- # Don't care if the mailer can't send
- config.action_mailer.raise_delivery_errors = false
- config.active_support.deprecation = :log
-
- config.threadsafe!
-
- # Monkeypatch around the nasty "2.5MB exception page" issue, caused by very large environment vars
- # This snippet via: http://stackoverflow.com/questions/3114993/exception-pages-in-development-mode-take-upwards-of-15-30-seconds-to-render-why
- # Relevant Rails ticket: https://rails.lighthouseapp.com/projects/8994/tickets/5027-_request_and_responseerb-and-diagnosticserb-take-an-increasingly-long-time-to-render-in-development-with-multiple-show-tables-calls
- config.after_initialize do
- module SmallInspect
- def inspect
- "<#{self.class.name} - tooooo long>"
- end
- end
- [ActionController::Base, OmniAuth::Strategy, Warden::Proxy].each do |klazz|
- klazz.send(:include, SmallInspect)
- end
- end
-end
+integration.rb \ No newline at end of file
diff --git a/config/environments/integration2.rb b/config/environments/integration2.rb
index 184a05302..cddadc746 100644..120000
--- a/config/environments/integration2.rb
+++ b/config/environments/integration2.rb
@@ -1,39 +1 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-Diaspora::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
-
- # In the development environment your application's code is reloaded on
- # every request. This slows down response time but is perfect for development
- # since you don't have to restart the webserver when you make code changes.
- config.cache_classes = true
-
- # Log error messages when you accidentally call methods on nil.
- config.whiny_nils = true
-
- # Show full error reports and disable caching
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
-
- # Don't care if the mailer can't send
- config.action_mailer.raise_delivery_errors = false
- config.active_support.deprecation = :log
-
- #config.threadsafe!
-
- # Monkeypatch around the nasty "2.5MB exception page" issue, caused by very large environment vars
- # This snippet via: http://stackoverflow.com/questions/3114993/exception-pages-in-development-mode-take-upwards-of-15-30-seconds-to-render-why
- # Relevant Rails ticket: https://rails.lighthouseapp.com/projects/8994/tickets/5027-_request_and_responseerb-and-diagnosticserb-take-an-increasingly-long-time-to-render-in-development-with-multiple-show-tables-calls
- config.after_initialize do
- module SmallInspect
- def inspect
- "<#{self.class.name} - tooooo long>"
- end
- end
- [ActionController::Base, OmniAuth::Strategy, Warden::Proxy].each do |klazz|
- klazz.send(:include, SmallInspect)
- end
- end
-end
+integration.rb \ No newline at end of file
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 052bded5d..8d3a7d0f6 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,11 +1,6 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
Diaspora::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
+ # Settings specified here will take precedence over those in config/application.rb
- # The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
@@ -13,48 +8,67 @@ Diaspora::Application.configure do
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Specifies the header that your server uses for sending files
- #config.action_dispatch.x_sendfile_header = "X-Sendfile"
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
- config.active_support.deprecation = :notify
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
- # For nginx:
- config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+ # Don't fallback to assets pipeline if a precompiled asset is missed
+ config.assets.compile = false
- # If you have no front-end server that supports something like X-Sendfile,
- # just comment this out and Rails will serve the files
+ # Generate digests for assets URLs
+ config.assets.digest = true
+
+ # Defaults to nil and saved in location specified by config.assets.prefix
+ # config.assets.manifest = YOUR_PATH
+
+ # Specifies the header that your server uses for sending files
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
+ # Prepend all log lines with the following tags
+ # config.log_tags = [ :subdomain, :uuid ]
+
# Use a different logger for distributed setups
- # config.logger = SyslogLogger.new
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
- # Disable Rails's static asset server
- # In production, Apache or nginx will already do this
- config.serve_static_assets = false
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ # config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
- # Compress JavaScript and CSS
- config.assets.compress = true
+ # Enable threaded mode
+ config.threadsafe!
- # Don't fallback to assets pipeline
- config.assets.compile = false
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
- # Generate digests for assets URLs
- config.assets.digest = true
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+
+ # Log the query plan for queries taking more than this (works
+ # with SQLite, MySQL, and PostgreSQL)
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
- if defined?(AppConfig) && AppConfig.environment.assets.host.present?
+ # For nginx:
+ config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+
+ if AppConfig.environment.assets.host.present?
config.action_controller.asset_host = AppConfig.environment.assets.host.get
end
-
- config.threadsafe!
end
-
-GC.enable_stats if GC.respond_to?(:enable_stats)
-GC::Profiler.enable if defined?(GC::Profiler) && GC::Profiler.respond_to?(:enable)
diff --git a/config/environments/staging.rb b/config/environments/staging.rb
deleted file mode 100644
index e49d26a40..000000000
--- a/config/environments/staging.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-Diaspora::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
-
- # The production environment is meant for finished, "live" apps.
- # Code is not reloaded between requests
- config.cache_classes = true
-
- # Full error reports are disabled and caching is turned on
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = true
-
- # Specifies the header that your server uses for sending files
- #config.action_dispatch.x_sendfile_header = "X-Sendfile"
-
- config.active_support.deprecation = :notify
-
- # For nginx:
- config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
-
- # If you have no front-end server that supports something like X-Sendfile,
- # just comment this out and Rails will serve the files
-
- # See everything in the log (default is :info)
- # config.log_level = :debug
-
- # Use a different logger for distributed setups
- # config.logger = SyslogLogger.new
-
- # Use a different cache store in production
- # config.cache_store = :mem_cache_store
-
- # Disable Rails's static asset server
- # In production, Apache or nginx will already do this
- config.serve_static_assets = false
-
- # Enable serving of images, stylesheets, and javascripts from an asset server
- # config.action_controller.asset_host = "http://assets.example.com"
-
- # Disable delivery errors, bad email addresses will be ignored
- # config.action_mailer.raise_delivery_errors = false
-
- config.threadsafe!
-end
-
-# Sacrifice readability for a 10% performance boost
-Haml::Template::options[:ugly] = true
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 612b0b6f5..074be4cca 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,17 +1,17 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
Diaspora::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
+ # Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
- # test suite. You never need to work with it otherwise. Remember that
+ # test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
- # and recreated between test runs. Don't rely on the data there!
+ # and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
- # Log error messages when you accidentally call methods on nil.
+ # Configure static asset server for tests with Cache-Control for performance
+ config.serve_static_assets = true
+ config.static_cache_control = "public, max-age=3600"
+
+ # Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
@@ -28,24 +28,10 @@ Diaspora::Application.configure do
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
- config.active_support.deprecation = :stderr
- # config.active_record.mass_assignment_sanitizer = :strict
+ # Raise exception on mass assignment protection for Active Record models
+ #config.active_record.mass_assignment_sanitizer = :strict
-
- # Configure static asset server for tests with Cache-Control for performance
- config.serve_static_assets = true
- config.static_cache_control = "public, max-age=3600"
-
- config.assets.enabled = true
- config.assets.debug = false
-
-
- # fixes url helper issue in rspec
- #config.threadsafe!
-
- # Use SQL instead of Active Record's schema dumper when creating the test database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
end
diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb
index d42a381b1..bfc309bf2 100644
--- a/config/initializers/acts_as_taggable_on.rb
+++ b/config/initializers/acts_as_taggable_on.rb
@@ -1,2 +1,2 @@
+require 'models/acts_as_taggable_on/tag'
ActsAsTaggableOn.force_lowercase = true
-require Rails.root.join("app", "models", "acts_as_taggable_on", "tag")
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
deleted file mode 100644
index 95f10f04a..000000000
--- a/config/initializers/backtrace_silencers.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-# Be sure to restart your server when you modify this file.
-
-# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
-# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
-
-# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
-# Rails.backtrace_cleaner.remove_silencers!
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb
index b86e52528..0321d5242 100644
--- a/config/initializers/carrierwave.rb
+++ b/config/initializers/carrierwave.rb
@@ -9,10 +9,10 @@ CarrierWave.configure do |config|
config.storage = :fog
config.cache_dir = Rails.root.join('tmp', 'uploads').to_s
config.fog_credentials = {
- :provider => 'AWS',
- :aws_access_key_id => AppConfig.environment.s3.key.get,
- :aws_secret_access_key => AppConfig.environment.s3.secret.get,
- :region => AppConfig.environment.s3.region.get
+ provider: 'AWS',
+ aws_access_key_id: AppConfig.environment.s3.key.get,
+ aws_secret_access_key: AppConfig.environment.s3.secret.get,
+ region: AppConfig.environment.s3.region.get
}
if AppConfig.environment.s3.cache?
config.fog_attributes['Cache-Control'] = 'max-age=31536000'
diff --git a/config/initializers/check_session_secret.rb b/config/initializers/check_session_secret.rb
index 563143dcf..941915356 100644
--- a/config/initializers/check_session_secret.rb
+++ b/config/initializers/check_session_secret.rb
@@ -1,6 +1,6 @@
if AppConfig.heroku?
Rails.application.config.secret_token = AppConfig.secret_token
-elsif !File.exists?( Rails.root.join('config', 'initializers', 'secret_token.rb'))
+elsif !Rails.root.join('config', 'initializers', 'secret_token.rb').exist?
`bundle exec rake generate:secret_token`
require Rails.root.join('config', 'initializers', 'secret_token.rb')
end
diff --git a/config/initializers/direction_detector.rb b/config/initializers/direction_detector.rb
deleted file mode 100644
index 2f509889b..000000000
--- a/config/initializers/direction_detector.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-require Rails.root.join('lib', 'direction_detector')
diff --git a/config/initializers/faraday.rb b/config/initializers/faraday.rb
index 30b827fcb..274a998b5 100644
--- a/config/initializers/faraday.rb
+++ b/config/initializers/faraday.rb
@@ -1,9 +1,13 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
-options = {:timeout => 25}
+options = {
+ timeout: 25,
+ ssl: {
+ ca_file: AppConfig.environment.certificate_authorities.get
+ }
+}
-options[:ssl] = {:ca_file => AppConfig.environment.certificate_authorities}
Faraday.default_connection = Faraday::Connection.new(options) do |b|
b.use FaradayMiddleware::FollowRedirects
b.adapter Faraday.default_adapter
diff --git a/config/initializers/haml.rb b/config/initializers/haml.rb
new file mode 100644
index 000000000..83225bbd4
--- /dev/null
+++ b/config/initializers/haml.rb
@@ -0,0 +1,2 @@
+Haml::Template.options[:format] = :html5
+Haml::Template.options[:escape_html] = true
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
deleted file mode 100644
index ad74fec2a..000000000
--- a/config/initializers/inflections.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-# Be sure to restart your server when you modify this file.
-
-# Add new inflection rules using the following format
-# (all these examples are active by default):
- ActiveSupport::Inflector.inflections do |inflect|
-# inflect.plural /^(ox)$/i, '\1en'
-# inflect.singular /^(ox)en/i, '\1'
-# inflect.irregular 'person', 'people'
-# inflect.uncountable %w( fish sheep )
- end
diff --git a/config/initializers/json_patch.rb b/config/initializers/json_patch.rb
deleted file mode 100644
index 13e5756d8..000000000
--- a/config/initializers/json_patch.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class Fixnum
- def to_json(options = nil)
- to_s
- end
-end
-
diff --git a/config/initializers/load_analyitics.rb b/config/initializers/load_analyitics.rb
index f8731f9d3..5663b0901 100644
--- a/config/initializers/load_analyitics.rb
+++ b/config/initializers/load_analyitics.rb
@@ -6,15 +6,14 @@
if Rails.env == 'production'
Diaspora::Application.configure do
if AppConfig.privacy.google_analytics_key.present?
- config.gem 'rack-google-analytics', :lib => 'rack/google-analytics'
- config.middleware.use Rack::GoogleAnalytics, :tracker => AppConfig.privacy.google_analytics_key.get
+ require 'rack/google-analytics'
+ config.middleware.use Rack::GoogleAnalytics, tracker: AppConfig.privacy.google_analytics_key.get
end
if AppConfig.privacy.piwik.enable?
require 'rack/piwik'
- config.gem 'rack-piwik', :lib => 'rack/piwik'
- config.middleware.use Rack::Piwik, :piwik_url => AppConfig.privacy.piwik.host.get,
- :piwik_id => AppConfig.privacy.piwik.site_id.get
+ config.middleware.use Rack::Piwik, piwik_url: AppConfig.privacy.piwik.host.get,
+ piwik_id: AppConfig.privacy.piwik.site_id.get
end
end
end
diff --git a/config/initializers/load_libraries.rb b/config/initializers/load_libraries.rb
index 4aaa7d6d5..e66da1d87 100644
--- a/config/initializers/load_libraries.rb
+++ b/config/initializers/load_libraries.rb
@@ -19,6 +19,7 @@ require 'markdownify_helper'
# Our libs
require 'collect_user_photos'
require 'diaspora'
+require 'direction_detector'
require 'email_inviter'
require 'evil_query'
require 'federation_logger'
@@ -33,4 +34,3 @@ require 'stream'
require 'template_picker'
require 'webfinger'
require 'webfinger_profile'
-
diff --git a/config/initializers/mailer_config.rb b/config/initializers/mailer_config.rb
index 6cd89dd87..c667fe372 100644
--- a/config/initializers/mailer_config.rb
+++ b/config/initializers/mailer_config.rb
@@ -4,8 +4,10 @@
require Rails.root.join('lib', 'messagebus', 'mailer')
Diaspora::Application.configure do
- config.action_mailer.default_url_options = {:protocol => AppConfig.pod_uri.scheme,
- :host => AppConfig.pod_uri.authority }
+ config.action_mailer.default_url_options = {
+ protocol: AppConfig.pod_uri.scheme,
+ host: AppConfig.pod_uri.authority
+ }
config.action_mailer.asset_host = AppConfig.pod_uri.to_s
config.action_mailer.perform_deliveries = AppConfig.mail.enable?
@@ -21,26 +23,26 @@ Diaspora::Application.configure do
elsif AppConfig.mail.method == "sendmail"
config.action_mailer.delivery_method = :sendmail
sendmail_settings = {
- :location => AppConfig.mail.sendmail.location.get
+ location: AppConfig.mail.sendmail.location.get
}
sendmail_settings[:arguments] = "-i" if AppConfig.mail.sendmail.exim_fix?
config.action_mailer.sendmail_settings = sendmail_settings
elsif AppConfig.mail.method == "smtp"
config.action_mailer.delivery_method = :smtp
smtp_settings = {
- :address => AppConfig.mail.smtp.host.get,
- :port => AppConfig.mail.smtp.port.to_i,
- :domain => AppConfig.mail.smtp.domain.get,
- :enable_starttls_auto => false,
- :openssl_verify_mode => AppConfig.mail.smtp.openssl_verify_mode.get
+ address: AppConfig.mail.smtp.host.get,
+ port: AppConfig.mail.smtp.port.to_i,
+ domain: AppConfig.mail.smtp.domain.get,
+ enable_starttls_auto: false,
+ openssl_verify_mode: AppConfig.mail.smtp.openssl_verify_mode.get
}
if AppConfig.mail.smtp.authentication != "none"
smtp_settings.merge!({
- :authentication => AppConfig.mail.smtp.authentication.gsub('-', '_').to_sym,
- :user_name => AppConfig.mail.smtp.username.get,
- :password => AppConfig.mail.smtp.password.get,
- :enable_starttls_auto => AppConfig.mail.smtp.starttls_auto?
+ authentication: AppConfig.mail.smtp.authentication.gsub('-', '_').to_sym,
+ user_name: AppConfig.mail.smtp.username.get,
+ password: AppConfig.mail.smtp.password.get,
+ enable_starttls_auto: AppConfig.mail.smtp.starttls_auto?
})
end
diff --git a/config/initializers/markerb.rb b/config/initializers/markerb.rb
index 3d7351b6b..a7cccced2 100644
--- a/config/initializers/markerb.rb
+++ b/config/initializers/markerb.rb
@@ -1,3 +1 @@
-require Rails.root.join("lib", "diaspora", "markdownify_email")
-
-Rails.application.config.markerb.renderer = Diaspora::Markdownify::Email \ No newline at end of file
+Rails.application.config.markerb.renderer = Diaspora::Markdownify::Email
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
deleted file mode 100644
index 340afa7d7..000000000
--- a/config/initializers/mime_types.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-# Be sure to restart your server when you modify this file.
-
-# Add new mime types for use in respond_to blocks:
-# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb
index e96b8c9ed..67ec29747 100644
--- a/config/initializers/omniauth.rb
+++ b/config/initializers/omniauth.rb
@@ -16,8 +16,14 @@ Rails.application.config.middleware.use OmniAuth::Builder do
end
if AppConfig.services.facebook.enable?
- provider :facebook, AppConfig.services.facebook.app_id, AppConfig.services.facebook.secret,
- { :display => "popup", :scope => "publish_actions,publish_stream,offline_access",
- :client_options => {:ssl => {:ca_file => AppConfig.environment.certificate_authorities }}}
+ provider :facebook, AppConfig.services.facebook.app_id, AppConfig.services.facebook.secret, {
+ display: 'popup',
+ scope: 'publish_actions,publish_stream,offline_access',
+ client_options: {
+ ssl: {
+ ca_file: AppConfig.environment.certificate_authorities
+ }
+ }
+ }
end
end
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 30017169b..e46823d17 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -4,7 +4,7 @@
# Be sure to restart your server when you modify this file.
-Rails.application.config.session_store :cookie_store, :key => '_diaspora_session', :httponly => false
+Rails.application.config.session_store :cookie_store, key: '_diaspora_session', httponly: false
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
diff --git a/config/initializers/setup_mail.rb b/config/initializers/setup_mail.rb
deleted file mode 100644
index 0d3f958a7..000000000
--- a/config/initializers/setup_mail.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# if you wish to intercept emails to go to a particuar email address
-#ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
diff --git a/config/load_config.rb b/config/load_config.rb
index f7f060ccb..faef94b60 100644
--- a/config/load_config.rb
+++ b/config/load_config.rb
@@ -1,41 +1,36 @@
require 'configurate'
-rails_root = Pathname.new(__FILE__).dirname.join('..').expand_path
+rails_root = File.expand_path('../../', __FILE__)
rails_env = ENV['RACK_ENV']
rails_env ||= ENV['RAILS_ENV']
rails_env ||= 'development'
-require rails_root.join('lib', 'configuration_methods')
+require File.join(rails_root, 'lib', 'configuration_methods')
-config_dir = rails_root.join("config")
-
-if File.exists?(config_dir.join("application.yml"))
- $stderr.puts "ATTENTION: There's a new configuration system, please remove your"
- $stderr.puts " application.yml and migrate your settings."
-end
+config_dir = File.join rails_root, 'config'
AppConfig ||= Configurate::Settings.create do
add_provider Configurate::Provider::Dynamic
add_provider Configurate::Provider::Env
- unless heroku? || rails_env == "test" || File.exists?(config_dir.join("diaspora.yml"))
+ unless heroku? || rails_env == "test" || File.exists?(File.join(config_dir, 'diaspora.yml'))
$stderr.puts "FATAL: Configuration not found. Copy over diaspora.yml.example"
$stderr.puts " to diaspora.yml and edit it to your needs."
- Process.exit(1)
+ exit!
end
add_provider Configurate::Provider::YAML,
- config_dir.join("diaspora.yml"),
- namespace: rails_env, required: false
+ File.join(config_dir, 'diaspora.yml'),
+ namespace: rails_env, required: false unless rails_env == 'test'
add_provider Configurate::Provider::YAML,
- config_dir.join("diaspora.yml"),
+ File.join(config_dir, 'diaspora.yml'),
namespace: "configuration", required: false
add_provider Configurate::Provider::YAML,
- config_dir.join("defaults.yml"),
+ File.join(config_dir, 'defaults.yml'),
namespace: rails_env
add_provider Configurate::Provider::YAML,
- config_dir.join("defaults.yml"),
+ File.join(config_dir, 'defaults.yml'),
namespace: "defaults"
extend Configuration::Methods
@@ -45,6 +40,6 @@ AppConfig ||= Configurate::Settings.create do
environment.certificate_authorities.empty? ||
!File.file?(environment.certificate_authorities.get))
$stderr.puts "FATAL: Diaspora doesn't know where your certificate authorities are. Please ensure they are set to a valid path in diaspora.yml"
- Process.exit(1)
+ exit!
end
end
diff --git a/config/unicorn.rb b/config/unicorn.rb
index 0257093e2..2e5528978 100644
--- a/config/unicorn.rb
+++ b/config/unicorn.rb
@@ -1,5 +1,4 @@
-require 'pathname'
-require Pathname.new(__FILE__).expand_path.dirname.join('load_config')
+require File.expand_path('../load_config', __FILE__)
# Enable and set these to run the worker as a different user/group
#user = 'diaspora'
diff --git a/lib/configuration_methods.rb b/lib/configuration_methods.rb
index d41ee81e5..4b08dfec0 100644
--- a/lib/configuration_methods.rb
+++ b/lib/configuration_methods.rb
@@ -104,13 +104,18 @@ module Configuration
path.to_s
end
+ def postgres?
+ defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) &&
+ ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
+ end
+
private
def get_git_info
return if git_info_present? || !git_available?
git_cmd = `git log -1 --pretty="format:%H %ci"`
- if git_cmd =~ /^([\d\w]+?)\s(.+)$/
+ if git_cmd =~ /^(\w+?)\s(.+)$/
@git_revision = $1
@git_update = $2.strip
end
diff --git a/lib/diaspora/markdownify.rb b/lib/diaspora/markdownify.rb
index c31ddbc0c..4a2d06686 100644
--- a/lib/diaspora/markdownify.rb
+++ b/lib/diaspora/markdownify.rb
@@ -1,13 +1,6 @@
module Diaspora
module Markdownify
- class HTML < Redcarpet::Render::HTML
- include ActionView::Helpers::TextHelper
- include ActionView::Helpers::TagHelper
-
- def autolink(link, type)
- auto_link(link, :link => :urls, :html => { :target => "_blank" })
- end
-
- end
+ require 'diaspora/markdownify/html'
+ require 'diaspora/markdownify/email'
end
end
diff --git a/lib/diaspora/markdownify_email.rb b/lib/diaspora/markdownify/email.rb
index 1e3263127..1e3263127 100644
--- a/lib/diaspora/markdownify_email.rb
+++ b/lib/diaspora/markdownify/email.rb
diff --git a/lib/diaspora/markdownify/html.rb b/lib/diaspora/markdownify/html.rb
new file mode 100644
index 000000000..c31ddbc0c
--- /dev/null
+++ b/lib/diaspora/markdownify/html.rb
@@ -0,0 +1,13 @@
+module Diaspora
+ module Markdownify
+ class HTML < Redcarpet::Render::HTML
+ include ActionView::Helpers::TextHelper
+ include ActionView::Helpers::TagHelper
+
+ def autolink(link, type)
+ auto_link(link, :link => :urls, :html => { :target => "_blank" })
+ end
+
+ end
+ end
+end
diff --git a/lib/statistics.rb b/lib/statistics.rb
index 1fefbb166..bc62695e9 100644
--- a/lib/statistics.rb
+++ b/lib/statistics.rb
@@ -176,10 +176,8 @@ SQL
protected
def where_clause_sql
- if postgres?
+ if AppConfig.postgres?
"WHERE users.created_at > NOW() - '1 month'::INTERVAL"
- elsif sqlite?
- raise "#where_clause_sql not yet written for SQLite"
else
"where users.created_at > FROM_UNIXTIME(#{(Time.now - 1.month).to_i})"
end