Class: Uc::Unicorn::Config
- Inherits:
-
Object
- Object
- Uc::Unicorn::Config
- Includes:
- Logger
- Defined in:
- lib/uc/unicorn/config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
- #generate_config_file ⇒ Object
- #generate_once ⇒ Object
-
#initialize(config_hash, paths) ⇒ Config
constructor
A new instance of Config.
- #path ⇒ Object
Methods included from Logger
#event_queue, event_stream, #event_stream, logger, #logger, stderr, #stderr
Constructor Details
#initialize(config_hash, paths) ⇒ Config
Returns a new instance of Config.
14 15 16 17 |
# File 'lib/uc/unicorn/config.rb', line 14 def initialize(config_hash, paths) @config = config_hash @paths = paths end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/uc/unicorn/config.rb', line 12 def config @config end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
12 13 14 |
# File 'lib/uc/unicorn/config.rb', line 12 def paths @paths end |
Instance Method Details
#generate_config_file ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# 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. raise ::Uc::Error, "unable to generate unicorn config" end |
#generate_once ⇒ Object
36 37 38 39 40 |
# File 'lib/uc/unicorn/config.rb', line 36 def generate_once return if @config_generated generate_config_file @config_generated = true end |
#path ⇒ Object
19 20 21 22 |
# File 'lib/uc/unicorn/config.rb', line 19 def path generate_once paths.unicorn_config end |