Class: Initd::MonitConfig
- Inherits:
-
Object
- Object
- Initd::MonitConfig
- Defined in:
- lib/initd/monit_config.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(app, path) ⇒ MonitConfig
constructor
A new instance of MonitConfig.
- #name ⇒ Object
- #pidfile ⇒ Object
- #templates_dir ⇒ Object
Constructor Details
#initialize(app, path) ⇒ MonitConfig
Returns a new instance of MonitConfig.
9 10 11 12 |
# File 'lib/initd/monit_config.rb', line 9 def initialize(app, path) @app = app @path = path end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
3 4 5 |
# File 'lib/initd/monit_config.rb', line 3 def app @app end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/initd/monit_config.rb', line 3 def path @path end |
Instance Method Details
#content ⇒ Object
22 23 24 25 |
# File 'lib/initd/monit_config.rb', line 22 def content template = templates_dir.join('monit_config.erb') ERB.new(template.read, nil, '<>').result(binding) end |
#name ⇒ Object
14 15 16 |
# File 'lib/initd/monit_config.rb', line 14 def name @path.basename.to_s end |
#pidfile ⇒ Object
18 19 20 |
# File 'lib/initd/monit_config.rb', line 18 def pidfile Pathname.new('/var/run').join(name).join("#{name}.pid") end |
#templates_dir ⇒ Object
5 6 7 |
# File 'lib/initd/monit_config.rb', line 5 def templates_dir Pathname.new(__FILE__).dirname.dirname.dirname.join('templates') end |