Module: Gitosis

Extended by:
Gitosis
Included in:
Gitosis
Defined in:
lib/gitosis_easy_conf/groups.rb,
lib/gitosis_easy_conf.rb,
lib/gitosis_easy_conf/config.rb,
lib/gitosis_easy_conf/forkers.rb,
lib/gitosis_easy_conf/repositories.rb

Overview

Define a mapping from a Gitosis user and their public key. Here the use of string and symbol are unimportant, i.e.

Gitosis.forkers do
   fubar :key_one
   fubar "key_one"
end

are equivalent.

Defined Under Namespace

Classes: Config, Forker, Group, Repository

Constant Summary collapse

EmptyConfig =
{
  :writable => [], :readable => [], :forks => []
}

Instance Method Summary collapse

Instance Method Details

#config(&block) ⇒ Object

Configuration verbs – config, forkers, groups (or roles) and repositories.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gitosis_easy_conf.rb', line 19

def config(&block)
  if block_given?
    if defined?(@@config)
      @@config.instance_eval(&block)
    else
      @@config = Config.new(&block)
    end
  else
    @@config ||= Config.new(){}
  end
end

#forkers(&block) ⇒ Object



31
32
33
# File 'lib/gitosis_easy_conf.rb', line 31

def forkers(&block)
  block_given? ? @@forkers = Forker.new(&block) : (@@forkers ||= nil)
end

#groups(&block) ⇒ Object Also known as: roles



35
36
37
# File 'lib/gitosis_easy_conf.rb', line 35

def groups(&block)
  block_given? ? @@groups = Group.new(&block).denormalize : (@@groups ||= nil)
end

#repositories(&block) ⇒ Object



40
41
42
# File 'lib/gitosis_easy_conf.rb', line 40

def repositories(&block)
  block_given? ? @@repository = Repository.new(&block) : @@repository
end

#setup(filename = nil, &block) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/gitosis_easy_conf.rb', line 44

def setup(filename = nil, &block)
  config do
    filename filename
  end

  class_eval(&block)
  repositories.write
end