Sha256: b2f82848ff2937aa4b6871f71da19de9513a8688c34caafbd78dcefde396d387

Contents?: true

Size: 768 Bytes

Versions: 7

Compression:

Stored size: 768 Bytes

Contents

module SlackRubyBotServer
  class App
    def prepare!
      check_database!
      init_database!
      purge_inactive_teams!
      configure_global_aliases!
    end

    def self.instance
      @instance ||= new
    end

    private

    def logger
      @logger ||= begin
        STDOUT.sync = true
        Logger.new(STDOUT)
      end
    end

    def check_database!
      SlackRubyBotServer::DatabaseAdapter.check!
    end

    def init_database!
      SlackRubyBotServer::DatabaseAdapter.init!
    end

    def purge_inactive_teams!
      Team.purge!
    end

    def configure_global_aliases!
      SlackRubyBot.configure do |config|
        config.aliases = ENV['SLACK_RUBY_BOT_ALIASES'].split(' ') if ENV['SLACK_RUBY_BOT_ALIASES']
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
slack-ruby-bot-server-1.0.0 lib/slack-ruby-bot-server/app.rb
slack-ruby-bot-server-0.12.3 lib/slack-ruby-bot-server/app.rb
slack-ruby-bot-server-0.12.2 lib/slack-ruby-bot-server/app.rb
slack-ruby-bot-server-0.12.1 lib/slack-ruby-bot-server/app.rb
slack-ruby-bot-server-0.12.0 lib/slack-ruby-bot-server/app.rb
slack-ruby-bot-server-0.11.1 lib/slack-ruby-bot-server/app.rb
slack-ruby-bot-server-0.11.0 lib/slack-ruby-bot-server/app.rb