gemtronics 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +9 -0
  2. data/lib/gemtronics/manager.rb +26 -1
  3. metadata +2 -2
data/README CHANGED
@@ -86,6 +86,15 @@ Right about now you're saying to yourself, I use the Rails gem management system
86
86
 
87
87
  Gemtronics also has the advantage of being an independent system to Rails, which means that you can use it to install Rails for you!
88
88
 
89
+ To use with Rails just create a file named <code>gemtronics.rb</code> in your <code>config</code> directory, and load it up with your favorite gems.
90
+
91
+ Once you've set up your gems just add the following inside the initializer block in <code>environment.rb</code> (where you would normally call <code>config.gem</code>):
92
+
93
+ require 'gemtronics'
94
+ Gemtronics.for_rails(config)
95
+
96
+ Gemtronics will use the current <code>RAILS_ENV</code> to load the correct gem group. You can override this by passing in the <code>:group</code> option and specify which group you would like to use.
97
+
89
98
  ==Sample:
90
99
 
91
100
  group(:default) do |g|
@@ -100,7 +100,7 @@ module Gemtronics
100
100
  options = {:verbose => false}.merge(options)
101
101
  group.gems.each do |g|
102
102
  if g.load? == true
103
- g.require_gem
103
+ g.require_gem(options)
104
104
  end
105
105
  end
106
106
  end
@@ -208,6 +208,31 @@ module Gemtronics
208
208
  return res
209
209
  end
210
210
 
211
+ def for_rails(config, options = {})
212
+ options = {:gemtronics_path => File.join(RAILS_ROOT, 'config', 'gemtronics.rb'),
213
+ :group => RAILS_ENV}.merge(options)
214
+ [options.delete(:gemtronics_path)].flatten.each do |path|
215
+ self.load(path)
216
+ end
217
+ [options.delete(:group)].flatten.each do |group_name|
218
+ group = self.groups[group_name.to_sym]
219
+ group.gems.each do |gemdef|
220
+ gemdef.require_list.each do |lib|
221
+ gopts = {}
222
+ gopts[:version] = gemdef.version unless gemdef.version == '>=0.0.0'
223
+ gopts[:source] = gemdef.source unless gemdef.source == 'http://gems.rubyforge.org'
224
+ gopts[:lib] = lib unless gemdef.name == lib
225
+ gopts[:lib] = false unless gemdef.load?
226
+ unless gopts.empty?
227
+ config.gem(gemdef.name, gopts)
228
+ else
229
+ config.gem(gemdef.name)
230
+ end
231
+ end
232
+ end
233
+ end
234
+ end
235
+
211
236
  private
212
237
  def gem_installed?(gemdef) # :nodoc:
213
238
  return true if self.installed_gems.include?(gemdef.to_s)
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.4.5
4
+ version: 0.4.6
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-20 00:00:00 -04:00
12
+ date: 2009-08-24 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15