Class: Everywhere::Framework::Rails

Inherits:
Framework
  • Object
show all
Defined in:
lib/everywhere/framework.rb

Overview

---- build/dev (CLI side) ------------------------------------------------

Instance Method Summary collapse

Instance Method Details

#boot!(port:) ⇒ Object



137
138
139
140
141
142
143
144
145
# File 'lib/everywhere/framework.rb', line 137

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)
  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_stubObject

Rails loads its bundle through config/boot.rb (with bootsnap guarded).



151
152
153
# File 'lib/everywhere/framework.rb', line 151

def boot_stub
  render_boot_stub(env_exports, "require_relative \"config/boot\"")
end

#cleanup_commandObject



129
# File 'lib/everywhere/framework.rb', line 129

def cleanup_command = "bin/rails assets:clobber"

#dev_commandObject

CLI



119
120
121
# File 'lib/everywhere/framework.rb', line 119

def dev_command
  File.exist?(File.join(root, "bin", "dev")) ? "bin/dev" : "bundle exec rails server"
end

#env_exportsObject

Install



148
# File 'lib/everywhere/framework.rb', line 148

def env_exports = { "RAILS_ENV" => "production" }

#nameObject



116
# File 'lib/everywhere/framework.rb', line 116

def name = "rails"

#precompile_commandObject



127
# File 'lib/everywhere/framework.rb', line 127

def precompile_command = "bin/rails assets:precompile"

#precompile_envObject



123
124
125
# File 'lib/everywhere/framework.rb', line 123

def precompile_env
  { "RAILS_ENV" => "production", "SECRET_KEY_BASE" => "precompile-only" }
end

#prepare_runtime_envObject

Runtime



132
133
134
135
# File 'lib/everywhere/framework.rb', line 132

def prepare_runtime_env
  ENV["RAILS_ENV"] ||= "production"
  ENV["SOLID_QUEUE_IN_PUMA"] ||= "1"
end