module Nutella
Constants
- NUTELLA_HOME
- NUTELLA_TMP
Public Class Methods
This method checks that a particular command exists @return [Boolean] true if the command exists, false otherwise
# File lib/core/nutella_core.rb, line 25 def Nutella.command_exists?(command) return Nutella.const_get("Nutella::#{command.capitalize}").is_a?(Class) rescue NameError return false end
Calling this method (Nutella.config
) simply returns and instance of PersistedHash
linked to file config.json in nutella home directory
# File lib/config/config.rb, line 7 def Nutella.config PersistedHash.new( "#{ENV['HOME']}/.nutella/config.json" ) end
Calling this method (Nutella.current_app
) simply returns a reference to the CurrentAppUtils
module
# File lib/config/current_app_utils.rb, line 50 def Nutella.current_app CurrentAppUtils end
This method executes a particular command @param command [String] the name of the command @param args [Array<String>] command line parameters passed to the command
# File lib/core/nutella_core.rb, line 13 def Nutella.execute_command (command, args=nil) # Check that the command exists and if it does, # execute its run method passing the args parameters if command_exists?(command) Object::const_get("Nutella::#{command.capitalize}").new.run(args) else console.error "Unknown command #{command}" end end
This method initializes the nutella configuration file (config.json) with:
-
config_dir: directory where the configuration files are stored in
-
broker_dir: directory where the local broker is installed in
-
main_interface_port: the port used to serve interfaces
# File lib/core/nutella_core.rb, line 35 def Nutella.init Nutella.config['config_dir'] = "#{ENV['HOME']}/.nutella/" Nutella.config['broker_dir'] = "#{Nutella.config['config_dir']}broker/" Nutella.config['main_interface_port'] = 57880 end
Calling this method (Nutella.runlist
) simply returns and instance of RunListHash
linked to file runlist.json in the nutella home directory
# File lib/config/runlist.rb, line 164 def Nutella.runlist rl = RunListHash.new( "#{ENV['HOME']}/.nutella/runlist.json" ) rl.clean_list rl end