Class: SdocAll::Gems
Constant Summary
Constants inherited from Base
Base::BASE_PATH, Base::DOCS_PATH, Base::PUBLIC_PATH
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #add_tasks(options = {}) ⇒ Object
-
#initialize(raw_config) ⇒ Gems
constructor
A new instance of Gems.
Methods inherited from Base
add_merge_task, add_task, base_path, chdir, clear, dirs, docs_path, dry_run!, dry_run?, entries, inherited, output_for_verbose_level, public_path, remove_if_present, short_name, sources_path, subclasses, system, tasks, to_document, used_sources, verbose_level, verbose_level=, with_env
Constructor Details
#initialize(raw_config) ⇒ Gems
Returns a new instance of Gems.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sdoc_all/parts/gems.rb', line 3 def initialize(raw_config) raw_config ||= {} raw_config = {:only => raw_config} unless raw_config.is_a?(Hash) @config = { :versions => raw_config.delete(:versions).to_s.downcase, :only => config_only_option(raw_config), :exclude => config_exclude_option(raw_config), } errors = [] gem_names = unfiltered_specs.map{ |spec| spec.name.downcase } [:only, :exclude].each do |option| if config[option] config[option].each do |gem_name| errors << "#{option} #{gem_name} does not match any gem" unless gem_names.include?(gem_name) end end end unless errors.empty? raise ConfigError.new(errors.join("\n")) end if filtered_specs.empty? = config.map do |option, values| "#{option} => #{Array(values).join(',')}" if values.present? end.compact.join(', ') raise ConfigError.new("no gems matches #{}") end (raw_config) end |
Class Method Details
.all_specs ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/sdoc_all/parts/gems.rb', line 73 def all_specs specs = [] Gem.source_index.each do |_, spec| specs << spec end specs end |
.latest_specs ⇒ Object
69 70 71 |
# File 'lib/sdoc_all/parts/gems.rb', line 69 def latest_specs Gem.source_index.latest_specs end |
Instance Method Details
#add_tasks(options = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/sdoc_all/parts/gems.rb', line 36 def add_tasks( = {}) specs = filtered_specs.sort_by{ |spec| [spec.name.downcase, spec.sort_obj] } specs.each do |spec| main = nil spec..each_cons(2) do || main = [1] if %w(--main -m).include?([0]) end Base.add_task( :src_path => spec.full_gem_path, :doc_path => "gems.#{spec.full_name}", :paths => spec.require_paths + spec.extra_rdoc_files, :main => main, :title => "gems: #{spec.full_name}" ) end end |