gemtronics 0.4.6 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,16 @@ module Gemtronics
19
19
  # method built dynamically. This is just a stub for RDoc.
20
20
  end
21
21
 
22
+ # Returns true/false if the gem should be installed with ri. Defaults to <tt>false</tt>.
23
+ def ri?
24
+ # method built dynamically. This is just a stub for RDoc.
25
+ end
26
+
27
+ # Set whether the gem should be installed with ri.
28
+ def ri=(x)
29
+ # method built dynamically. This is just a stub for RDoc.
30
+ end
31
+
22
32
  # Returns an Array of files that should be required. Defaults to <tt>[<name>]</tt>
23
33
  def require_list
24
34
  return [self.name] unless self.has_key?(:require)
@@ -50,6 +60,14 @@ module Gemtronics
50
60
  # gd.install_command #=> 'gem install configatron --source=http://gems.rubyforge.org --version=2.3.0'
51
61
  def install_command
52
62
  cmd = "gem install #{self.name} --source=#{self.source}"
63
+ unless self.ri?
64
+ cmd << ' --no-ri'
65
+ end
66
+
67
+ unless self.rdoc?
68
+ cmd << ' --no-rdoc'
69
+ end
70
+
53
71
  unless self.version.match(/^(\>\=|\>)/)
54
72
  cmd << " --version=#{self.version}"
55
73
  end
@@ -105,6 +123,8 @@ module Gemtronics
105
123
  build_method(:version, '>=0.0.0')
106
124
  build_method(:source, 'http://gems.rubyforge.org')
107
125
  build_method(:load?, true, :load)
126
+ build_method(:ri?, false, :ri)
127
+ build_method(:rdoc?, false, :rdoc)
108
128
 
109
129
  end # Definition
110
130
  end # Gemtronics
@@ -5,7 +5,7 @@ module Gemtronics
5
5
  # A Hash of the default options that are applied to all the gems.
6
6
  # These options can be overidden at both the group and the individual
7
7
  # gem level.
8
- GLOBAL_DEFAULT_OPTIONS = {:load => true, :version => '>=0.0.0', :source => 'http://gems.rubyforge.org'}
8
+ GLOBAL_DEFAULT_OPTIONS = {:load => true, :version => '>=0.0.0', :source => 'http://gems.rubyforge.org', :ri => false, :rdoc => false}
9
9
 
10
10
  # A Hash of all the groups that have been defined.
11
11
  attr_accessor :groups
@@ -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: gemtronics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.8
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-24 00:00:00 -04:00
12
+ date: 2009-09-02 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  requirements: []
55
55
 
56
56
  rubyforge_project: magrathea
57
- rubygems_version: 1.3.4
57
+ rubygems_version: 1.3.5
58
58
  signing_key:
59
59
  specification_version: 3
60
60
  summary: gemtronics