Skip to content

Commit

Permalink
Remove lib folder from autoload path
Browse files Browse the repository at this point in the history
- Load extensions explicitly
  • Loading branch information
Artur Beljajev committed Jun 5, 2018
1 parent 9ea5b54 commit 30ac973
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 25 deletions.
17 changes: 16 additions & 1 deletion app/controllers/epp_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class EppController < ApplicationController
include Iptable
layout false
protect_from_forgery with: :null_session
skip_before_action :verify_authenticity_token
Expand Down Expand Up @@ -407,4 +406,20 @@ def session_timeout_reached?
timeout = 5.minutes
epp_session.updated_at < (Time.zone.now - timeout)
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
3 changes: 0 additions & 3 deletions lib/sorted_country.rb → app/models/sorted_country.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
require 'countries'
require 'action_view'

class SortedCountry
class << self
include ActionView::Helpers
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class Application < Rails::Application

# Autoload all model subdirs
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.watchable_dirs['lib'] = %i[rb]

# Add the fonts path
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'devise_custom_failure'

# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/ext.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'core_ext/array'
require 'gem_ext/builder'
require 'gem_ext/i18n'
require 'gem_ext/paper_trail'
1 change: 0 additions & 1 deletion config/initializers/load_class_extensions.rb

This file was deleted.

2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'epp_constraint'
require_dependency 'epp_constraint'

Rails.application.routes.draw do
namespace(:epp, defaults: { format: :xml }) do
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Don't raise error when nil
# http://stackoverflow.com/questions/9467034/rails-i18n-how-to-handle-case-of-a-nil-date-being-passed-ie-lnil
# http://stackoverflow.com/questions/9467034/rails-i18n-how-to-handle-case-of-a-nil-date-being-passed-ie-lnil
module I18n
class << self
alias_method :original_localize, :localize
Expand Down
File renamed without changes.
17 changes: 0 additions & 17 deletions lib/iptable.rb

This file was deleted.

0 comments on commit 30ac973

Please sign in to comment.