markbates-gemtronics 0.4.7.20090826163642 → 0.4.8.20090902114901

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.
Files changed (2) hide show
  1. data/lib/gemtronics/manager.rb +26 -3
  2. metadata +2 -2
@@ -208,13 +208,25 @@ module Gemtronics
208
208
  return res
209
209
  end
210
210
 
211
- def for_rails(config, options = {})
211
+ def for_rails(config = nil, options = {})
212
212
  options = {:gemtronics_path => File.join(RAILS_ROOT, 'config', 'gemtronics.rb'),
213
213
  :group => RAILS_ENV}.merge(options)
214
214
  [options.delete(:gemtronics_path)].flatten.each do |path|
215
215
  self.load(path)
216
216
  end
217
- [options.delete(:group)].flatten.each do |group_name|
217
+ group_list = [options.delete(:group)].flatten
218
+
219
+ if config.nil?
220
+ for_rails_without_config(group_list, options)
221
+ else
222
+ for_rails_with_config(group_list, config, options)
223
+ end
224
+
225
+ end
226
+
227
+ private
228
+ def for_rails_with_config(group_list, config, options = {})
229
+ group_list.each do |group_name|
218
230
  group = self.groups[group_name.to_sym]
219
231
  group.gems.each do |gemdef|
220
232
  gemdef.require_list.each do |lib|
@@ -233,7 +245,18 @@ module Gemtronics
233
245
  end
234
246
  end
235
247
 
236
- private
248
+ def for_rails_without_config(group_list, options = {})
249
+ Rails::Initializer.class_eval do
250
+ alias_method :load_gems_without_gemtronics, :load_gems
251
+ define_method(:load_gems_with_gemtronics) do
252
+ group_list.each do |group_name|
253
+ Gemtronics.require_gems(group_name)
254
+ end
255
+ end
256
+ alias_method :load_gems, :load_gems_with_gemtronics
257
+ end
258
+ end
259
+
237
260
  def gem_installed?(gemdef) # :nodoc:
238
261
  return true if self.installed_gems.include?(gemdef.to_s)
239
262
  return gemdef.installed?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markbates-gemtronics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7.20090826163642
4
+ version: 0.4.8.20090902114901
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-26 00:00:00 -07:00
12
+ date: 2009-09-02 00:00:00 -07:00
13
13
  default_executable: gemtronics
14
14
  dependencies: []
15
15