Class: Gemsmith::Aids::Spec
- Inherits:
-
Object
- Object
- Gemsmith::Aids::Spec
- Defined in:
- lib/gemsmith/aids/spec.rb
Overview
A convenience aid to the Gem::Specification object.
Instance Method Summary collapse
- #editor ⇒ Object
- #find(name, version) ⇒ Object
- #find_all(name) ⇒ Object
-
#initialize(specification: ::Gem::Specification, shell: Open3) ⇒ Spec
constructor
A new instance of Spec.
- #open(spec = nil) ⇒ Object
- #read(spec = nil) ⇒ Object
Constructor Details
#initialize(specification: ::Gem::Specification, shell: Open3) ⇒ Spec
Returns a new instance of Spec.
7 8 9 10 |
# File 'lib/gemsmith/aids/spec.rb', line 7 def initialize specification: ::Gem::Specification, shell: Open3 @specification = specification @shell = shell end |
Instance Method Details
#editor ⇒ Object
12 13 14 |
# File 'lib/gemsmith/aids/spec.rb', line 12 def editor ENV["EDITOR"] end |
#find(name, version) ⇒ Object
28 29 30 |
# File 'lib/gemsmith/aids/spec.rb', line 28 def find name, version specification.find_by_name name, version end |
#find_all(name) ⇒ Object
32 33 34 |
# File 'lib/gemsmith/aids/spec.rb', line 32 def find_all name specification.find_all_by_name name end |
#open(spec = nil) ⇒ Object
16 17 18 19 |
# File 'lib/gemsmith/aids/spec.rb', line 16 def open spec = nil return unless spec shell.capture2 editor, spec.full_gem_path end |
#read(spec = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/gemsmith/aids/spec.rb', line 21 def read spec = nil return unless spec return if spec.homepage.nil? || spec.homepage.empty? shell.capture2 "open", spec.homepage end |