Module: Engine2

Defined in:
lib/engine2/core.rb,
lib/engine2/meta.rb,
lib/engine2/model.rb,
lib/engine2/action.rb,
lib/engine2/scheme.rb,
lib/engine2/handler.rb,
lib/engine2/version.rb,
lib/engine2/templates.rb,
lib/engine2/type_info.rb,
lib/engine2/models/Files.rb,
lib/engine2/meta/form_meta.rb,
lib/engine2/meta/link_meta.rb,
lib/engine2/meta/list_meta.rb,
lib/engine2/meta/save_meta.rb,
lib/engine2/meta/view_meta.rb,
lib/engine2/meta/infra_meta.rb,
lib/engine2/models/UserInfo.rb,
lib/engine2/meta/decode_meta.rb,
lib/engine2/meta/delete_meta.rb

Defined Under Namespace

Modules: BlobSupportMeta, MemoryModel, MetaAPISupport, MetaAngularSupport, MetaApproveSupport, MetaListSupport, MetaMenuSupport, MetaModelSupport, MetaOnChangeSupport, MetaPanelSupport, MetaQuerySupport, MetaTabSupport, MetaViewSupport, Model, TimeStampMeta Classes: Action, ActionBundle, ActionMenuBuilder, BlobStoreMeta, BulkDeleteMeta, ConfirmMeta, CreateMeta, DecodeEntryMeta, DecodeListMeta, DecodeMeta, DeleteMeta, DeleteMetaBase, DownloadBlobStoreMeta, DownloadFileStoreMeta, DownloadForeignBlobStoreMeta, DummyMeta, E2Error, E2Files, FileStoreMeta, ForeignBlobStoreMeta, FormMeta, Handler, InsertMeta, ListMeta, LoginFormMeta, LoginMeta, LogoutFormMeta, LogoutMeta, ManyToOneListMeta, MenuBuilder, MenuMeta, Meta, ModifyMeta, SaveMeta, Schemes, SearchTemplates, StarToManyBulkUnlinkMeta, StarToManyFieldLinkListMeta, StarToManyFieldMeta, StarToManyFieldUnlinkMeta, StarToManyLinkListMeta, StarToManyLinkMeta, StarToManyListMeta, StarToManyUnlinkMeta, StarToManyUnlinkMetaBase, Templates, TypeAheadMeta, TypeInfo, UpdateMeta, UploadBlobStoreMeta, UploadFileStoreMeta, UserInfo, ViewMeta

Constant Summary collapse

VERSION =
[MAJOR, MINOR, TINY].join('.').freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.core_loadingObject

Returns the value of attribute core_loading.



436
437
438
# File 'lib/engine2/core.rb', line 436

def core_loading
  @core_loading
end

Class Method Details

.boot(&blk) ⇒ Object



456
457
458
# File 'lib/engine2/core.rb', line 456

def self.boot &blk
    @boot_blk = blk
end

.bootstrap(app = APP_LOCATION) ⇒ Object



464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/engine2/core.rb', line 464

def self.bootstrap app = APP_LOCATION
    require 'engine2/pre_bootstrap'
    t = Time.now
    Action.count = 0
    SCHEMES.clear

    Sequel::DATABASES.each do |db|
        db.models.each{|n, m| Object.send(:remove_const, n) if Object.const_defined?(n)} unless db == E2DB || db == DUMMYDB
    end

    load "#{app}/boot.rb"

    Sequel::DATABASES.each &:load_schema_cache_from_file
    @model_boot_blk.() if @model_boot_blk
    load 'engine2/models/Files.rb'
    load 'engine2/models/UserInfo.rb'
    Dir["#{app}/models/*"].each{|m| load m}
    puts "MODELS, Time: #{Time.now - t}"
    Sequel::DATABASES.each &:dump_schema_cache_to_file

    SCHEMES.merge!
    Engine2.send(:remove_const, :ROOT) if defined? ROOT
    Engine2.const_set(:ROOT, Action.new(nil, :api, DummyMeta, {}))

    @boot_blk.(ROOT)
    ROOT.setup_action_tree
    puts "BOOTSTRAP #{app}, Time: #{Time.new - t}"
    self.core_loading = false
    require 'engine2/post_bootstrap'
end

.connect(*args) ⇒ Object



445
446
447
448
449
# File 'lib/engine2/core.rb', line 445

def self.connect *args
    db = Sequel.connect *args
    db.models = {}
    db
end

.database(name) ⇒ Object



441
442
443
# File 'lib/engine2/core.rb', line 441

def self.database name
    Object.const_set(name, yield) unless Object.const_defined?(name)
end

.model_boot(&blk) ⇒ Object



460
461
462
# File 'lib/engine2/core.rb', line 460

def self.model_boot &blk
    @model_boot_blk = blk
end

.versionObject



6
7
8
# File 'lib/engine2/version.rb', line 6

def self.version
    VERSION
end