Class: SdocAll::Gems
- Extended by:
- ClassMethods
- Defined in:
- lib/sdoc_all/parts/gems.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from Base::ClassMethods
Base::ClassMethods::BASE_PATH, Base::ClassMethods::DOCS_PATH, Base::ClassMethods::PUBLIC_PATH
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #add_tasks(options = {}) ⇒ Object
-
#initialize(raw_config) ⇒ Gems
constructor
A new instance of Gems.
Methods included from ClassMethods
Methods included from Base::ClassMethods
#add_merge_task, #add_task, #base_path, #clear, #docs_path, #entries, #inherited, #public_path, #remove_if_present, #short_name, #sources_path, #subclasses, #system, #tasks, #to_document, #used_sources, #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 |
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 |