Unverified Commit bf75d2c4 authored by azul's avatar azul
Browse files

style: fix line length for config dir

parent cf21b931
......@@ -10,3 +10,10 @@ Style/EmptyElse:
AutoCorrect: false
Style/RaiseArgs:
AutoCorrect: false
Metrics/LineLength:
Exclude:
- 'Vagrantfile'
- 'config/initializers/notification.rb'
- 'config/deploy.rb'
- 'config/permissions.rb'
- 'lib/**/*'
......@@ -3,6 +3,8 @@ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# Uncomment if you are using Rails' asset pipeline
# load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb', 'vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
Dir['vendor/gems/*/recipes/*.rb', 'vendor/plugins/*/recipes/*.rb'].each do |p|
load p
end
load 'config/deploy' # remove this line to skip loading any of the default tasks
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
#!/usr/bin/env/rake
# Add your own tasks in files placed in lib/tasks ending in .rake, for
# example lib/tasks/capistrano.rake, and they will automatically be
# available to Rake.
require File.expand_path('../config/application', __FILE__)
......
......@@ -19,8 +19,9 @@ module Crabgrass
config.autoload_paths << "#{Rails.root}/lib"
config.autoload_paths << "#{Rails.root}/app/models"
config.autoload_paths += %w[chat profile requests mailers]
.collect { |dir| "#{Rails.root}/app/models/#{dir}" }
config.autoload_paths += %w[chat profile requests mailers].map do |dir|
"#{Rails.root}/app/models/#{dir}"
end
config.autoload_paths << "#{Rails.root}/app/permissions"
config.autoload_paths << "#{Rails.root}/app/helpers/classes"
......
......@@ -63,7 +63,8 @@ require 'fileutils'
dirs.each do |dir|
unless File.directory?(dir)
if File.exist?(dir)
raise format('ERROR: %s is supposed to be a directory, but file already exists', dir)
msg = 'ERROR: %s is supposed to be a directory, but file already exists'
raise format(msg, dir)
else
FileUtils.mkdir_p(dir)
end
......
......@@ -19,7 +19,8 @@ Crabgrass::Application.configure do
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# Precompile additional assets (application.js, application.css, and
# all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
##
......
......@@ -20,9 +20,10 @@ Crabgrass::Application.configure do
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# 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
# 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
##
......
# 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 add backtrace silencers for libraries that you're using but
# don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer do |line|
# line =~ /my_noisy_library/
# end
# We want to keep lines from extensions. So first of all we have to remove the default silencers.
# We want to keep lines from extensions. So first of all we have to
# remove the default silencers.
Rails.backtrace_cleaner.remove_silencers!
# now we introduce our own
Rails.backtrace_cleaner.add_silencer do |line|
(line !~ Rails::BacktraceCleaner::APP_DIRS_PATTERN) && # rails defaults
(line !~ /^\/?(extensions|vendor\/crabgrass_plugins)/) # cg stuff in other places
# rails defaults & cg stuff in other places
(line !~ Rails::BacktraceCleaner::APP_DIRS_PATTERN) &&
(line !~ /^\/?(extensions|vendor\/crabgrass_plugins)/)
end
......@@ -3,7 +3,11 @@
## levels of page access
##
ACCESS = HashWithIndifferentAccess.new(admin: 1, edit: 2, view: 3, none: nil).freeze
ACCESS = HashWithIndifferentAccess.new(admin: 1,
edit: 2,
view: 3,
none: nil).freeze
ACCESS_TO_SYM = { 1 => :admin, 2 => :edit, 3 => :view }.freeze
ACCESS_ADMIN = 1
......
......@@ -15,6 +15,8 @@ if Conf.email
end
end
if ActionMailer::Base.delivery_method == :smtp and ActionMailer::Base.smtp_settings[:port] and [587, 465].include?(ActionMailer::Base.smtp_settings[:port].to_i)
if ActionMailer::Base.delivery_method == :smtp and
ActionMailer::Base.smtp_settings[:port] and
[587, 465].include?(ActionMailer::Base.smtp_settings[:port].to_i)
require 'smtp_tls'
end
......@@ -25,7 +25,8 @@ end
# trim load_path #2
#
# for English only load files from locales/en/*.yml, not en.yml.
# en.yml is only needed for transiflex (rake cg:i18n:bundle to generate en.yml)
# en.yml is only needed for transiflex
# (rake cg:i18n:bundle to generate en.yml)
#
load_path = load_path.reject do |path|
path.include?('en.yml')
......
#
# Various gems and plugins all need to know what the default pagination size should be:
# Various gems and plugins all need to know what the default pagination
# size should be:
#
WillPaginate.per_page = Conf.pagination_size
......
#
#
# Sites are stored in the db, but the crabgrass.*.yml file determines which sites
# are active and what the admin group is for each site. This is kept in the config
# file for security reasons and to make it easy to enable/disable sites.
# Sites are stored in the db, but the crabgrass.*.yml file determines
# which sites are active and what the admin group is for each site. This
# is kept in the config file for security reasons and to make it easy to
# enable/disable sites.
#
ids = []
begin
Conf.sites.each do |site_conf|
site = Site.find_by_name(site_conf['name'])
if site
# TODO: figure out a way to put these into the corresponding mods
if Conf.enabled_mods.include?('moderation')
moderation_group = Group.find_by_name(site_conf['moderation_group'])
if moderation_group
site.update_attribute(:moderation_group_id, moderation_group.id)
else
puts format("ERROR (%s): site moderation group name '%s' not found in database!", Conf.configuration_filename, site_conf['moderation_group'])
end
end
if Conf.enabled_mods.include?('translator') && !site_conf['translation_group'].blank? && site.translation_group.blank?
site.update_attribute(:translation_group, site_conf['translation_group'])
end
if Conf.enabled_mods.include?('super_admin')
admin_group = Group.find_by_name(site_conf['admin_group'])
if admin_group
site.update_attribute(:super_admin_group_id, admin_group.id)
ids << site.id
else
puts format("ERROR (%s): site admin group name '%s' not found in database! (skipping site)", Conf.configuration_filename, site_conf['admin_group'])
end
else
ids << site.id
end
else
if site.nil?
if Site.count == 0
puts 'Skipping site configuration: database has no sites.'
raise Exception.new('skip sites')
else
puts format("ERROR (%s): site name '%s' not found in database!", Conf.configuration_filename, site_conf['name'])
puts 'Available site names are:'
puts ' ' + Site.find(:all).collect(&:name).inspect
puts "To create a site, run:\n rake cg:site:create NAME=<name> RAILS_ENV=<env>"
puts <<-EOMSG
ERROR (#{Conf.configuration_filename}):
Site name '#{site_conf['name']}' not found in database!
Available site names are:
#{Site.find(:all).collect(&:name).inspect}
To create a site, run:
rake cg:site:create NAME=<name> RAILS_ENV=<env>
EOMSG
end
end
end
rescue Exception => exc
# skip the sites initialization if something goes wrong. Likely, the problem is
# that the sites db is not yet set up.
# skip the sites initialization if something goes wrong. Likely, the
# problem is that the sites db is not yet set up.
end
# an array of id numbers of sites that are enabled. If a site does not
......
#
# UNUSED: This is a default since rails 3.1
# ( http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-0-to-rails-3-1 )
#
# We're not using json responses much and i think we do not make
# use of any of this. But since it's in by default...
#
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
# Enable parameter wrapping for JSON. You can disable this by setting
# :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
......
#
# This is a configuration file for crabgrass crontab. The gem 'whenever' reads this
# file and uses it to create a crontab.
# This is a configuration file for crabgrass crontab. The gem 'whenever'
# reads this file and uses it to create a crontab.
#
# To see what crontab this would generate:
#
......@@ -12,8 +12,8 @@
#
# For use with capistrano, at top of deploy.rb:
#
# require 'whenever/capistrano'
# set :whenever_command, 'whenever -f config/misc/schedule.rb'
# require 'whenever/capistrano' set :whenever_command, 'whenever -f
# config/misc/schedule.rb'
#
# See https://github.com/javan/whenever for more details.
#
......
......@@ -33,7 +33,10 @@ Crabgrass::Application.routes.draw do
get '/assets/:id(/*path)', to: 'assets#show', as: 'asset'
scope format: false do
get 'avatars/:id/:size.jpg', to: 'avatars#show', as: 'avatar', constraints: { size: /#{Avatar::SIZES.keys.join('|')}/ }
get 'avatars/:id/:size.jpg',
to: 'avatars#show',
as: 'avatar',
constraints: { size: /#{Avatar::SIZES.keys.join('|')}/ }
get 'theme/:name/*file.css', to: 'theme#show'
end
......@@ -46,7 +49,9 @@ Crabgrass::Application.routes.draw do
##
namespace 'me' do
delete 'notices/destroy_all', to: 'notices#destroy_all', as: 'notices_destroy_all'
delete 'notices/destroy_all',
to: 'notices#destroy_all',
as: 'notices_destroy_all'
resources :notices, only: %i[index show destroy]
get '', to: 'notices#index', as: 'home'
# resource :page, only: [:new, :create]
......@@ -120,8 +125,12 @@ Crabgrass::Application.routes.draw do
## GROUP
##
get 'networks/directory(/*path)', as: 'networks_directory', to: 'group/directory#index'
get 'groups/directory(/*path)', as: 'groups_directory', to: 'group/directory#index'
get 'networks/directory(/*path)',
as: 'networks_directory',
to: 'group/directory#index'
get 'groups/directory(/*path)',
as: 'groups_directory',
to: 'group/directory#index'
resources :groups, module: 'group', only: %i[new create destroy] do
# content related
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment