Created
January 3, 2019 15:29
-
-
Save MaryKuz/8f8505066cdec7313eff06341943c716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module App | |
module Initializer | |
class << self | |
include EM::Deferrable | |
def load_app | |
#log that app loaded all files and ready to start from this point | |
succeed | |
end | |
end | |
end | |
module Destructor | |
class << self | |
include EM::Deferrable | |
def release_resources | |
#log that app is closing. Think about a way to make this logic be able to differ closing reasons | |
succeed | |
end | |
end | |
end | |
class << self | |
extend Forwardable | |
def root | |
@root ||= File.dirname(File.expand_path('..', __FILE__)) | |
end | |
def environment | |
@default_env ||= ENV['SMSERVICE_ENV'] || 'development' | |
end | |
alias env environment | |
def_delegator Initializer, :load_app, :init | |
def_delegator Destructor, :release_resources, :close | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment