Module: Scide

Defined in:
lib/scide.rb,
lib/scide/opts.rb,
lib/scide/config.rb,
lib/scide/global.rb,
lib/scide/screen.rb,
lib/scide/window.rb,
lib/scide/command.rb,
lib/scide/project.rb,
lib/scide/overmind.rb,
lib/scide/commands/run.rb,
lib/scide/commands/edit.rb,
lib/scide/commands/show.rb,
lib/scide/commands/tail.rb

Overview

Generator of GNU Screen configuration files.

Defined Under Namespace

Modules: Commands Classes: Command, Config, Error, Global, Opts, Overmind, Project, Screen, Window

Constant Summary collapse

VERSION =

Current version.

File.open(File.join(File.dirname(__FILE__), '..', 'VERSION'), 'r').read
EXIT =

Exit status codes.

{
  :unexpected => 1,
  :invalid_argument => 2,
  :not_initialized => 3,
  :screen_not_found => 4,
  :config_not_found => 10,
  :config_not_readable => 11,
  :malformed_config => 12,
  :invalid_config => 13,
  :unknown_project => 14
}

Class Method Summary collapse

Class Method Details

.exit_on_failObject

Indicates whether scide is configured to exit on failure. See exit_on_fail=.



48
49
50
# File 'lib/scide.rb', line 48

def self.exit_on_fail
  @@exit_on_fail
end

.exit_on_fail=(exit_on_fail) ⇒ Object

By default, scide is meant to be used as a standalone script and exits if an error occurs. If exit_on_fail is false, a Error will be raised instead. Scide can then be used by another script.



42
43
44
# File 'lib/scide.rb', line 42

def self.exit_on_fail= exit_on_fail
  @@exit_on_fail = exit_on_fail
end

.fail(condition, msg) ⇒ Object

Prints a message on stderr and exits. If condition is a key from EXIT, the corresponding value will be used as the exit code. Otherwise, scide exits with status 1.



27
28
29
30
31
32
33
34
35
36
# File 'lib/scide.rb', line 27

def self.fail condition, msg
  if @@exit_on_fail
    puts
    warn Paint[msg, :yellow]
    puts
    EXIT.key?(condition) ? exit(EXIT[condition]) : exit(1)
  else
    raise Scide::Error.new condition, msg
  end
end