lib/platformx.rb in platformx-0.0.4 vs lib/platformx.rb in platformx-0.0.6

- old
+ new

@@ -1,19 +1,17 @@ require "platformx/version" -require "platformx/configuration" require "platformx/auth" require "platformx/form" require "platformx/layout" require "platformx/date" require "platformx/notify" require "platformx/mail" require "platformx/stripe" -require "platformx/google_map" -require "platformx/instagram" require "platformx/faker" require "platformx/pdf" require "platformx/text" +require "platformx/aws" ########################### Require Gems ############################ require "sinatra/base" require "sinatra/contrib/all" require "sinatra/partial" @@ -32,56 +30,106 @@ require "rack-protection" require "rack-ssl-enforcer" require "bugsnag" require "slugify" require "data_mapper" +require "dm-validations" require "securerandom" -require "geokit" require "faker" require "uuidtools" require "net/ssh" +require "fog" module Platformx class << self attr_accessor :configuration end - def self.configuration - @configuration ||= Configuration.new + def self.configure + self.configuration ||= Configuration.new + yield(configuration) end - def self.reset - @configuration = Configuration.new - end +######################################################## +# +# Start Configuration Class +# +######################################################## + class Configuration - def self.configure - yield(configuration) + # For Bugsnag + attr_accessor :bugsnag_api_key + + # X_mail + attr_accessor :mail_from + attr_accessor :mail_address + attr_accessor :mail_port + attr_accessor :mail_domain + attr_accessor :mail_user_name + attr_accessor :mail_password + attr_accessor :mail_authentication + + # For AWS/Fog + attr_accessor :aws_bucket + attr_accessor :aws_access_key_id + attr_accessor :aws_secret_access_key + attr_accessor :aws_region + + 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 + + + +######################################################## +# +# Start Sinatra Module +# +######################################################## + module Sinatra def self.registered(app) app.helpers Platformx::DateHelpers app.helpers Platformx::StripeHelpers app.helpers Platformx::AuthHelpers app.helpers Platformx::FormHelpers app.helpers Platformx::LayoutHelpers app.helpers Platformx::NotifyHelpers - app.helpers Platformx::GooglemapHelpers - app.helpers Platformx::InstagramHelpers app.helpers Platformx::FakerHelpers - app.helpers Platformx::TextHelpers + app.helpers Platformx::TextHelpers + app.helpers Platformx::PdfHelpers + app.helpers Platformx::S3Helpers - #BugSnag - if Platformx.configuration.bugsnag_api_key != "" - app.Bugsnag.configure do |config| - config.api_key = Platformx.configuration.bugsnag_api_key - end - app.use Bugsnag::Rack - app.enable :raise_errors - end + # #BugSnag + # if Platformx.configuration.bugsnag_api_key != "" + # app.Bugsnag.configure do |config| + # config.api_key = Platformx.configuration.bugsnag_api_key + # end + # app.use Bugsnag::Rack + # app.enable :raise_errors + # end # Configure Better Errors if app.development? app.use BetterErrors::Middleware @@ -91,12 +139,9 @@ # Configure Rack Protection if app.production? app.use Rack::Protection end - #require_relative 'platformx/omniauth_routes.rb' - - end end # End Sinatra end #Register Helpers \ No newline at end of file