Class: Gemsmith::Gem::Specification
- Inherits:
-
Object
- Object
- Gemsmith::Gem::Specification
- Defined in:
- lib/gemsmith/gem/specification.rb
Overview
A Gem::Specification with additional enhancements.
Class Method Summary collapse
- .default_gem_host ⇒ Object
- .find(name, version) ⇒ Object
- .find_all(name, requirement: Gem::Requirement.new.to_s) ⇒ Object
- .specification ⇒ Object
Instance Method Summary collapse
- #allowed_push_host ⇒ Object
- #allowed_push_key ⇒ Object
- #homepage_url ⇒ Object
-
#initialize(file_path) ⇒ Specification
constructor
A new instance of Specification.
- #name ⇒ Object
- #package_file_name ⇒ Object
- #path ⇒ Object
- #version_label ⇒ Object
- #version_number ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Specification
Returns a new instance of Specification.
25 26 27 28 29 30 |
# File 'lib/gemsmith/gem/specification.rb', line 25 def initialize file_path @file_path = file_path @spec = self.class.specification.load file_path validate @version = Versionaire::Version @spec.version.to_s end |
Class Method Details
.default_gem_host ⇒ Object
13 14 15 |
# File 'lib/gemsmith/gem/specification.rb', line 13 def self.default_gem_host ::Gem::DEFAULT_HOST end |
.find(name, version) ⇒ Object
17 18 19 |
# File 'lib/gemsmith/gem/specification.rb', line 17 def self.find name, version specification.find_by_name name, version end |
.find_all(name, requirement: Gem::Requirement.new.to_s) ⇒ Object
21 22 23 |
# File 'lib/gemsmith/gem/specification.rb', line 21 def self.find_all name, requirement: Gem::Requirement.new.to_s specification.find_all_by_name name, requirement end |
.specification ⇒ Object
9 10 11 |
# File 'lib/gemsmith/gem/specification.rb', line 9 def self.specification ::Gem::Specification end |
Instance Method Details
#allowed_push_host ⇒ Object
48 49 50 |
# File 'lib/gemsmith/gem/specification.rb', line 48 def allowed_push_host spec..fetch("allowed_push_host") { self.class.default_gem_host } end |
#allowed_push_key ⇒ Object
44 45 46 |
# File 'lib/gemsmith/gem/specification.rb', line 44 def allowed_push_key spec..fetch("allowed_push_key") { "rubygems_api_key" } end |
#homepage_url ⇒ Object
40 41 42 |
# File 'lib/gemsmith/gem/specification.rb', line 40 def homepage_url String spec.homepage end |
#name ⇒ Object
32 33 34 |
# File 'lib/gemsmith/gem/specification.rb', line 32 def name spec.name end |
#package_file_name ⇒ Object
60 61 62 |
# File 'lib/gemsmith/gem/specification.rb', line 60 def package_file_name "#{name}-#{version_number}.gem" end |
#path ⇒ Object
36 37 38 |
# File 'lib/gemsmith/gem/specification.rb', line 36 def path spec.full_gem_path end |
#version_label ⇒ Object
56 57 58 |
# File 'lib/gemsmith/gem/specification.rb', line 56 def version_label version.label end |
#version_number ⇒ Object
52 53 54 |
# File 'lib/gemsmith/gem/specification.rb', line 52 def version_number version.to_s end |