Module: Nutella

Defined in:
lib/core/command.rb,
lib/core/tmux.rb,
lib/config/config.rb,
lib/config/project.rb,
lib/config/runlist.rb,
lib/cli/nutella_cli.rb,
lib/core/commands/new.rb,
lib/core/nutella_core.rb,
lib/nutella_framework.rb,
lib/core/commands/help.rb,
lib/core/commands/runs.rb,
lib/core/commands/stop.rb,
lib/core/commands/start.rb,
lib/core/commands/broker.rb,
lib/core/commands/checkup.rb,
lib/core/commands/install.rb,
lib/logging/nutella_logger.rb,
lib/logging/nutella_logging.rb,
lib/logging/nutella_logger-remote.rb

Overview

CLI command

Defined Under Namespace

Classes: Broker, Checkup, Command, ConfigHash, Help, Install, New, NutellaCLI, NutellaLogger, NutellaLoggerRemote, NutellaLogging, Project, RunList, Runs, Start, Stop, Tmux

Constant Summary collapse

NUTELLA_HOME =
File.dirname(__FILE__)+"/../"

Class Method Summary collapse

Class Method Details

.commandExists?(command) ⇒ Boolean

Check that a command exists

Returns:

  • (Boolean)


19
20
21
22
23
# File 'lib/core/nutella_core.rb', line 19

def Nutella.commandExists?(command)
  return Nutella.const_get("Nutella::#{command.capitalize}").is_a?(Class)
rescue NameError
  return false
end

.configObject



69
70
71
# File 'lib/config/config.rb', line 69

def Nutella.config
  ConfigHash.new(File.dirname(__FILE__)+"/../../config.json")
end

.currentProjectObject



46
47
48
# File 'lib/config/project.rb', line 46

def Nutella.currentProject
  Project.instance
end

.executeCommand(command, args = nil) ⇒ Object

Execute command. Returns nil if all is good, otherwise it exceptions out



9
10
11
12
13
14
15
16
# File 'lib/core/nutella_core.rb', line 9

def Nutella.executeCommand (command, args=nil) 
  # Check that the command exists
  if commandExists?(command)
    Object::const_get("Nutella::#{command.capitalize}").new.run(args)
  else
    console.error "Unknown command #{command}"
  end
end

.initObject

Initialize



26
27
28
29
30
# File 'lib/core/nutella_core.rb', line 26

def Nutella.init
  Nutella.config["nutella_home"] = NUTELLA_HOME
  Nutella.config["tmp_dir"] = NUTELLA_HOME+".tmp"
  Nutella.config["broker_dir"] = NUTELLA_HOME+"broker"
end

.runlistObject



92
93
94
# File 'lib/config/runlist.rb', line 92

def Nutella.runlist
  RunList.instance
end