Sha256: e88b1d6260bcd2d6a6768b6b26c1699664647d5e5826e40d611d111ac6fd950a

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 KB

Contents

require 'active_record'

require 'rubypitaya/core/database_config'

# Database connection
environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
ActiveRecord::Base.establish_connection(database_config.connection_data)
# ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
# ActiveSupport::LogSubscriber.colorize_logging = true

connection_data = database_config.connection_data
migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
migrations_paths += [RubyPitaya::Path::MIGRATIONS_FOLDER_PATH]
ActiveRecord::Migrator.migrations_paths = migrations_paths
ActiveRecord::Migration.maintain_test_schema!

# Loading core files
Gem.find_files('rubypitaya/**/*.rb').each do |path|
  require path unless path.end_with?('spec.rb') ||
                      path.include?('db/migration') ||
                      path.include?('core/templates') ||
                      path.include?('core/spec-helpers') ||
                      path.include?('app-template')
end

# Loading application files
app_folder_paths = RubyPitaya::Path::Plugins::APP_FOLDER_PATHS + [RubyPitaya::Path::APP_FOLDER_PATH]
app_folder_paths.each do |app_folder_path|
  app_files_path = File.join(app_folder_path, '**/*.rb')

  Dir[app_files_path].each do |path|
    require path unless path.end_with?('spec.rb') ||
                        path.include?('db/migration')
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rubypitaya-2.20.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.19.1 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.19.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.18.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.17.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.16.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.15.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.14.1 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.14.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.13.1 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.13.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.12.0 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.11.2 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.11.1 ./lib/rubypitaya/core/helpers/setup_helper.rb
rubypitaya-2.11.0 ./lib/rubypitaya/core/helpers/setup_helper.rb