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
This commit is contained in:
parent
bf90dfffbd
commit
ac147cc9f4
40 changed files with 267 additions and 456 deletions
|
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
|
|
||||||
|
* Refactored config/ directory [#4145](https://github.com/diaspora/diaspora/pull/4145).
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
|
* Don't use Pathname early to circumvent some rare initialization errors [#3816](https://github.com/diaspora/diaspora/issues/3816)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ class Person < ActiveRecord::Base
|
||||||
|
|
||||||
def self.search_query_string(query)
|
def self.search_query_string(query)
|
||||||
query = query.downcase
|
query = query.downcase
|
||||||
like_operator = postgres? ? "ILIKE" : "LIKE"
|
like_operator = AppConfig.postgres? ? "ILIKE" : "LIKE"
|
||||||
|
|
||||||
where_clause = <<-SQL
|
where_clause = <<-SQL
|
||||||
profiles.full_name #{like_operator} ? OR
|
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.
|
# @return [Array<String>] postgreSQL and mysql deal with null values in orders differently, it seems.
|
||||||
def self.search_order
|
def self.search_order
|
||||||
@search_order ||= Proc.new {
|
@search_order ||= Proc.new {
|
||||||
order = if postgres?
|
order = if AppConfig.postgres?
|
||||||
"ASC"
|
"ASC"
|
||||||
else
|
else
|
||||||
"DESC"
|
"DESC"
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class ShareVisibility < ActiveRecord::Base
|
||||||
def self.batch_import(contact_ids, share)
|
def self.batch_import(contact_ids, share)
|
||||||
return false unless ShareVisibility.new(:shareable_id => share.id, :shareable_type => share.class.to_s).valid?
|
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|
|
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)
|
ShareVisibility.find_or_create_by_contact_id_and_shareable_id_and_shareable_type(contact_id, share.id, share.class.base_class.to_s)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
devise :database_authenticatable, :registerable,
|
devise :database_authenticatable, :registerable,
|
||||||
:recoverable, :rememberable, :trackable, :validatable,
|
:recoverable, :rememberable, :trackable, :validatable,
|
||||||
:token_authenticatable, :lockable, :lock_strategy => :none,
|
:lockable, :lock_strategy => :none, :unlock_strategy => :none
|
||||||
:unlock_strategy => :none
|
|
||||||
|
|
||||||
before_validation :strip_and_downcase_username
|
before_validation :strip_and_downcase_username
|
||||||
before_validation :set_current_language, :on => :create
|
before_validation :set_current_language, :on => :create
|
||||||
|
|
@ -24,7 +23,7 @@ class User < ActiveRecord::Base
|
||||||
validates :username, :presence => true, :uniqueness => true
|
validates :username, :presence => true, :uniqueness => true
|
||||||
validates_format_of :username, :with => /\A[A-Za-z0-9_]+\z/
|
validates_format_of :username, :with => /\A[A-Za-z0-9_]+\z/
|
||||||
validates_length_of :username, :maximum => 32
|
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_inclusion_of :language, :in => AVAILABLE_LANGUAGE_CODES
|
||||||
validates_format_of :unconfirmed_email, :with => Devise.email_regexp, :allow_blank => true
|
validates_format_of :unconfirmed_email, :with => Devise.email_regexp, :allow_blank => true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,7 @@
|
||||||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
require_relative 'boot'
|
||||||
# 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 'rails/all'
|
require 'rails/all'
|
||||||
|
Bundler.require(*Rails.groups(:assets => %w(development test))) if defined?(Bundler)
|
||||||
# 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
|
|
||||||
|
|
||||||
module Diaspora
|
module Diaspora
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
|
|
@ -25,15 +9,15 @@ module Diaspora
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
||||||
# Add additional load paths for your own custom dirs
|
# Custom directories with classes and modules you want to be autoloadable.
|
||||||
config.autoload_paths += %W{#{config.root}/app/presenters #{config.root}/app}
|
config.autoload_paths += %W{#{config.root}/app}
|
||||||
config.autoload_once_paths += %W{#{config.root}/lib}
|
config.autoload_once_paths += %W{#{config.root}/lib}
|
||||||
|
|
||||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
# 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 ]
|
# 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
|
# 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.
|
# 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.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
# config.i18n.default_locale = :de
|
# config.i18n.default_locale = :de
|
||||||
|
|
||||||
|
# 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, :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
|
||||||
|
|
||||||
|
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||||
|
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.
|
# Configure generators values. Many other options are available, be sure to check the documentation.
|
||||||
config.generators do |g|
|
config.generators do |g|
|
||||||
g.template_engine :haml
|
g.template_engine :haml
|
||||||
g.test_framework :rspec
|
g.test_framework :rspec
|
||||||
end
|
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]
|
|
||||||
|
|
||||||
# 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']
|
|
||||||
|
|
||||||
# Version of your assets, change this if you want to expire all your assets
|
|
||||||
config.assets.version = '1.0'
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,11 @@
|
||||||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
require 'rubygems'
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
|
||||||
# the COPYRIGHT file.
|
|
||||||
|
|
||||||
require 'pathname'
|
|
||||||
|
|
||||||
# Set up gems listed in the Gemfile.
|
# Set up gems listed in the Gemfile.
|
||||||
gemfile = Pathname.new(__FILE__).dirname.join('..').expand_path.join('Gemfile')
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
begin
|
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||||
ENV['BUNDLE_GEMFILE'] = gemfile.to_s
|
|
||||||
require 'bundler'
|
# Ensure Builder is loaded
|
||||||
Bundler.setup
|
require 'active_support/builder' unless defined?(Builder)
|
||||||
rescue Bundler::GemNotFound => e
|
|
||||||
STDERR.puts e.message
|
# Load configuration early
|
||||||
STDERR.puts "Try running `bundle install`."
|
require_relative 'load_config'
|
||||||
exit!
|
|
||||||
end if File.exist?(gemfile)
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ defaults:
|
||||||
concurrency: 5
|
concurrency: 5
|
||||||
retry: 10
|
retry: 10
|
||||||
backtrace: 15
|
backtrace: 15
|
||||||
log: "log/sidekiq.log"
|
log: 'log/sidekiq.log'
|
||||||
s3:
|
s3:
|
||||||
enable: false
|
enable: false
|
||||||
key:
|
key:
|
||||||
|
|
@ -50,7 +50,7 @@ defaults:
|
||||||
mixpanel_uid:
|
mixpanel_uid:
|
||||||
chartbeat_uid:
|
chartbeat_uid:
|
||||||
settings:
|
settings:
|
||||||
pod_name: "Diaspora*"
|
pod_name: 'Diaspora*'
|
||||||
enable_registrations: true
|
enable_registrations: true
|
||||||
follow_diasporahq: true
|
follow_diasporahq: true
|
||||||
invitations:
|
invitations:
|
||||||
|
|
@ -61,6 +61,21 @@ defaults:
|
||||||
enable: false
|
enable: false
|
||||||
suggest_email:
|
suggest_email:
|
||||||
typhoeus_verbose: false
|
typhoeus_verbose: false
|
||||||
|
username_blacklist:
|
||||||
|
- 'admin'
|
||||||
|
- 'administrator'
|
||||||
|
- 'hostmaster'
|
||||||
|
- 'info'
|
||||||
|
- 'postmaster'
|
||||||
|
- 'root'
|
||||||
|
- 'ssladmin'
|
||||||
|
- 'ssladministrator'
|
||||||
|
- 'sslwebmaster'
|
||||||
|
- 'sysadmin'
|
||||||
|
- 'webmaster'
|
||||||
|
- 'support'
|
||||||
|
- 'contact'
|
||||||
|
- 'example_user1dsioaioedfhgoiesajdigtoearogjaidofgjo'
|
||||||
services:
|
services:
|
||||||
facebook:
|
facebook:
|
||||||
enable: false
|
enable: false
|
||||||
|
|
@ -109,7 +124,7 @@ production:
|
||||||
i_am_a_dummy: # Remove if you add an actual override
|
i_am_a_dummy: # Remove if you add an actual override
|
||||||
test:
|
test:
|
||||||
environment:
|
environment:
|
||||||
url: "http://localhost:9887/"
|
url: 'http://localhost:9887/'
|
||||||
single_process_mode: true
|
single_process_mode: true
|
||||||
require_ssl: false
|
require_ssl: false
|
||||||
assets:
|
assets:
|
||||||
|
|
@ -127,14 +142,14 @@ test:
|
||||||
enable: true
|
enable: true
|
||||||
integration1:
|
integration1:
|
||||||
environment:
|
environment:
|
||||||
url: "http://localhost:45789/"
|
url: 'http://localhost:45789/'
|
||||||
single_process_mode: true
|
single_process_mode: true
|
||||||
assets:
|
assets:
|
||||||
serve: true
|
serve: true
|
||||||
require_ssl: false
|
require_ssl: false
|
||||||
integration2:
|
integration2:
|
||||||
environment:
|
environment:
|
||||||
url: "http://localhost:34658/"
|
url: 'http://localhost:34658/'
|
||||||
single_process_mode: true
|
single_process_mode: true
|
||||||
assets:
|
assets:
|
||||||
serve: true
|
serve: true
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,8 @@ configuration: ## Section
|
||||||
## Here you can make overides to settings defined above if you need
|
## Here you can make overides to settings defined above if you need
|
||||||
## to have them different in different environments.
|
## to have them different in different environments.
|
||||||
production: ## Section
|
production: ## Section
|
||||||
|
environment: ## Section
|
||||||
|
#redis_url: 'redis://production.example.org:6379'
|
||||||
|
|
||||||
development: ## Section
|
development: ## Section
|
||||||
environment: ## Section
|
environment: ## Section
|
||||||
|
|
|
||||||
|
|
@ -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
|
# Load the rails application
|
||||||
require Pathname.new(__FILE__).dirname.expand_path.join('application')
|
require_relative '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']
|
|
||||||
|
|
||||||
# Initialize the rails application
|
# Initialize the rails application
|
||||||
Diaspora::Application.initialize!
|
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)
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
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
|
# In the development environment your application's code is reloaded on
|
||||||
# every request. This slows down response time but is perfect for development
|
# 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.
|
# since you don't have to restart the web server when you make code changes.
|
||||||
config.cache_classes = false
|
config.cache_classes = false
|
||||||
|
|
||||||
# Log error messages when you accidentally call methods on nil.
|
# 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.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
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
|
# Don't care if the mailer can't send
|
||||||
config.action_mailer.raise_delivery_errors = false
|
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
|
# Raise exception on mass assignment protection for Active Record models
|
||||||
# config.active_record.mass_assignment_sanitizer = :strict
|
#config.active_record.mass_assignment_sanitizer = :strict
|
||||||
|
|
||||||
# Log the query plan for queries taking more than this (works
|
# Log the query plan for queries taking more than this (works
|
||||||
# with SQLite, MySQL, and PostgreSQL)
|
# with SQLite, MySQL, and PostgreSQL)
|
||||||
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
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
|
# Do not compress assets
|
||||||
# This snippet via: http://stackoverflow.com/questions/3114993/exception-pages-in-development-mode-take-upwards-of-15-30-seconds-to-render-why
|
config.assets.compress = false
|
||||||
# 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
|
# Expands the lines which load the assets
|
||||||
module SmallInspect
|
config.assets.debug = true
|
||||||
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
|
end
|
||||||
|
|
|
||||||
6
config/environments/integration.rb
Normal file
6
config/environments/integration.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
require Rails.root.join('config', 'environment', 'development')
|
||||||
|
|
||||||
|
Diaspora::Application.configure do
|
||||||
|
# Enable threaded mode
|
||||||
|
config.threadsafe!
|
||||||
|
end
|
||||||
|
|
@ -1,39 +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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
1
config/environments/integration1.rb
Symbolic link
1
config/environments/integration1.rb
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
integration.rb
|
||||||
|
|
@ -1,39 +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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
1
config/environments/integration2.rb
Symbolic link
1
config/environments/integration2.rb
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
integration.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
|
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
|
# Code is not reloaded between requests
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
|
|
||||||
|
|
@ -13,48 +8,67 @@ Diaspora::Application.configure do
|
||||||
config.consider_all_requests_local = false
|
config.consider_all_requests_local = false
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
# Specifies the header that your server uses for sending files
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||||
#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
|
config.serve_static_assets = false
|
||||||
|
|
||||||
# Disable delivery errors, bad email addresses will be ignored
|
# Compress JavaScripts and CSS
|
||||||
# config.action_mailer.raise_delivery_errors = false
|
|
||||||
|
|
||||||
# Compress JavaScript and CSS
|
|
||||||
config.assets.compress = true
|
config.assets.compress = true
|
||||||
|
|
||||||
# Don't fallback to assets pipeline
|
# Don't fallback to assets pipeline if a precompiled asset is missed
|
||||||
config.assets.compile = false
|
config.assets.compile = false
|
||||||
|
|
||||||
# Generate digests for assets URLs
|
# Generate digests for assets URLs
|
||||||
config.assets.digest = true
|
config.assets.digest = true
|
||||||
|
|
||||||
if defined?(AppConfig) && AppConfig.environment.assets.host.present?
|
# 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 = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||||
|
|
||||||
|
# Use a different cache store in production
|
||||||
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Enable threaded mode
|
||||||
|
config.threadsafe!
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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
|
config.action_controller.asset_host = AppConfig.environment.assets.host.get
|
||||||
end
|
end
|
||||||
|
|
||||||
config.threadsafe!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
GC.enable_stats if GC.respond_to?(:enable_stats)
|
|
||||||
GC::Profiler.enable if defined?(GC::Profiler) && GC::Profiler.respond_to?(:enable)
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -1,9 +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.
|
|
||||||
|
|
||||||
Diaspora::Application.configure do
|
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
|
# 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
|
||||||
|
|
@ -11,7 +7,11 @@ Diaspora::Application.configure do
|
||||||
# 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
|
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
|
config.whiny_nils = true
|
||||||
|
|
||||||
# Show full error reports and disable caching
|
# Show full error reports and disable caching
|
||||||
|
|
@ -28,24 +28,10 @@ Diaspora::Application.configure do
|
||||||
# The :test delivery method accumulates sent emails in the
|
# The :test delivery method accumulates sent emails in the
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
|
# Raise exception on mass assignment protection for Active Record models
|
||||||
|
#config.active_record.mass_assignment_sanitizer = :strict
|
||||||
|
|
||||||
|
# Print deprecation notices to the stderr
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
# 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
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
|
require 'models/acts_as_taggable_on/tag'
|
||||||
ActsAsTaggableOn.force_lowercase = true
|
ActsAsTaggableOn.force_lowercase = true
|
||||||
require Rails.root.join("app", "models", "acts_as_taggable_on", "tag")
|
|
||||||
|
|
|
||||||
|
|
@ -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!
|
|
||||||
|
|
@ -9,10 +9,10 @@ CarrierWave.configure do |config|
|
||||||
config.storage = :fog
|
config.storage = :fog
|
||||||
config.cache_dir = Rails.root.join('tmp', 'uploads').to_s
|
config.cache_dir = Rails.root.join('tmp', 'uploads').to_s
|
||||||
config.fog_credentials = {
|
config.fog_credentials = {
|
||||||
:provider => 'AWS',
|
provider: 'AWS',
|
||||||
:aws_access_key_id => AppConfig.environment.s3.key.get,
|
aws_access_key_id: AppConfig.environment.s3.key.get,
|
||||||
:aws_secret_access_key => AppConfig.environment.s3.secret.get,
|
aws_secret_access_key: AppConfig.environment.s3.secret.get,
|
||||||
:region => AppConfig.environment.s3.region.get
|
region: AppConfig.environment.s3.region.get
|
||||||
}
|
}
|
||||||
if AppConfig.environment.s3.cache?
|
if AppConfig.environment.s3.cache?
|
||||||
config.fog_attributes['Cache-Control'] = 'max-age=31536000'
|
config.fog_attributes['Cache-Control'] = 'max-age=31536000'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
if AppConfig.heroku?
|
if AppConfig.heroku?
|
||||||
Rails.application.config.secret_token = AppConfig.secret_token
|
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`
|
`bundle exec rake generate:secret_token`
|
||||||
require Rails.root.join('config', 'initializers', 'secret_token.rb')
|
require Rails.root.join('config', 'initializers', 'secret_token.rb')
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -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')
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# 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|
|
Faraday.default_connection = Faraday::Connection.new(options) do |b|
|
||||||
b.use FaradayMiddleware::FollowRedirects
|
b.use FaradayMiddleware::FollowRedirects
|
||||||
b.adapter Faraday.default_adapter
|
b.adapter Faraday.default_adapter
|
||||||
|
|
|
||||||
2
config/initializers/haml.rb
Normal file
2
config/initializers/haml.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
Haml::Template.options[:format] = :html5
|
||||||
|
Haml::Template.options[:escape_html] = true
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
class Fixnum
|
|
||||||
def to_json(options = nil)
|
|
||||||
to_s
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
@ -6,15 +6,14 @@
|
||||||
if Rails.env == 'production'
|
if Rails.env == 'production'
|
||||||
Diaspora::Application.configure do
|
Diaspora::Application.configure do
|
||||||
if AppConfig.privacy.google_analytics_key.present?
|
if AppConfig.privacy.google_analytics_key.present?
|
||||||
config.gem 'rack-google-analytics', :lib => 'rack/google-analytics'
|
require 'rack/google-analytics'
|
||||||
config.middleware.use Rack::GoogleAnalytics, :tracker => AppConfig.privacy.google_analytics_key.get
|
config.middleware.use Rack::GoogleAnalytics, tracker: AppConfig.privacy.google_analytics_key.get
|
||||||
end
|
end
|
||||||
|
|
||||||
if AppConfig.privacy.piwik.enable?
|
if AppConfig.privacy.piwik.enable?
|
||||||
require 'rack/piwik'
|
require 'rack/piwik'
|
||||||
config.gem 'rack-piwik', :lib => 'rack/piwik'
|
config.middleware.use Rack::Piwik, piwik_url: AppConfig.privacy.piwik.host.get,
|
||||||
config.middleware.use Rack::Piwik, :piwik_url => AppConfig.privacy.piwik.host.get,
|
piwik_id: AppConfig.privacy.piwik.site_id.get
|
||||||
:piwik_id => AppConfig.privacy.piwik.site_id.get
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ require 'markdownify_helper'
|
||||||
# Our libs
|
# Our libs
|
||||||
require 'collect_user_photos'
|
require 'collect_user_photos'
|
||||||
require 'diaspora'
|
require 'diaspora'
|
||||||
|
require 'direction_detector'
|
||||||
require 'email_inviter'
|
require 'email_inviter'
|
||||||
require 'evil_query'
|
require 'evil_query'
|
||||||
require 'federation_logger'
|
require 'federation_logger'
|
||||||
|
|
@ -33,4 +34,3 @@ require 'stream'
|
||||||
require 'template_picker'
|
require 'template_picker'
|
||||||
require 'webfinger'
|
require 'webfinger'
|
||||||
require 'webfinger_profile'
|
require 'webfinger_profile'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@
|
||||||
require Rails.root.join('lib', 'messagebus', 'mailer')
|
require Rails.root.join('lib', 'messagebus', 'mailer')
|
||||||
|
|
||||||
Diaspora::Application.configure do
|
Diaspora::Application.configure do
|
||||||
config.action_mailer.default_url_options = {:protocol => AppConfig.pod_uri.scheme,
|
config.action_mailer.default_url_options = {
|
||||||
:host => AppConfig.pod_uri.authority }
|
protocol: AppConfig.pod_uri.scheme,
|
||||||
|
host: AppConfig.pod_uri.authority
|
||||||
|
}
|
||||||
config.action_mailer.asset_host = AppConfig.pod_uri.to_s
|
config.action_mailer.asset_host = AppConfig.pod_uri.to_s
|
||||||
config.action_mailer.perform_deliveries = AppConfig.mail.enable?
|
config.action_mailer.perform_deliveries = AppConfig.mail.enable?
|
||||||
|
|
||||||
|
|
@ -21,26 +23,26 @@ Diaspora::Application.configure do
|
||||||
elsif AppConfig.mail.method == "sendmail"
|
elsif AppConfig.mail.method == "sendmail"
|
||||||
config.action_mailer.delivery_method = :sendmail
|
config.action_mailer.delivery_method = :sendmail
|
||||||
sendmail_settings = {
|
sendmail_settings = {
|
||||||
:location => AppConfig.mail.sendmail.location.get
|
location: AppConfig.mail.sendmail.location.get
|
||||||
}
|
}
|
||||||
sendmail_settings[:arguments] = "-i" if AppConfig.mail.sendmail.exim_fix?
|
sendmail_settings[:arguments] = "-i" if AppConfig.mail.sendmail.exim_fix?
|
||||||
config.action_mailer.sendmail_settings = sendmail_settings
|
config.action_mailer.sendmail_settings = sendmail_settings
|
||||||
elsif AppConfig.mail.method == "smtp"
|
elsif AppConfig.mail.method == "smtp"
|
||||||
config.action_mailer.delivery_method = :smtp
|
config.action_mailer.delivery_method = :smtp
|
||||||
smtp_settings = {
|
smtp_settings = {
|
||||||
:address => AppConfig.mail.smtp.host.get,
|
address: AppConfig.mail.smtp.host.get,
|
||||||
:port => AppConfig.mail.smtp.port.to_i,
|
port: AppConfig.mail.smtp.port.to_i,
|
||||||
:domain => AppConfig.mail.smtp.domain.get,
|
domain: AppConfig.mail.smtp.domain.get,
|
||||||
:enable_starttls_auto => false,
|
enable_starttls_auto: false,
|
||||||
:openssl_verify_mode => AppConfig.mail.smtp.openssl_verify_mode.get
|
openssl_verify_mode: AppConfig.mail.smtp.openssl_verify_mode.get
|
||||||
}
|
}
|
||||||
|
|
||||||
if AppConfig.mail.smtp.authentication != "none"
|
if AppConfig.mail.smtp.authentication != "none"
|
||||||
smtp_settings.merge!({
|
smtp_settings.merge!({
|
||||||
:authentication => AppConfig.mail.smtp.authentication.gsub('-', '_').to_sym,
|
authentication: AppConfig.mail.smtp.authentication.gsub('-', '_').to_sym,
|
||||||
:user_name => AppConfig.mail.smtp.username.get,
|
user_name: AppConfig.mail.smtp.username.get,
|
||||||
:password => AppConfig.mail.smtp.password.get,
|
password: AppConfig.mail.smtp.password.get,
|
||||||
:enable_starttls_auto => AppConfig.mail.smtp.starttls_auto?
|
enable_starttls_auto: AppConfig.mail.smtp.starttls_auto?
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1 @@
|
||||||
require Rails.root.join("lib", "diaspora", "markdownify_email")
|
|
||||||
|
|
||||||
Rails.application.config.markerb.renderer = Diaspora::Markdownify::Email
|
Rails.application.config.markerb.renderer = Diaspora::Markdownify::Email
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -16,8 +16,14 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
||||||
end
|
end
|
||||||
|
|
||||||
if AppConfig.services.facebook.enable?
|
if AppConfig.services.facebook.enable?
|
||||||
provider :facebook, AppConfig.services.facebook.app_id, AppConfig.services.facebook.secret,
|
provider :facebook, AppConfig.services.facebook.app_id, AppConfig.services.facebook.secret, {
|
||||||
{ :display => "popup", :scope => "publish_actions,publish_stream,offline_access",
|
display: 'popup',
|
||||||
:client_options => {:ssl => {:ca_file => AppConfig.environment.certificate_authorities }}}
|
scope: 'publish_actions,publish_stream,offline_access',
|
||||||
|
client_options: {
|
||||||
|
ssl: {
|
||||||
|
ca_file: AppConfig.environment.certificate_authorities
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# 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,
|
# Use the database for sessions instead of the cookie-based default,
|
||||||
# which shouldn't be used to store highly confidential information
|
# which shouldn't be used to store highly confidential information
|
||||||
|
|
|
||||||
|
|
@ -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?
|
|
||||||
|
|
@ -1,41 +1,36 @@
|
||||||
require 'configurate'
|
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['RACK_ENV']
|
||||||
rails_env ||= ENV['RAILS_ENV']
|
rails_env ||= ENV['RAILS_ENV']
|
||||||
rails_env ||= 'development'
|
rails_env ||= 'development'
|
||||||
|
|
||||||
require rails_root.join('lib', 'configuration_methods')
|
require File.join(rails_root, 'lib', 'configuration_methods')
|
||||||
|
|
||||||
config_dir = rails_root.join("config")
|
config_dir = File.join rails_root, '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
|
|
||||||
|
|
||||||
|
|
||||||
AppConfig ||= Configurate::Settings.create do
|
AppConfig ||= Configurate::Settings.create do
|
||||||
add_provider Configurate::Provider::Dynamic
|
add_provider Configurate::Provider::Dynamic
|
||||||
add_provider Configurate::Provider::Env
|
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 "FATAL: Configuration not found. Copy over diaspora.yml.example"
|
||||||
$stderr.puts " to diaspora.yml and edit it to your needs."
|
$stderr.puts " to diaspora.yml and edit it to your needs."
|
||||||
Process.exit(1)
|
exit!
|
||||||
end
|
end
|
||||||
|
|
||||||
add_provider Configurate::Provider::YAML,
|
add_provider Configurate::Provider::YAML,
|
||||||
config_dir.join("diaspora.yml"),
|
File.join(config_dir, 'diaspora.yml'),
|
||||||
namespace: rails_env, required: false
|
namespace: rails_env, required: false unless rails_env == 'test'
|
||||||
add_provider Configurate::Provider::YAML,
|
add_provider Configurate::Provider::YAML,
|
||||||
config_dir.join("diaspora.yml"),
|
File.join(config_dir, 'diaspora.yml'),
|
||||||
namespace: "configuration", required: false
|
namespace: "configuration", required: false
|
||||||
add_provider Configurate::Provider::YAML,
|
add_provider Configurate::Provider::YAML,
|
||||||
config_dir.join("defaults.yml"),
|
File.join(config_dir, 'defaults.yml'),
|
||||||
namespace: rails_env
|
namespace: rails_env
|
||||||
add_provider Configurate::Provider::YAML,
|
add_provider Configurate::Provider::YAML,
|
||||||
config_dir.join("defaults.yml"),
|
File.join(config_dir, 'defaults.yml'),
|
||||||
namespace: "defaults"
|
namespace: "defaults"
|
||||||
|
|
||||||
extend Configuration::Methods
|
extend Configuration::Methods
|
||||||
|
|
@ -45,6 +40,6 @@ AppConfig ||= Configurate::Settings.create do
|
||||||
environment.certificate_authorities.empty? ||
|
environment.certificate_authorities.empty? ||
|
||||||
!File.file?(environment.certificate_authorities.get))
|
!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"
|
$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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
require 'pathname'
|
require File.expand_path('../load_config', __FILE__)
|
||||||
require Pathname.new(__FILE__).expand_path.dirname.join('load_config')
|
|
||||||
|
|
||||||
# Enable and set these to run the worker as a different user/group
|
# Enable and set these to run the worker as a different user/group
|
||||||
#user = 'diaspora'
|
#user = 'diaspora'
|
||||||
|
|
|
||||||
|
|
@ -104,13 +104,18 @@ module Configuration
|
||||||
path.to_s
|
path.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def postgres?
|
||||||
|
defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) &&
|
||||||
|
ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def get_git_info
|
def get_git_info
|
||||||
return if git_info_present? || !git_available?
|
return if git_info_present? || !git_available?
|
||||||
|
|
||||||
git_cmd = `git log -1 --pretty="format:%H %ci"`
|
git_cmd = `git log -1 --pretty="format:%H %ci"`
|
||||||
if git_cmd =~ /^([\d\w]+?)\s(.+)$/
|
if git_cmd =~ /^(\w+?)\s(.+)$/
|
||||||
@git_revision = $1
|
@git_revision = $1
|
||||||
@git_update = $2.strip
|
@git_update = $2.strip
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,6 @@
|
||||||
module Diaspora
|
module Diaspora
|
||||||
module Markdownify
|
module Markdownify
|
||||||
class HTML < Redcarpet::Render::HTML
|
require 'diaspora/markdownify/html'
|
||||||
include ActionView::Helpers::TextHelper
|
require 'diaspora/markdownify/email'
|
||||||
include ActionView::Helpers::TagHelper
|
|
||||||
|
|
||||||
def autolink(link, type)
|
|
||||||
auto_link(link, :link => :urls, :html => { :target => "_blank" })
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
13
lib/diaspora/markdownify/html.rb
Normal file
13
lib/diaspora/markdownify/html.rb
Normal file
|
|
@ -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
|
||||||
|
|
@ -176,10 +176,8 @@ SQL
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def where_clause_sql
|
def where_clause_sql
|
||||||
if postgres?
|
if AppConfig.postgres?
|
||||||
"WHERE users.created_at > NOW() - '1 month'::INTERVAL"
|
"WHERE users.created_at > NOW() - '1 month'::INTERVAL"
|
||||||
elsif sqlite?
|
|
||||||
raise "#where_clause_sql not yet written for SQLite"
|
|
||||||
else
|
else
|
||||||
"where users.created_at > FROM_UNIXTIME(#{(Time.now - 1.month).to_i})"
|
"where users.created_at > FROM_UNIXTIME(#{(Time.now - 1.month).to_i})"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue