class Uc::Unicorn::Config

Attributes

config[R]
paths[R]

Public Class Methods

new(config_hash, paths) click to toggle source
# File lib/uc/unicorn/config.rb, line 14
def initialize(config_hash, paths)
  @config = config_hash
  @paths = paths
end

Public Instance Methods

generate_config_file() click to toggle source
# File lib/uc/unicorn/config.rb, line 24
def generate_config_file
  erb = ERB.new(File.read(paths.unicorn_template))
  binding = Kernel.binding
  File.open(paths.unicorn_config, 'w') do |f|
    f.write erb.result(binding)
  end 
  return true
rescue => e
  logger.debug e.message
  raise ::Uc::Error, "unable to generate unicorn config"
end
generate_once() click to toggle source
# File lib/uc/unicorn/config.rb, line 36
def generate_once
  return if @config_generated
  generate_config_file
  @config_generated = true
end
path() click to toggle source
# File lib/uc/unicorn/config.rb, line 19
def path
  generate_once
  paths.unicorn_config
end