Class: Everywhere::Boot
- Inherits:
-
Object
- Object
- Everywhere::Boot
- Defined in:
- lib/everywhere/boot.rb
Overview
Runtime boot for the packaged desktop build. Called from the app's generated native_boot.rb stub (after the bundle is set up):
Everywhere.boot!(root: __dir__)
This core is framework-neutral. Its responsibilities:
1. Resolve a writable per-user app-data directory (packaged FS is read-only)
2. Generate a per-install SECRET_KEY_BASE on first boot
3. Copy static assets to a writable dir (the memfs truncates large files)
4. Watch the shell process and shut down if it dies
Everything framework-specific — loading the app, preparing the database, and starting the server — is delegated to the detected Framework adapter, so Rails, Sinatra, and Hanami each own their own boot path.
The desktop shell passes NATIVE_PORT and NATIVE_APPDATA; standalone runs (debugging) get a free port and a config-derived app-data dir.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(root) ⇒ Boot
constructor
A new instance of Boot.
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
29 30 31 |
# File 'lib/everywhere/boot.rb', line 29 def config @config end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
29 30 31 |
# File 'lib/everywhere/boot.rb', line 29 def root @root end |
Class Method Details
.call(root:) ⇒ Object
25 26 27 |
# File 'lib/everywhere/boot.rb', line 25 def self.call(root:) new(root).call end |
Instance Method Details
#call ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/everywhere/boot.rb', line 36 def call ENV["NATIVE_PACKAGED"] ||= "1" framework = Framework.detect(root) framework.prepare_runtime_env prepare_app_data ensure_secret_key_base extract_public_dir Dir.chdir(root) watch_shell port = ENV["NATIVE_PORT"] || free_port puts "[everywhere] framework: #{framework.name}" puts "[everywhere] app data: #{app_data}" puts "[everywhere] app running at http://127.0.0.1:#{port}" framework.boot!(port: port) end |