Module: WatchTower

Extended by:
WatchTower
Included in:
WatchTower
Defined in:
lib/watch_tower.rb,
lib/watch_tower/cli.rb,
lib/watch_tower/eye.rb,
lib/watch_tower/config.rb,
lib/watch_tower/editor.rb,
lib/watch_tower/errors.rb,
lib/watch_tower/server.rb,
lib/watch_tower/project.rb,
lib/watch_tower/version.rb,
lib/watch_tower/cli/open.rb,
lib/watch_tower/cli/start.rb,
lib/watch_tower/file_tree.rb,
lib/watch_tower/editor/vim.rb,
lib/watch_tower/server/app.rb,
lib/watch_tower/cli/install.rb,
lib/watch_tower/cli/version.rb,
lib/watch_tower/editor/xcode.rb,
lib/watch_tower/project/init.rb,
lib/watch_tower/editor/base_ps.rb,
lib/watch_tower/server/helpers.rb,
lib/watch_tower/editor/textmate.rb,
lib/watch_tower/server/database.rb,
lib/watch_tower/project/any_based.rb,
lib/watch_tower/project/git_based.rb,
lib/watch_tower/server/presenters.rb,
lib/watch_tower/project/path_based.rb,
lib/watch_tower/server/models/file.rb,
lib/watch_tower/server/helpers/asset.rb,
lib/watch_tower/editor/base_appscript.rb,
lib/watch_tower/server/configurations.rb,
lib/watch_tower/server/models/project.rb,
lib/watch_tower/server/models/duration.rb,
lib/watch_tower/server/models/time_entry.rb,
lib/watch_tower/server/helpers/presenters.rb,
lib/watch_tower/server/configurations/asset.rb,
lib/watch_tower/server/helpers/improved_partials.rb,
lib/watch_tower/server/presenters/file_presenter.rb,
lib/watch_tower/server/presenters/project_presenter.rb,
lib/watch_tower/server/presenters/application_presenter.rb

Overview

module WatchTower

Defined Under Namespace

Modules: CLI, Config, Editor, Eye, Server Classes: FileTree, Project

Constant Summary collapse

LOG =

Create a logger

Logger.new(File.join(LOG_PATH, "#{ENV['WATCH_TOWER_ENV']}.log"))
WatchTowerError =

Global Error

Class.new Exception
ProjectError =

Exceptions raised by the Project module

Class.new WatchTowerError
FileNotFound =
Class.new ProjectError
PathError =

Exception raised by the Path module

Class.new ProjectError
PathNotUnderCodePath =
Class.new PathError
AppscriptNotLoadedError =

Appscript errors

Class.new WatchTowerError
EditorError =

Exception raised by the Editor module

Class.new WatchTowerError
TextmateError =
Class.new EditorError
XcodeError =
Class.new EditorError
VimError =
Class.new EditorError
VimVersionNotPrinted =
Class.new VimError
ServerError =

Exceptions raised by the Server module

Class.new WatchTowerError
DatabaseError =
Class.new ServerError
DatabaseConfigNotFoundError =
Class.new DatabaseError
EyeError =

Exceptions raised by the Eye module

Class.new WatchTowerError
ConfigError =

Exceptions raised by the Config module

Class.new WatchTowerError
ConfigNotReadableError =
Class.new ConfigError
ConfigNotFound =
Class.new ConfigError
ConfigNotDefinedError =
Class.new ConfigError
ConfigNotValidError =
Class.new ConfigError
MAJOR =
0
MINOR =
0
TINY =
3
PRE =
''
@@threads =

Threads Hash

{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.versionObject



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

def self.version
  # Init the version
  version = [MAJOR, MINOR, TINY]
  # Add the pre if available
  version << PRE unless PRE.nil? || PRE !~ /\S/
  # Return the version joined by a dot
  version.join('.')
end

Instance Method Details

#envString

Get WatchTower’s environment

Returns:

  • (String)

    The current environment



60
61
62
# File 'lib/watch_tower.rb', line 60

def env
  ENV['WATCH_TOWER_ENV']
end

#env=(environment) ⇒ Object

Set WatchTower’s environment

Parameters:

  • The (String)

    environment



67
68
69
# File 'lib/watch_tower.rb', line 67

def env=(environment)
  ENV['WATCH_TOWER_ENV'] = environment
end

#threadsHash

Returh the threads

Returns:

  • (Hash)

    Threads



53
54
55
# File 'lib/watch_tower.rb', line 53

def threads
  @@threads
end

#which(cmd) ⇒ Object

Cross-platform way of finding an executable in the $PATH.

Taken from hub github.com/defunkt/hub/blob/master/lib/hub/context.rb#L186

which(‘ruby’) #=> /usr/bin/ruby



77
78
79
80
81
82
83
84
85
86
# File 'lib/watch_tower.rb', line 77

def which(cmd)
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
    exts.each { |ext|
      exe = "#{path}/#{cmd}#{ext}"
      return exe if File.executable? exe
    }
  end
  return nil
end