gemtronics 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,10 +5,14 @@ module Gemtronics
5
5
  #
6
6
  # See Gemtronics::Manager for more details on creating a group.
7
7
  class Grouper
8
+ # The name of this group
9
+ attr_accessor :name
8
10
  # The Array of gems belonging to this group.
9
11
  attr_accessor :gems
10
12
  # A Hash representing the default options for this group.
11
13
  attr_accessor :group_options
14
+ # An Array containing the names of the dependents of this group.
15
+ attr_accessor :dependents
12
16
 
13
17
  # Creates a new Gemtronics::Grouper class. It takes a Hash
14
18
  # of options that will be applied to all gems added to the group.
@@ -29,8 +33,10 @@ module Gemtronics
29
33
  #
30
34
  # In this example the <tt>:test</tt> group would
31
35
  # now have the following gems: <tt>gem1, gem2, gem3</tt>
32
- def initialize(options = {})
36
+ def initialize(name, options = {})
37
+ self.name = name
33
38
  self.gems = []
39
+ self.dependents = []
34
40
  options = {} if options.nil?
35
41
  self.group_options = Gemtronics::Manager::GLOBAL_DEFAULT_OPTIONS.merge(options)
36
42
  deps = self.group_options.delete(:dependencies)
@@ -83,6 +89,9 @@ module Gemtronics
83
89
  g = self.group_options.merge({:name => name, :require => [name]}.merge(g).merge(options))
84
90
  g[:require] = [g[:require]].flatten
85
91
  self.gems[ind] = g
92
+ self.dependents.each do |dep|
93
+ Gemtronics.group(dep).add(name, options)
94
+ end
86
95
  end
87
96
 
88
97
  # Removes a gem from the group.
@@ -128,6 +137,7 @@ module Gemtronics
128
137
  def dependency(name)
129
138
  group = Gemtronics::Manager.instance.groups[name.to_sym]
130
139
  if group
140
+ Gemtronics.group(name.to_sym).dependents << self.name
131
141
  group.gems.dup.each do |gemdef|
132
142
  self.add(gemdef[:name], gemdef)
133
143
  end
@@ -28,8 +28,12 @@ module Gemtronics
28
28
  def group(name, options = {})
29
29
  name = name.to_sym
30
30
  options = GLOBAL_DEFAULT_OPTIONS.merge(options)
31
- g = (self.groups[name] ||= Gemtronics::Grouper.new(options))
32
- yield g if block_given?
31
+ g = (self.groups[name] ||= Gemtronics::Grouper.new(name, options))
32
+ if block_given?
33
+ yield g
34
+ else
35
+ return g
36
+ end
33
37
  end
34
38
 
35
39
  # Aliases one gem group to another group.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemtronics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-13 00:00:00 -04:00
12
+ date: 2009-08-14 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15