Class: Doc::Configurator::Gems
- Inherits:
-
Doc::Configurator
- Object
- Doc::Configurator
- Doc::Configurator::Gems
- Defined in:
- lib/doc/configurator/gems.rb
Instance Attribute Summary
Attributes inherited from Doc::Configurator
Instance Method Summary collapse
Methods inherited from Doc::Configurator
default_config_key, inherited, #initialize
Constructor Details
This class inherits a constructor from Doc::Configurator
Instance Method Details
#configure(update) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/doc/configurator/gems.rb', line 6 def configure(update) config.([], [[:only, :except], :versions, :prerelease]) [:only, :except].each do |key| config[key] = Array(config[key]).flatten.map(&:to_s) if config[key] end @prerelease = !!config[:prerelease] @specs = config[:versions] && config[:versions].to_sym == :all ? all_specs(@prerelease) : latest_specs(@prerelease) if config[:only] absent = config[:only] - @specs.map(&:name) unless absent.empty? raise ConfigError.new(self, "can't find gems: #{absent.join(', ')}") end end if config[:only] @specs = @specs.select{ |spec| config[:only].include?(spec.name) } elsif config[:except] @specs = @specs.reject{ |spec| config[:except].include?(spec.name) } end @specs = @specs.sort_by{ |spec| [spec.name.downcase, spec.sort_obj] } end |
#tasks ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/doc/configurator/gems.rb', line 31 def tasks @specs.map do |spec| main = spec..each_cons(2).select{ |key, value| %w[--main -m].include?(key) }.map(&:last).first next if spec.respond_to?(:default_gem?) && spec.default_gem? Dir.chdir(spec.full_gem_path) do file_list = FileList.new file_list.include *spec.extra_rdoc_files file_list.include *spec.require_paths builder({ :title => "gem #{spec.full_name}", :source_dir => spec.full_gem_path, :dir_name => "gem.#{spec.full_name}", :paths => file_list, :main => main, }) end end.compact end |