Module: Exekutor::Internal::CLI::ApplicationLoader
Overview
Helper methods to load the Rails application
Constant Summary collapse
- LOADING_MESSAGE =
The message to print when loading the Rails application
"Loading Rails environment…"
Instance Method Summary collapse
-
#clear_application_loading_message ⇒ Object
Clears the loading message if it was printed.
-
#different_time_zone? ⇒ Boolean
Whether the system time zone differs from the app time zone.
-
#load_application(environment, path = "config/environment.rb", print_message: false) ⇒ Object
Loads the Rails application.
-
#print_time_zone_warning ⇒ Object
Prints a message to STDOUT indicating in which time zone times are printed.
Instance Method Details
#clear_application_loading_message ⇒ Object
Clears the loading message if it was printed
28 29 30 31 32 33 |
# File 'lib/exekutor/internal/cli/application_loader.rb', line 28 def return unless @loading_message_printed printf "\r#{" " * LOADING_MESSAGE.length}\r" @loading_message_printed = false end |
#different_time_zone? ⇒ Boolean
Returns Whether the system time zone differs from the app time zone.
36 37 38 |
# File 'lib/exekutor/internal/cli/application_loader.rb', line 36 def different_time_zone? Time.zone.name != Time.new.zone end |
#load_application(environment, path = "config/environment.rb", print_message: false) ⇒ Object
Loads the Rails application
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/exekutor/internal/cli/application_loader.rb', line 15 def load_application(environment, path = "config/environment.rb", print_message: false) return if @application_loaded if printf LOADING_MESSAGE @loading_message_printed = true end ENV["RAILS_ENV"] = environment unless environment.nil? require File.(path) @application_loaded = true end |
#print_time_zone_warning ⇒ Object
Prints a message to STDOUT indicating in which time zone times are printed
41 42 43 |
# File 'lib/exekutor/internal/cli/application_loader.rb', line 41 def print_time_zone_warning puts "(times are printed in the #{Time.zone.name} time zone)\n\n" end |