summaryrefslogtreecommitdiff
path: root/lib/rcm.rb
blob: d9880eb6f1912636576c74c24e7d5ee79d6ca215 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Dir["#{Dir.pwd}/lib/autorequire/*.rb"].each { |m| require m }

# Ruby Configiration Management system
module RCM
  # Here all starts
  class RCM
    @@rcm_counter = 0

    include Config
    include Options
    include Log

    def initialize
      @objs = []
      @conds_met = true
      @@rcm_counter += 1
      @number = @@rcm_counter
    end

    def to_s
      "RCM #{@number}"
    end

    def do!
      @objs.each(&:do!)
    end

    def <<(obj)
      @objs << obj
    end
  end
end

def make_it_so(&block)
  rcm = RCM::RCM.new
  rcm.info('Making it so...')
  rcm.instance_eval(&block)
  rcm.do!
end