Module: Engine2
- Defined in:
- 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/action/form.rb,
lib/engine2/action/link.rb,
lib/engine2/action/list.rb,
lib/engine2/action/save.rb,
lib/engine2/action/view.rb,
lib/engine2/action_node.rb,
lib/engine2/action/array.rb,
lib/engine2/action/infra.rb,
lib/engine2/models/Files.rb,
lib/engine2/action/decode.rb,
lib/engine2/action/delete.rb,
lib/engine2/models/UserInfo.rb,
lib/engine2/core.rb
Defined Under Namespace
Modules: ActionAPISupport, ActionAngularSupport, ActionApproveSupport, ActionBulkDeleteSupport, ActionCreateSupport, ActionDeleteSupport, ActionDraggableSupport, ActionFormSupport, ActionInsertSupport, ActionListSupport, ActionMenuSupport, ActionModelSupport, ActionModifySupport, ActionOnChangeSupport, ActionPanelSupport, ActionQuerySupport, ActionSaveSupport, ActionTabSupport, ActionUpdateSupport, ActionViewSupport, ActionWebSocketSupport, BlobSupportAction, MemoryModel, Model
Classes: Action, ActionMenuBuilder, ActionNode, ActionNodeBundle, ArrayCreateAction, ArrayDeleteAction, ArrayFormAction, ArrayInsertAction, ArrayListAction, ArrayModifyAction, ArraySaveAction, ArrayUpdateAction, ArrayViewAction, BlobStoreAction, BulkDeleteAction, ConfirmAction, CreateAction, DecodeAction, DecodeEntryAction, DecodeListAction, DeleteAction, DeleteActionBase, DownloadBlobStoreAction, DownloadFileStoreAction, DownloadForeignBlobStoreAction, E2Error, E2Files, FileStoreAction, ForeignBlobStoreAction, FormAction, Handler, InfraAction, InlineAction, InsertAction, InspectModalAction, ListAction, LoginAction, LoginFormAction, LogoutAction, LogoutFormAction, ManyToOneListAction, MenuAction, MenuBuilder, ModifyAction, RootAction, SaveAction, Schemes, SearchTemplates, StarToManyBulkUnlinkAction, StarToManyFieldAction, StarToManyFieldInsertAction, StarToManyFieldLinkListAction, StarToManyFieldUpdateAction, StarToManyLinkAction, StarToManyLinkListAction, StarToManyListAction, StarToManyUnlinkAction, StarToManyUnlinkActionBase, Templates, TypeAheadAction, TypeInfo, UpdateAction, UploadBlobStoreAction, UploadFileStoreAction, UserInfo, ViewAction, WebSocketAction
Constant Summary
collapse
- VERSION =
[MAJOR, MINOR, TINY].join('.').freeze
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.core_loaded ⇒ Object
Returns the value of attribute core_loaded.
521
522
523
|
# File 'lib/engine2/core.rb', line 521
def core_loaded
@core_loaded
end
|
Class Method Details
.boot(&blk) ⇒ Object
532
533
534
|
# File 'lib/engine2/core.rb', line 532
def boot &blk
@boot_blk = blk
end
|
.bootstrap(path, settings = {}) ⇒ Object
579
580
581
582
583
584
585
586
587
588
589
590
591
|
# File 'lib/engine2/core.rb', line 579
def bootstrap path, settings = {}
SETTINGS.merge! settings
SETTINGS[:path] = path
SETTINGS[:name] ||= File::basename(path)
SETTINGS.freeze
Handler.set :public_folder, "public"
Handler.set :views, [SETTINGS.path_for(:view_path), "#{Engine2::PATH}/views"]
bootstrap_e2db
require 'engine2/pre_bootstrap'
reload
require 'engine2/post_bootstrap'
end
|
.bootstrap_e2db ⇒ Object
540
541
542
543
544
545
546
|
# File 'lib/engine2/core.rb', line 540
def bootstrap_e2db
e2_db_path = "#{Engine2::SETTINGS.path_for(:db_path)}/engine2.db"
e2_db_url = (defined? JRUBY_VERSION) ? "jdbc:sqlite:#{e2_db_path}" : "sqlite://#{e2_db_path}"
const_set :E2DB, connect(e2_db_url, loggers: [Logger.new($stdout)], convert_types: false, name: :engine2)
const_set :DUMMYDB, Sequel::Database.new(uri: 'dummy')
def DUMMYDB.synchronize *args;end
end
|
.connect(*args) ⇒ Object
527
528
529
530
|
# File 'lib/engine2/core.rb', line 527
def connect *args
db = Sequel.connect *args
db
end
|
.database(name) ⇒ Object
523
524
525
|
# File 'lib/engine2/core.rb', line 523
def database name
Object.const_set(name, yield) unless Object.const_defined?(name)
end
|
.model_boot(&blk) ⇒ Object
536
537
538
|
# File 'lib/engine2/core.rb', line 536
def model_boot &blk
@model_boot_blk = blk
end
|
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
# File 'lib/engine2/core.rb', line 548
def reload
@core_loaded = true
t = Time.now
ActionNode.count = 0
SCHEMES.user.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 "#{Engine2::SETTINGS[:app_path]}/boot.rb"
Sequel::DATABASES.each &:load_schema_cache_from_file
load 'engine2/models/Files.rb'
load 'engine2/models/UserInfo.rb'
Dir["#{Engine2::SETTINGS.path_for(:model_path)}/*"].each{|m| load m}
@model_boot_blk.() if @model_boot_blk
puts "MODELS: #{Sequel::DATABASES.reduce(0){|s, d|s + d.models.size}}, Time: #{Time.now - t}"
Sequel::DATABASES.each do |db|
db.dump_schema_cache_to_file
db.models.each{|n, m|m.synchronize_type_info}
end
send(:remove_const, :ROOT) if defined? ROOT
const_set(:ROOT, ActionNode.new(nil, :api, RootAction, {}))
@boot_blk.(ROOT)
ROOT.setup_node_tree
puts "BOOTSTRAP #{Engine2::SETTINGS[:name]}, Time: #{Time.new - t}"
end
|
7
8
9
|
# File 'lib/engine2/version.rb', line 7
def self.version
VERSION
end
|