Sha256: e2aafe9aa95d85909a177d2d616cebbd853ac03f5badfa0dba3aa0b30f7aa578
Contents?: true
Size: 1.56 KB
Versions: 3
Compression:
Stored size: 1.56 KB
Contents
# frozen_string_literal: true require 'wcc/contentful/rails' require_relative './app/exceptions' require_relative './app/configuration' require_relative './app/markdown_renderer' module WCC::Contentful::App class << self attr_reader :initialized # Gets the current configuration, after calling WCC::Contentful::App.configure attr_reader :configuration end def self.configure if initialized || WCC::Contentful.initialized raise WCC::Contentful::InitializationError, 'Cannot configure after initialization' end WCC::Contentful.configure do |wcc_contentful_config| if @configuration&.wcc_contentful_config != wcc_contentful_config @configuration = Configuration.new(wcc_contentful_config) end yield(configuration) end configuration.validate! configuration end def self.init! raise ArgumentError, 'Please first call WCC::Contentful::App.configure' if configuration.nil? WCC::Contentful.init! # Extend all model types w/ validation & extra fields WCC::Contentful.types.each_value do |t| file = File.dirname(__FILE__) + "/model/#{t.name.underscore}.rb" require file if File.exist?(file) end @db_connected = begin ::ActiveRecord::Base.connection_pool.with_connection(&:active?) rescue StandardError false end @configuration = WCC::Contentful::App::Configuration::FrozenConfiguration.new( configuration, WCC::Contentful.configuration ) @initialized = true end def self.db_connected? @db_connected end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wcc-contentful-app-1.0.8 | lib/wcc/contentful/app.rb |
wcc-contentful-app-1.0.7 | lib/wcc/contentful/app.rb |
wcc-contentful-app-1.0.6 | lib/wcc/contentful/app.rb |