# TheAdmin - gems require "the-admin/version" require "the-admin/form" require "the-admin/layout" # 3rd party gems require "sinatra/base" require "sinatra/contrib/all" require "digest" require "base64" require "json" module TheAdmin class << self # Controls the app configuration # @return [TheAdmin::Configuration] configuration object attr_accessor :configuration end # Configure the TheAdmin gem # # @example # TheAdmin.confgure do |config| # config.bugsnag_api_key = "XYZ" # # config.mail_from = "John Doe" # config.mail_address = "johndoe@example.com" # config.mail_port = "578" # config.mail_domain = "smtp.mailgun.org" # config.mail_user_name = "" # config.mail_password = "" # config.mail_authentication = "plain" # # config.aws_bucket = "" # config.aws_access_key_id = "" # config.aws_secret_access_key = "" # config.aws_region = "" # end def self.configure self.configuration ||= Configuration.new yield(configuration) end # # TheAdmin configuration class. # # @author Tim Mushen # class Configuration # Controls the bugsnag api key attribute # @return [String] Bugsnag api key # attr_accessor :bugsnag_api_key # Controls the mail from # @return [String] the mail from attr_accessor :mail_from # Controls the mail address # @return [String] the mail address attr_accessor :mail_address # Controls the mail port number # @return [String] the mail port number attr_accessor :mail_port # Controls the mail domain # @return [String] the mail domain attr_accessor :mail_domain # Controls the mail user name # @return [String] the mail user name attr_accessor :mail_user_name # Controls the mail password # @return [String] the mail password attr_accessor :mail_password # Controls mail authentication # @return [String] mail authentication attr_accessor :mail_authentication # Controls the aws bucket name # @return [String] aws bucket name attr_accessor :aws_bucket # Controls the aws access key id # @return [String] the aws access key id attr_accessor :aws_access_key_id # Controls the aws secret access key # @return [String] the aws secret access key attr_accessor :aws_secret_access_key # Controls the aws region # @return [String] aws region attr_accessor :aws_region # Initialize TheAdmin configuration object and set defaults def initialize # Bugsnag # @bugsnag_api_key = "" # X_mail @mail_from = "" @mail_address = "smtp.mailgun.org" @mail_port = "587" @mail_domain = "smtp.mailgun.org" @mail_user_name = "" @mail_password = "" @mail_authentication = "plain" # For AWS/Fog @aws_bucket = "" @aws_secret_access_key = "" @aws_access_key_id = "" @aws_region = "" end end # TheAdmin - Sinatra module module Sinatra def self.registered(app) app.helpers TheAdmin::FormHelpers app.helpers TheAdmin::LayoutHelpers end end # End Sinatra end #Register Helpers Sinatra.register TheAdmin::Sinatra