Class: Vedeu::Runtime::Bootstrap Private
- Inherits:
-
Object
- Object
- Vedeu::Runtime::Bootstrap
- Defined in:
- lib/vedeu/runtime/bootstrap.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the mechanism to start up a generated application.
This class loads all necessary client application files and initializes Vedeu with this data, then starts the client application.
Instance Attribute Summary collapse
- #argv ⇒ Array<String> readonly protected private
Class Method Summary collapse
- .start(argv = ARGV) ⇒ void private
Instance Method Summary collapse
- #base_path ⇒ String private private
- #client_application! ⇒ void private private
- #client_configuration! ⇒ void private private
- #client_initialize! ⇒ void private private
- #client_initialize_error ⇒ String private private
- #configure_log! ⇒ void private private
-
#initialize(argv) ⇒ Vedeu::Runtime::Bootstrap
constructor
private
Returns a new instance of Vedeu::Runtime::Bootstrap.
-
#load(path) ⇒ String
private
private
Load each of the loadable files.
-
#loadables(path) ⇒ Array<String>
private
private
Collect each of the files from the client application directories by path excluding ‘.’ and ‘..’ and only loading files with the ‘.rb’ extension.
-
#start ⇒ void
private
Loads all of the client application files so that Vedeu has access to them, then launches the client application.
Constructor Details
#initialize(argv) ⇒ Vedeu::Runtime::Bootstrap
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Vedeu::Runtime::Bootstrap.
27 28 29 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 27 def initialize(argv) @argv = argv end |
Instance Attribute Details
#argv ⇒ Array<String> (readonly, protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 48 def argv @argv end |
Class Method Details
.start(argv = ARGV) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
19 20 21 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 19 def self.start(argv = ARGV) new(argv).start end |
Instance Method Details
#base_path ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 53 def base_path Vedeu.config.base_path end |
#client_application! ⇒ void (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 70 def client_application! [ 'app/views/templates/**/*', 'app/views/interfaces/**/*', 'app/controllers/**/*', 'app/helpers/**/*', 'app/views/**/*', 'app/models/keymaps/**/*', ].each { |path| load(File.join(base_path, path)) } end |
#client_configuration! ⇒ void (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
config/configuration.rb is already loaded so don’t load it twice.
This method returns an undefined value.
61 62 63 64 65 66 67 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 61 def client_configuration! Dir[File.join(base_path, 'config/**/*')].each do |path| next if path =~ %r{config/configuration\.rb} load(path) end end |
#client_initialize! ⇒ void (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
82 83 84 85 86 87 88 89 90 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 82 def client_initialize! if Vedeu.config.root Vedeu.trigger(:_goto_, *Vedeu.config.root) else Vedeu.log_stderr(message: client_initialize_error) end end |
#client_initialize_error ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
122 123 124 125 126 127 128 129 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 122 def client_initialize_error "Please update the 'root' setting in " \ "'config/configuration.rb' to start Vedeu using this " \ "controller and action: (args are optional)\n\n" \ "Vedeu.configure do\n" \ " root :some_controller, :show, *args\n" \ "end\n\n" end |
#configure_log! ⇒ void (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
115 116 117 118 119 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 115 def configure_log! Vedeu.configure do log(Dir.tmpdir + '/vedeu_bootstrap.log') end unless Vedeu.config.log? end |
#load(path) ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Load each of the loadable files.
96 97 98 99 100 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 96 def load(path) loadables(path).each { |file| Kernel.load(file) } path end |
#loadables(path) ⇒ Array<String> (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Collect each of the files from the client application directories by path excluding ‘.’ and ‘..’ and only loading files with the ‘.rb’ extension.
108 109 110 111 112 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 108 def loadables(path) Dir.glob(path).select do |file| File.file?(file) && File.extname(file) == '.rb' end end |
#start ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Loads all of the client application files so that Vedeu has access to them, then launches the client application.
35 36 37 38 39 40 41 42 |
# File 'lib/vedeu/runtime/bootstrap.rb', line 35 def start configure_log! client_configuration! client_application! client_initialize! Vedeu::Launcher.execute!(argv) end |