class Gemsmith::Gem::Specification
A Gem::Specification
with additional enhancements.
Attributes
file_path[R]
spec[R]
version[R]
Public Class Methods
default_gem_host()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 14 def self.default_gem_host ::Gem::DEFAULT_HOST end
find(name, version)
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 18 def self.find name, version specification.find_by_name name, version end
find_all(name, requirement: Gem::Requirement.new.to_s)
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 22 def self.find_all name, requirement: Gem::Requirement.new.to_s specification.find_all_by_name name, requirement end
new(file_path)
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 28 def initialize file_path @file_path = file_path @spec = self.class.specification.load file_path.to_s validate @version = Versionaire::Version @spec.version.to_s end
specification()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 10 def self.specification ::Gem::Specification end
Public Instance Methods
allowed_push_host()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 51 def allowed_push_host spec.metadata.fetch "allowed_push_host", self.class.default_gem_host end
allowed_push_key()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 47 def allowed_push_key spec.metadata.fetch "allowed_push_key", "rubygems_api_key" end
homepage_url()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 43 def homepage_url String spec.homepage end
name()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 35 def name spec.name end
package_file_name()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 55 def package_file_name "#{name}-#{version}.gem" end
package_path()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 59 def package_path Pathname("pkg").join package_file_name end
path()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 39 def path spec.full_gem_path end
Private Instance Methods
validate()
click to toggle source
# File lib/gemsmith/gem/specification.rb, line 67 def validate return if spec.is_a? self.class.specification fail Errors::Specification, %(Unknown gem specification: "#{file_path}".) end