Module: CSD

Defined in:
lib/csd.rb,
lib/csd/error.rb,
lib/csd/version.rb,
lib/csd/commands.rb,
lib/csd/container.rb,
lib/csd/applications.rb,
lib/csd/path_container.rb,
lib/csd/options_parser.rb,
lib/csd/application/mslog.rb,
lib/csd/application/i2conf.rb,
lib/csd/user_interface/cli.rb,
lib/csd/user_interface/base.rb,
lib/csd/application/minisip.rb,
lib/csd/extensions/core/dir.rb,
lib/csd/application/default.rb,
lib/csd/application/graphics.rb,
lib/csd/application/decklink.rb,
lib/csd/vendor/term/ansicolor.rb,
lib/csd/extensions/core/array.rb,
lib/csd/user_interface/silent.rb,
lib/csd/application/mslog/base.rb,
lib/csd/extensions/core/object.rb,
lib/csd/extensions/core/string.rb,
lib/csd/extensions/gem/platform.rb,
lib/csd/application/i2conf/base.rb,
lib/csd/application/minisip/base.rb,
lib/csd/application/minisip/unix.rb,
lib/csd/extensions/core/pathname.rb,
lib/csd/application/default/base.rb,
lib/csd/application/decklink/base.rb,
lib/csd/application/minisip/error.rb,
lib/csd/application/graphics/base.rb,
lib/csd/application/graphics/error.rb,
lib/csd/extensions/core/open_struct.rb,
lib/csd/extensions/core/option_parser.rb,
lib/csd/application/minisip/unix/linux.rb,
lib/csd/application/minisip/unix/darwin.rb,
lib/csd/vendor/active_support/inflector.rb,
lib/csd/application/i2conf/config_example.rb,
lib/csd/application/minisip/component/x264.rb,
lib/csd/application/minisip/component/core.rb,
lib/csd/application/minisip/component/gnome.rb,
lib/csd/application/minisip/component/ffmpeg.rb,
lib/csd/application/minisip/component/network.rb,
lib/csd/application/minisip/component/hdviper.rb,
lib/csd/application/minisip/phonebook_example.rb,
lib/csd/application/minisip/component/plugins.rb,
lib/csd/application/minisip/unix/linux/debian.rb,
lib/csd/vendor/active_support/object_extensions.rb,
lib/csd/application/minisip/component/core_packaging.rb,
lib/csd/application/minisip/unix/linux/debian/ubuntu10.rb

Overview

The CSD namespace is given to the entire gem. It stands for Communication Systems Design (see www.tslab.ssvl.kth.se/csd).

Defined Under Namespace

Modules: Application, Error, Extensions, UserInterface, Vendor Classes: Applications, Cmd, CommandResult, Commands, Options, OptionsParser, Path, PathContainer, UI

Constant Summary

Version =

This global variable holds the version number of this gem by trying to read the VERSION file. If the VERSION file cannot be read, it will be defined to 0.0.0 as a fallback. Ideally it would be hardcoded in this file, because it cannot be guaranteed that the VERSION file exists (see weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices). But we use it anyway, because Jeweler (a gem to create gems more easily) needs it and the risk is not that big.

VERSION = begin
  File.read(File.join(Path.gem, 'VERSION'))
rescue Errno::ENOENT => e
  UI.debug "The VERSION file could not be found. Setting `VersionĀ“ to 0.0.0"
  '0.0.0'
end

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Class Attribute Details

+ (Object) executable (readonly)

This String holds the name of the executable the user used to execute/bootstrap this gem. It is useful for showing example commands to the end-user, such as "Please type: ai install minisip". Because the name of the executable might change after some time. Currently, ai and ttai are supported executables.



17
18
19
# File 'lib/csd.rb', line 17

def executable
  @executable
end

Class Method Details

+ (Object) bootstrap(options = {})

This method "runs" the whole CSD gem, so to speak.

Options

The following options can be passed as a hash.

:executable

A String which holds the name of the exectuable that was used to call this method (default: [EXECUTABLE]).



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/csd.rb', line 27

def bootstrap(options={})
  # Storing the important options into instance variables
  @executable = options[:executable] || '[EXECUTABLE]'
  # Reading the command-line arguments
  Options.parse!
  # Intercepting and processing AI-internal commands such as "ai update" and "ai edge"
  respond_to_internal_ai_options
  # Ensure that the chosen action, application (and optionally the scope) are valid
  respond_to_incomplete_arguments
  UI.debug "#{self}.bootstrap initializes the task #{Options.action.to_s.enquote if Options.action} of the application #{Applications.current.name.to_s.enquote if Applications.current} now"
  # Passing on the desired action to the instance of the chosen application module (e.g. passing on "install" to the "MiniSIP" module)
  Applications.current.instance.send("#{Options.action}".to_sym) if Applications.current
end

+ (Object) cmd

This method chooses and holds the command helper instance.



17
18
19
# File 'lib/csd/container.rb', line 17

def cmd
  @@cmd ||= Commands.new
end

+ (Object) options

This method chooses and holds the container for argument options.



29
30
31
# File 'lib/csd/container.rb', line 29

def options
  @@options ||= OptionsParser.new
end

+ (Object) path

This method chooses and holds the container for paths.



23
24
25
# File 'lib/csd/container.rb', line 23

def path
  @@path ||= PathContainer.new
end

+ (Object) ui

This method holds the user interface instance.



8
9
10
11
12
13
# File 'lib/csd/container.rb', line 8

def ui
  # In testmode we don't want to perform caching
  return choose_ui if Options.testmode
  # Otherwise we choose and cache the UI here
  @@ui ||= choose_ui
end