Sha256: aeca5ad4e9b0f22e359be009db78f5daf00120dc10a10a6f04731965fd700765

Contents?: true

Size: 1.97 KB

Versions: 5

Compression:

Stored size: 1.97 KB

Contents

# -*- encoding: utf-8 -*-

# RubyGems is needed at first
require 'rubygems'

# Require daemon from active_support's core_ext allows us to fork really quickly
require 'active_support/core_ext/process/daemon'

# External requirements
require 'fileutils'
require 'logger'
require 'active_record'

# Define a few pathes
ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
LIB_PATH = File.join(ROOT_PATH, 'lib', 'watch_tower')
SERVER_PATH = File.join(LIB_PATH, 'server')
MODELS_PATH = File.join(SERVER_PATH, 'models')
EXTENSIONS_PATH = File.join(SERVER_PATH, 'extensions')
MIGRATIONS_PATH = File.join(SERVER_PATH, 'db', 'migrate')
TEMPLATE_PATH = File.join(LIB_PATH, 'templates')
USER_PATH = File.expand_path(File.join(ENV['HOME'], '.watch_tower'))
DATABASE_PATH = File.join(USER_PATH, 'databases')
LOG_PATH = File.join(USER_PATH, 'log')

# Define the environment by default set to development
ENV['WATCH_TOWER_ENV'] ||= 'development'

# Make sure the USER_PATH exist
FileUtils.mkdir_p USER_PATH
FileUtils.mkdir_p DATABASE_PATH
FileUtils.mkdir_p LOG_PATH

# module WatchTower
module WatchTower

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

  # Threads
  # Hash
  @@threads = {}

  # Returh the threads
  #
  # @return [Hash] Threads
  def self.threads
    @@threads
  end

  # Get WatchTower's environment
  #
  # @return [String] The current environment
  def self.env
    ENV['WATCH_TOWER_ENV']
  end

  # Set WatchTower's environment
  #
  # @param [String] The environment
  def self.env=(environment)
    ENV['WATCH_TOWER_ENV'] = environment
  end
end

# Make sure we are running UTF-8
Encoding.default_external = 'utf-8'

# Require watch_tower's libraries
require "watch_tower/version"
require "watch_tower/errors"
require "watch_tower/core_ext"
require "watch_tower/config"
require "watch_tower/cli"
require "watch_tower/editor"
require "watch_tower/project"
require "watch_tower/eye"
require "watch_tower/file_tree"
require "watch_tower/server"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
watch_tower-0.0.1.beta5 lib/watch_tower.rb
watch_tower-0.0.1.beta4 lib/watch_tower.rb
watch_tower-0.0.1.beta3 lib/watch_tower.rb
watch_tower-0.0.1.beta2 lib/watch_tower.rb
watch_tower-0.0.1.beta1 lib/watch_tower.rb