Class: Docrb::Spec
- Inherits:
-
Object
- Object
- Docrb::Spec
- Defined in:
- lib/docrb/spec.rb
Overview
Spec provides a small wrapper around Gem::Specification to provide metadata about a given gem being documented.
Class Method Summary collapse
-
.parse_folder(input) ⇒ Object
Public: Finds a .gemspec file within the provided input folder and processes it.
Class Method Details
.parse_folder(input) ⇒ Object
Public: Finds a .gemspec file within the provided input folder and processes it.
input - Folder to search for a .gemspec file
Returns a hash containing extracted information from the found gemspec file. The following keys are returned: :summary, :name, :license, :git_url, :authors, :host_url
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/docrb/spec.rb', line 15 def self.parse_folder(input) spec = Dir["#{input}/*"].find { |f| f.end_with? ".gemspec" } return {} if spec.nil? data = Gem::Specification.load(spec) is_private = data..key? "allowed_push_host" { summary: data.summary, name: data.name, license: data.license, git_url: data.["source_code_uri"], authors: data., host_url: is_private ? nil : "https://rubygems.org/gems/#{data.name}" } end |