Class: Spek::Presenter
- Inherits:
-
Object
- Object
- Spek::Presenter
- Extended by:
- Forwardable
- Defined in:
- lib/spek/presenter.rb
Overview
Enhances the default Ruby Gems specification.
Class Method Summary collapse
Instance Method Summary collapse
- #allowed_push_host ⇒ Object
- #allowed_push_key ⇒ Object
- #authors ⇒ Object
- #banner(delimiter: ": ") ⇒ Object
- #certificate_chain ⇒ Object
- #documentation_url ⇒ Object
- #emails ⇒ Object
- #funding_url ⇒ Object
- #homepage_url ⇒ Object
-
#initialize(record) ⇒ Presenter
constructor
A new instance of Presenter.
- #issues_url ⇒ Object
- #label ⇒ Object
- #labeled_summary(delimiter: ": ") ⇒ Object
- #labeled_version ⇒ Object
- #named_version ⇒ Object
- #package_name ⇒ Object
- #package_path ⇒ Object
- #rubygems_mfa? ⇒ Boolean
- #signing_key ⇒ Object
- #source_path ⇒ Object
- #source_url ⇒ Object
- #version ⇒ Object
- #versions_url ⇒ Object
Constructor Details
#initialize(record) ⇒ Presenter
Returns a new instance of Presenter.
39 40 41 |
# File 'lib/spek/presenter.rb', line 39 def initialize record @record = record end |
Class Method Details
.with_default(record = nil, model: Gem::Specification) ⇒ Object
35 36 37 |
# File 'lib/spek/presenter.rb', line 35 def self.with_default record = nil, model: Gem::Specification record && record.is_a?(model) ? new(record) : new(model.new) end |
Instance Method Details
#allowed_push_host ⇒ Object
43 |
# File 'lib/spek/presenter.rb', line 43 def allowed_push_host = .fetch "allowed_push_host", ::Gem::DEFAULT_HOST |
#allowed_push_key ⇒ Object
45 |
# File 'lib/spek/presenter.rb', line 45 def allowed_push_key = .fetch "allowed_push_key", "rubygems_api_key" |
#authors ⇒ Object
47 |
# File 'lib/spek/presenter.rb', line 47 def = Array record. |
#banner(delimiter: ": ") ⇒ Object
49 |
# File 'lib/spek/presenter.rb', line 49 def (delimiter: ": ") = [labeled_version, summary].tap(&:compress!).join delimiter |
#certificate_chain ⇒ Object
51 |
# File 'lib/spek/presenter.rb', line 51 def certificate_chain = Array(record.cert_chain).map { |path| Pathname path.to_s } |
#documentation_url ⇒ Object
53 |
# File 'lib/spek/presenter.rb', line 53 def documentation_url = .fetch "documentation_uri", Core::EMPTY_STRING |
#emails ⇒ Object
55 |
# File 'lib/spek/presenter.rb', line 55 def emails = Array record.email |
#funding_url ⇒ Object
57 |
# File 'lib/spek/presenter.rb', line 57 def funding_url = .fetch "funding_uri", Core::EMPTY_STRING |
#homepage_url ⇒ Object
59 |
# File 'lib/spek/presenter.rb', line 59 def homepage_url = String record.homepage |
#issues_url ⇒ Object
61 |
# File 'lib/spek/presenter.rb', line 61 def issues_url = .fetch "bug_tracker_uri", Core::EMPTY_STRING |
#label ⇒ Object
63 |
# File 'lib/spek/presenter.rb', line 63 def label = .fetch "label", Core::EMPTY_STRING |
#labeled_summary(delimiter: ": ") ⇒ Object
65 |
# File 'lib/spek/presenter.rb', line 65 def labeled_summary(delimiter: ": ") = [label, summary].tap(&:compress!).join delimiter |
#labeled_version ⇒ Object
67 |
# File 'lib/spek/presenter.rb', line 67 def labeled_version = [label, version].tap(&:compress!).join " " |
#named_version ⇒ Object
69 |
# File 'lib/spek/presenter.rb', line 69 def named_version = [name, version].tap(&:compress!).join " " |
#package_name ⇒ Object
71 |
# File 'lib/spek/presenter.rb', line 71 def package_name = %(#{[name, version].tap(&:compress!).join "-"}.gem) |
#package_path ⇒ Object
73 |
# File 'lib/spek/presenter.rb', line 73 def package_path = Pathname("tmp").join package_name |
#rubygems_mfa? ⇒ Boolean
75 |
# File 'lib/spek/presenter.rb', line 75 def rubygems_mfa? = .fetch("rubygems_mfa_required", "false").truthy? |
#signing_key ⇒ Object
77 |
# File 'lib/spek/presenter.rb', line 77 def signing_key = Pathname record.signing_key.to_s |
#source_path ⇒ Object
79 |
# File 'lib/spek/presenter.rb', line 79 def source_path = Pathname record.full_gem_path |
#source_url ⇒ Object
81 |
# File 'lib/spek/presenter.rb', line 81 def source_url = .fetch "source_code_uri", Core::EMPTY_STRING |
#version ⇒ Object
83 |
# File 'lib/spek/presenter.rb', line 83 def version = Version record.version.to_s |
#versions_url ⇒ Object
85 |
# File 'lib/spek/presenter.rb', line 85 def versions_url = .fetch "changelog_uri", Core::EMPTY_STRING |