Class: Everywhere::Framework::Rails
- Inherits:
-
Framework
- Object
- Framework
- Everywhere::Framework::Rails
- Defined in:
- lib/everywhere/framework.rb
Overview
---- build/dev (CLI side) ------------------------------------------------
Instance Method Summary collapse
- #boot!(port:) ⇒ Object
-
#boot_stub ⇒ Object
Rails loads its bundle through config/boot.rb (with bootsnap guarded).
- #cleanup_command ⇒ Object
-
#dev_command ⇒ Object
CLI.
-
#env_exports ⇒ Object
Install.
- #name ⇒ Object
- #precompile_command ⇒ Object
- #precompile_env ⇒ Object
-
#prepare_runtime_env ⇒ Object
Runtime.
Instance Method Details
#boot!(port:) ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/everywhere/framework.rb', line 141 def boot!(port:) # Normally defined by bin/rails; the server command requires it. ::Object.const_set(:APP_PATH, File.join(root, "config/application")) unless defined?(::APP_PATH) # native_boot.rb requires this gem BEFORE Rails exists, so the engine # guard in everywhere.rb saw no ::Rails::Engine — and Bundler.require # won't re-require an already-loaded gem when the app boots below. # Without this, packaged apps silently lose the engine (bridge asset # path + "@rubyeverywhere/bridge" importmap pin). unless defined?(Everywhere::Engine) require "rails" # rails/engine alone lacks the AS core_ext it uses require "rails/engine" require_relative "engine" end require File.join(root, "config/environment") Everywhere::Database.prepare!(root) require "rails/command" ::Rails::Command.invoke :server, ["--binding=127.0.0.1", "--port=#{port}"] end |
#boot_stub ⇒ Object
Rails loads its bundle through config/boot.rb (with bootsnap guarded).
165 166 167 |
# File 'lib/everywhere/framework.rb', line 165 def boot_stub render_boot_stub(env_exports, "require_relative \"config/boot\"") end |
#cleanup_command ⇒ Object
133 |
# File 'lib/everywhere/framework.rb', line 133 def cleanup_command = "bin/rails assets:clobber" |
#dev_command ⇒ Object
CLI
123 124 125 |
# File 'lib/everywhere/framework.rb', line 123 def dev_command File.exist?(File.join(root, "bin", "dev")) ? "bin/dev" : "bundle exec rails server" end |
#env_exports ⇒ Object
Install
162 |
# File 'lib/everywhere/framework.rb', line 162 def env_exports = { "RAILS_ENV" => "production" } |
#name ⇒ Object
120 |
# File 'lib/everywhere/framework.rb', line 120 def name = "rails" |
#precompile_command ⇒ Object
131 |
# File 'lib/everywhere/framework.rb', line 131 def precompile_command = "bin/rails assets:precompile" |
#precompile_env ⇒ Object
127 128 129 |
# File 'lib/everywhere/framework.rb', line 127 def precompile_env { "RAILS_ENV" => "production", "SECRET_KEY_BASE" => "precompile-only" } end |
#prepare_runtime_env ⇒ Object
Runtime
136 137 138 139 |
# File 'lib/everywhere/framework.rb', line 136 def prepare_runtime_env ENV["RAILS_ENV"] ||= "production" ENV["SOLID_QUEUE_IN_PUMA"] ||= "1" end |