Sha256: f4c3eb89ff584bc673eb0b4b114f5d28748e283b501c604cf872c4c40aec2510
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require 'ostruct' module Bluepill def self.application(app_name, options = {}, &block) app = Application.new(app_name.to_s, options, &block) process_proxy = Class.new do attr_reader :attributes, :watches def initialize @attributes = {} @watches = {} end def method_missing(name, *args) if args.size == 1 && name.to_s =~ /^(.*)=$/ @attributes[$1.to_sym] = args.first else super end end def checks(name, options = {}) @watches[name] = options end end app_proxy = Class.new do @@app = app @@process_proxy = process_proxy def process(process_name, &process_block) process_proxy = @@process_proxy.new process_block.call(process_proxy) group = process_proxy.attributes.delete(:group) process = Bluepill::Process.new(process_name, process_proxy.attributes) process_proxy.watches.each do |name, opts| process.add_watch(name, opts) end @@app.add_process(process, group) end end yield(app_proxy.new) app.load end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bluepill-0.0.2 | lib/bluepill/dsl.rb |
bluepill-0.0.1 | lib/bluepill/dsl.rb |