Sha256: a6a7e09b5d805667cbb0566a8202e6a2fae81027810ad168af7617f1f82d4866

Contents?: true

Size: 960 Bytes

Versions: 2

Compression:

Stored size: 960 Bytes

Contents

# Include all commands
Dir[File.dirname(__FILE__)+"/commands/*.rb"].each do |file|
  require "core/commands/#{File.basename(file, File.extname(file))}"
end

module Nutella
      
    # Execute command. Returns nil if all is good, otherwise it exceptions out
    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
    
    # Check that a command exists
    def Nutella.commandExists?(command)
      return Nutella.const_get("Nutella::#{command.capitalize}").is_a?(Class)
    rescue NameError
      return false
    end
    
    # Initialize
    def Nutella.init
      Nutella.config["nutella_home"] = NUTELLA_HOME
      Nutella.config["tmp_dir"] = NUTELLA_HOME+".tmp"
      Nutella.config["broker_dir"] = NUTELLA_HOME+"broker"
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nutella_framework-0.1.2 lib/core/nutella_core.rb
nutella_framework-0.1.0 lib/core/nutella_core.rb