Sha256: 712ef7edd9d5669383fe92e3e27177e432efc7cf928d185a689095379b9d20bf

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

# communicate!
require 'socket'
require 'osc-ruby'

# data from QLab
require 'json'

require 'qcmd/version'
require 'qcmd/plaintext'
require 'qcmd/commands'
require 'qcmd/input_completer'
require 'qcmd/core_ext/array'
require 'qcmd/core_ext/osc/message'
require 'qcmd/core_ext/osc/tcp_client'

module Qcmd
  autoload :Configuration, 'qcmd/configuration'
  autoload :History, 'qcmd/history'
  autoload :Handler, 'qcmd/handler'
  autoload :Server, 'qcmd/server'
  autoload :Context, 'qcmd/context'
  autoload :Parser, 'qcmd/parser'
  autoload :CLI, 'qcmd/cli'
  autoload :Machine, 'qcmd/machine'
  autoload :Network, 'qcmd/network'
  autoload :QLab, 'qcmd/qlab'
  autoload :VERSION, 'qcmd/version'
  autoload :Action, 'qcmd/action'
  autoload :Aliases, 'qcmd/aliases'

  # on launch

  class << self
    include Qcmd::Plaintext

    attr_accessor :log_level
    attr_accessor :debug_mode
    attr_accessor :context

    def verbose!
      self.log_level = :debug
    end

    def quiet!
      self.log_level = :warning
    end

    def silent!
      self.log_level = :none
    end

    def silent?
      self.log_level == :none
    end

    def quiet?
      self.log_level == :warning
    end

    def while_quiet
      previous_level = self.log_level
      self.log_level = :warning
      yield
      self.log_level = previous_level
    end

    def debug?
      !!debug_mode
    end

    def debug message
      # always write to log

      Qcmd::Configuration.log.puts "[%s] %s" % [Time.now.strftime('%T'), message]

      log(message) if log_level == :debug
    end

    def connected?
      !!context && !!context.machine && !context.machine.nil?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qcmd-0.1.8 lib/qcmd.rb