module RailsBase

Constants

AdminStruct
MAJOR
MINOR
PATCH
VERSION

Public Class Methods

___execute_initializer___?() click to toggle source

Rails 6 does not play nice with this function – Find a different work around

# File lib/rails_base.rb, line 22
def self.___execute_initializer___?
  # Only execute when not doing DB actions
  boolean = defined?(ARGV) ? true : false  # for when no ARGVs are provided, we know its a railsc or rails s explicit
  boolean = false if boolean && ARGV[0]&.include?('db') # when its the DB rake tasks
  boolean = false if boolean && ARGV[0]&.include?('asset') # when its an asset
  boolean = false if boolean && ARGV[0]&.include?(':') # else this delim should never be included
  boolean = false if ENV['SKIP_CUSTOM_INIT']=='true' # explicitly set the variable to skip shit

  boolean
end
app_name() click to toggle source
# File lib/rails_base.rb, line 37
def self.app_name
  if ::Rails::VERSION::MAJOR >= 6
    ::Rails.application.class.module_parent_name
  else
    ::Rails.application.class.parent_name
  end
end
appearance() click to toggle source
# File lib/rails_base.rb, line 62
def self.appearance
  @appearance ||= config.appearance
end
config() click to toggle source
# File lib/rails_base.rb, line 58
def self.config
  @config ||= RailsBase::Config.instance
end
configure() { |config| ... } click to toggle source
# File lib/rails_base.rb, line 52
def self.configure(&block)
  yield(config) if block_given?

  config.validate_configs!
end
print_version() click to toggle source
reset_config!() click to toggle source
# File lib/rails_base.rb, line 66
def self.reset_config!
  config.reset_config!
end
route_exist?(path) click to toggle source
# File lib/rails_base.rb, line 45
def self.route_exist?(path)
  Rails.application.routes.recognize_path(path)
  true
rescue StandardError, ActionController::RoutingError
  false
end
url_routes() click to toggle source
# File lib/rails_base.rb, line 33
def self.url_routes
  Rails.application.routes.url_helpers
end