Class: ProjectGroup::Configs

Inherits:
Object
  • Object
show all
Defined in:
lib/project_group/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.group(name, &b) ⇒ Object



93
94
95
# File 'lib/project_group/config.rb', line 93

def group(name,&b)
  instance.group(name,&b)
end

.project(name, &b) ⇒ Object



90
91
92
# File 'lib/project_group/config.rb', line 90

def project(name,&b)
  instance.project(name,&b)
end

Instance Method Details

#group(name, &b) ⇒ Object



72
73
74
75
76
77
# File 'lib/project_group/config.rb', line 72

def group(name,&b)
  c = GroupWrapper.new(Group.new(:name => name))
  c.configs = self
  b[c]
  self.group_configs << c
end

#load!Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/project_group/config.rb', line 45

def load!
  Dir["#{dir}/*.rb"].each do |f|
    load f
  end
  global_groups = group_configs.clone

  locals = ["#{Dir.getwd}/.project_group.rb","#{Dir.getwd}/.project_group"]
  locals.each do |f|
    if FileTest.exist?(f)
      load(f) 
      local_groups = group_configs - global_groups
      local_groups.first.local = true if local_groups.size > 0
    end
  end
end

#local_groupObject



79
80
81
82
# File 'lib/project_group/config.rb', line 79

def local_group
  local_config = group_configs.find { |x| x.local }
  local_config.andand.loaded_group
end

#project(name, &b) ⇒ Object



66
67
68
69
70
# File 'lib/project_group/config.rb', line 66

def project(name,&b)
  c = DSLWrapper.new(Single.new(:name => name))
  b[c]
  self.projects << c.obj
end