Remove lib folder from autoload path

- Load extensions explicitly
This commit is contained in:
Artur Beljajev 2018-06-05 17:26:14 +03:00
parent 9ea5b54f5c
commit 30ac973f96
12 changed files with 25 additions and 25 deletions

View file

@ -1,5 +1,4 @@
class EppController < ApplicationController class EppController < ApplicationController
include Iptable
layout false layout false
protect_from_forgery with: :null_session protect_from_forgery with: :null_session
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
@ -407,4 +406,20 @@ class EppController < ApplicationController
timeout = 5.minutes timeout = 5.minutes
epp_session.updated_at < (Time.zone.now - timeout) epp_session.updated_at < (Time.zone.now - timeout)
end end
def counter_update(registrar_code, ip)
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
begin
File.open(counter_proc, 'a') do |f|
f.puts "+#{ip}"
end
rescue Errno::ENOENT => e
logger.error "IPTABLES COUNTER UPDATE: cannot open #{counter_proc}: #{e}"
rescue Errno::EACCES => e
logger.error "IPTABLES COUNTER UPDATE: no permission #{counter_proc}: #{e}"
rescue IOError => e
logger.error "IPTABLES COUNTER UPDATE: cannot write #{ip} to #{counter_proc}: #{e}"
end
end
end end

View file

@ -1,6 +1,3 @@
require 'countries'
require 'action_view'
class SortedCountry class SortedCountry
class << self class << self
include ActionView::Helpers include ActionView::Helpers

View file

@ -40,8 +40,8 @@ module DomainNameRegistry
# Autoload all model subdirs # Autoload all model subdirs
config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')] config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
config.autoload_paths << Rails.root.join('lib')
config.eager_load_paths << config.root.join('lib', 'validators') config.eager_load_paths << config.root.join('lib', 'validators')
config.watchable_dirs['lib'] = %i[rb]
# Add the fonts path # Add the fonts path
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts') config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')

View file

@ -1,3 +1,5 @@
require 'devise_custom_failure'
# Use this hook to configure devise mailer, warden hooks and so forth. # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model. # Many of these configuration options can be set straight in your model.
Devise.setup do |config| Devise.setup do |config|

View file

@ -0,0 +1,4 @@
require 'core_ext/array'
require 'gem_ext/builder'
require 'gem_ext/i18n'
require 'gem_ext/paper_trail'

View file

@ -1 +0,0 @@
Dir[File.join(Rails.root, 'lib', 'ext', '*.rb')].each { |x| require x }

View file

@ -1,4 +1,4 @@
require 'epp_constraint' require_dependency 'epp_constraint'
Rails.application.routes.draw do Rails.application.routes.draw do
namespace(:epp, defaults: { format: :xml }) do namespace(:epp, defaults: { format: :xml }) do

View file

@ -1,17 +0,0 @@
module Iptable
def counter_update(registrar_code, ip)
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
begin
File.open(counter_proc, 'a') do |f|
f.puts "+#{ip}"
end
rescue Errno::ENOENT => e
logger.error "IPTABLES COUNTER UPDATE: cannot open #{counter_proc}: #{e}"
rescue Errno::EACCES => e
logger.error "IPTABLES COUNTER UPDATE: no permission #{counter_proc}: #{e}"
rescue IOError => e
logger.error "IPTABLES COUNTER UPDATE: cannot write #{ip} to #{counter_proc}: #{e}"
end
end
end