class Expedite::Env
Attributes
app_name[RW]
application_id[RW]
applications[R]
log_file[RW]
root[RW]
Public Class Methods
new(root: nil, app_name: nil, log_file: nil)
click to toggle source
# File lib/expedite/env.rb, line 11 def initialize(root: nil, app_name: nil, log_file: nil) @root = root || Dir.pwd @app_name = app_name || File.basename(@root) @log_file = log_file || File.open(File::NULL, "a") @tmp_path = nil @application_id = Digest::SHA1.hexdigest(@root) env = self @applications = Hash.new do |h, k| h[k] = ApplicationManager.new(k, env) end end
Public Instance Methods
graceful_termination_timeout()
click to toggle source
# File lib/expedite/env.rb, line 56 def graceful_termination_timeout 2 end
helper_path()
click to toggle source
# File lib/expedite/env.rb, line 60 def helper_path Pathname.new(root).join("expedite_helper.rb") end
load_helper()
click to toggle source
# File lib/expedite/env.rb, line 64 def load_helper path = helper_path if path.exist? log "loading #{path}" load(path) end end
log(message)
click to toggle source
# File lib/expedite/env.rb, line 47 def log(message) log_file.puts "[#{Time.now}] [#{Process.pid}] #{message}" log_file.flush end
pidfile_path()
click to toggle source
# File lib/expedite/env.rb, line 43 def pidfile_path tmp_path.join("#{application_id}.pid") end
server_command()
click to toggle source
# File lib/expedite/env.rb, line 52 def server_command "#{File.expand_path("../../../bin/expedite", __FILE__)} server --background" end
socket_path()
click to toggle source
# File lib/expedite/env.rb, line 39 def socket_path tmp_path.join(application_id) end
tmp_path()
click to toggle source
# File lib/expedite/env.rb, line 29 def tmp_path return @tmp_path unless @tmp_path.nil? require "tmpdir" path = Pathname.new(File.join(Dir.tmpdir, "expedite-#{Process.uid}")) require "fileutils" FileUtils.mkdir_p(path) unless path.exist? @tmp_path = path end
version()
click to toggle source
# File lib/expedite/env.rb, line 25 def version Expedite::VERSION end