Module: Capricorn

Extended by:
ExceptionHandler
Defined in:
lib/capricorn.rb,
lib/capricorn/actor.rb,
lib/capricorn/client.rb,
lib/capricorn/daemon.rb,
lib/capricorn/server.rb,
lib/capricorn/system.rb,
lib/capricorn/apps/dev.rb,
lib/capricorn/apps/jobs.rb,
lib/capricorn/job_queue.rb,
lib/capricorn/satellite.rb,
lib/capricorn/app_runner.rb,
lib/capricorn/apps/server.rb,
lib/capricorn/apps/engines.rb,
lib/capricorn/server/proxy.rb,
lib/capricorn/system/shell.rb,
lib/capricorn/actor/actions.rb,
lib/capricorn/server/daemon.rb,
lib/capricorn/system/config.rb,
lib/capricorn/system/helper.rb,
lib/capricorn/apps/satellite.rb,
lib/capricorn/system/options.rb,
lib/capricorn/server/security.rb,
lib/capricorn/actors/base_actor.rb,
lib/capricorn/client/auth_token.rb,
lib/capricorn/exception_handler.rb,
lib/capricorn/satellite/actions.rb,
lib/capricorn/system/satellites.rb,
lib/capricorn/actors/mysql_actor.rb,
lib/capricorn/actors/plesk_actor.rb,
lib/capricorn/actors/apache_actor.rb,
lib/capricorn/system/process_user.rb,
lib/capricorn/actors/sqlite3_actor.rb,
lib/capricorn/satellite/persistence.rb,
lib/capricorn/actors/passenger_actor.rb,
lib/capricorn/satellite/dependency_loader.rb

Defined Under Namespace

Modules: Actors, Apps, Daemon, ExceptionHandler Classes: Actor, AppRunner, Client, JobQueue, Satellite, Server, System

Constant Summary collapse

DEFAULT_ROOT_SYSTEM_DIR =
'/var/capricorn'
DEFAULT_USER_SYSTEM_DIR =
'~/.capricorn'
STOP_STATUS =
101
RESTART_STATUS =
102
RELOAD_STATUS =
103
QUICK_CERT =
"http://segment7.net/projects/ruby/QuickCert/QuickCert-1.0.2.tar.gz"
THOR_VERSION =
'>= 0.9.9'
RUBIGEN_VERSION =
'>= 1.5.2'

Class Method Summary collapse

Methods included from ExceptionHandler

err, log, logger, out, redirect_std, report, setup, stderr, stdout

Class Method Details

.client(token = nil) ⇒ Object



59
60
61
62
63
64
65
66
67
68
# File 'lib/capricorn.rb', line 59

def self.client(token=nil)
  unless @client
    @client = Capricorn::Client.current(token)
    unless @client
      puts "Failed to connect to the capricorn!"
      exit(1)
    end
  end
  @client
end

.runtime_gem(gem, version = '>= 0.0.0', lib = nil) ⇒ Object



90
91
92
93
94
95
96
97
98
# File 'lib/capricorn.rb', line 90

def self.runtime_gem(gem, version='>= 0.0.0', lib=nil)
  begin
    gem(gem, version)
    require(lib || gem)
  rescue LoadError
    puts "You must install #{gem} (#{version}) to use this.\nPlease run: [sudo] gem install #{gem}"
    exit(1)
  end
end

.server?(value = nil) ⇒ Boolean

Returns:

  • (Boolean)


85
86
87
88
# File 'lib/capricorn.rb', line 85

def self.server?(value=nil)
  @is_server = value unless value.nil?
  @is_server
end

.systemObject



70
71
72
# File 'lib/capricorn.rb', line 70

def self.system
  @system ||= Capricorn::System.shared
end

.versionObject



74
75
76
77
78
79
80
81
82
83
# File 'lib/capricorn.rb', line 74

def self.version
  unless @version
    if __FILE__ =~ /\/capricorn-([^\/]+)\//
      @version = $1
    else
      @version = 'edge'
    end
  end
  @version
end