Class: Jets::Booter
- Inherits:
-
Object
- Object
- Jets::Booter
- Defined in:
- lib/jets/booter.rb
Class Method Summary collapse
-
.app_initializers ⇒ Object
All Turbines.
- .boot! ⇒ Object
- .check_config_ru! ⇒ Object
- .check_old_jets_code! ⇒ Object
-
.confirm_jets_project! ⇒ Object
Cannot call this for the jets new We check that within a jets project again as Jets.boot Also checked in the jets/cli.rb more generally.
- .load_internal_engine ⇒ Object
- .message ⇒ Object
- .require_application! ⇒ Object
Class Method Details
.app_initializers ⇒ Object
All Turbines
36 37 38 39 40 |
# File 'lib/jets/booter.rb', line 36 def app_initializers Dir.glob("#{Jets.root}/config/initializers/**/*").sort.each do |path| load path end end |
.boot! ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jets/booter.rb', line 6 def boot! return if @booted confirm_jets_project! # Registration phase Jets::Bundle.require # engine config and register initializers load_internal_engine # internal engine initializers require_application! # override with user customizations # Run phase Jets.application.initialize! @booted = true end |
.check_config_ru! ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/jets/booter.rb', line 67 def check_config_ru! config_ru = File.read("#{Jets.root}/config.ru") unless config_ru.include?("Jets.boot") puts 'The config.ru file is missing Jets.boot. Please add Jets.boot after require "jets"'.color(:red) puts "This was changed as made in Jets v1.1.0." puts "To have Jets update the config.fu file for you, you can run:\n\n" puts " jets-upgrade" exit 1 end end |
.check_old_jets_code! ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/jets/booter.rb', line 53 def check_old_jets_code! application_rb = "#{Jets.root}/config/application.rb" return unless File.exist?(application_rb) return if File.read(application_rb).include?(' < Jets::Application') puts "ERROR: Based on config/application.rb, it looks like your app code was written with an older version of Jets.".color(:red) puts "Please install and run the jets-upgrade command to upgrade your project." puts " jets-upgrade go".color(:green) exit 1 end |
.confirm_jets_project! ⇒ Object
Cannot call this for the jets new We check that within a jets project again as Jets.boot Also checked in the jets/cli.rb more generally
45 46 47 48 49 50 51 |
# File 'lib/jets/booter.rb', line 45 def confirm_jets_project! return if defined?(ENGINE_PATH) unless File.exist?("#{Jets.root}/config/application.rb") puts "It does not look like you are running this command within a jets project. Please confirm that you are in a jets project and try again.".color(:red) exit 1 end end |
.load_internal_engine ⇒ Object
31 32 33 |
# File 'lib/jets/booter.rb', line 31 def load_internal_engine require File.("../../engines/internal/lib/internal/engine.rb", __dir__) end |