Class: RDoc::RubygemsHook

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/rubygems_hook.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec, generate_rdoc = false, generate_ri = true) ⇒ RubygemsHook

Returns a new instance of RubygemsHook.



280
281
282
283
284
285
# File 'lib/rdoc/rubygems_hook.rb', line 280

def initialize(spec, generate_rdoc = false, generate_ri = true)
  @spec = spec
  @generate_rdoc = generate_rdoc
  @generate_ri   = generate_ri
  @force = false
end

Instance Attribute Details

#forceObject

Returns the value of attribute force.



274
275
276
# File 'lib/rdoc/rubygems_hook.rb', line 274

def force
  @force
end

#generate_rdocObject

Returns the value of attribute generate_rdoc.



274
275
276
# File 'lib/rdoc/rubygems_hook.rb', line 274

def generate_rdoc
  @generate_rdoc
end

#generate_riObject

Returns the value of attribute generate_ri.



274
275
276
# File 'lib/rdoc/rubygems_hook.rb', line 274

def generate_ri
  @generate_ri
end

Class Method Details

.default_gem?Boolean

Returns:

  • (Boolean)


276
277
278
# File 'lib/rdoc/rubygems_hook.rb', line 276

def self.default_gem?
  !File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb"))
end

.generation_hook(installer, specs) ⇒ Object



306
307
308
309
310
311
312
# File 'lib/rdoc/rubygems_hook.rb', line 306

def self.generation_hook installer, specs
  # Do nothing if this is NOT a default gem.
  return unless default_gem?

  # Generate document for compatibility if this is a default gem.
  RubyGemsHook.generate(installer, specs)
end

Instance Method Details

#generateObject



287
288
289
290
291
292
293
294
295
# File 'lib/rdoc/rubygems_hook.rb', line 287

def generate
  # Do nothing if this is NOT a default gem.
  return unless self.class.default_gem?

  # Generate document for compatibility if this is a default gem.
  hook = RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri)
  hook.force = @force
  hook.generate
end

#removeObject



297
298
299
300
301
302
303
304
# File 'lib/rdoc/rubygems_hook.rb', line 297

def remove
  # Do nothing if this is NOT a default gem.
  return unless self.class.default_gem?

  # Remove generated document for compatibility if this is a
  # default gem.
  RubyGemsHook.new(@spec).remove
end