lib/vedeu/runtime/bootstrap.rb in vedeu-0.5.11 vs lib/vedeu/runtime/bootstrap.rb in vedeu-0.5.12
- old
+ new
@@ -6,29 +6,25 @@
# Vedeu with this data, then starts the client application.
#
class Bootstrap
# @param argv [Array<String>]
- # @param entry_point [void]
# @return [void]
- def self.start(argv = ARGV, entry_point = nil)
- new(argv, entry_point).start
+ def self.start(argv = ARGV)
+ new(argv).start
end
# Returns a new instance of Vedeu::Bootstrap.
#
# @param argv [Array<String>]
- # @param entry_point [void]
# @return [Vedeu::Bootstrap]
- def initialize(argv, entry_point = nil)
- @argv = argv
- @entry_point = entry_point
+ def initialize(argv)
+ @argv = argv
end
# Loads all of the client application files so that Vedeu has access to
- # them, calls the 'entry_point' controller, ready to start the application,
- # then launches the client application.
+ # them, then launches the client application.
#
# @return [void]
def start
configure_log!
client_configuration!
@@ -42,14 +38,10 @@
# @!attribute [r] argv
# @return [Array<String>]
attr_reader :argv
- # @!attribute [r] entry_point
- # @return [void]
- attr_reader :entry_point
-
private
# @return [String]
def base_path
Vedeu::Configuration.base_path
@@ -78,11 +70,17 @@
].each { |path| load(File.join(base_path, path)) }
end
# @return [void]
def client_initialize!
- entry_point || root
+ if Vedeu::Configuration.root
+ Vedeu.trigger(:_goto_, *Vedeu::Configuration.root)
+
+ else
+ Vedeu.log_stderr(type: :debug, message: client_initialize_error)
+
+ end
end
# Load each of the loadable files.
#
# @param path [String]
@@ -109,12 +107,16 @@
Vedeu.configure do
log('/tmp/vedeu_bootstrap.log')
end unless Vedeu::Configuration.log?
end
- # @return [Class]
- def root
- Vedeu::Configuration.root if Vedeu::Configuration.root
+ # @return [String]
+ 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
end # Bootstrap
end # Vedeu