Class: Avm::Launcher::Ruby::Gem::Specification
- Defined in:
- lib/avm/launcher/ruby/gem/specification.rb
Instance Attribute Summary collapse
-
#gemspec_file ⇒ Object
readonly
Returns the value of attribute gemspec_file.
Class Method Summary collapse
Instance Method Summary collapse
- #full_name ⇒ Object
-
#initialize(gemspec_file) ⇒ Specification
constructor
A new instance of Specification.
- #name ⇒ Object
- #to_s ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(gemspec_file) ⇒ Specification
Returns a new instance of Specification.
20 21 22 |
# File 'lib/avm/launcher/ruby/gem/specification.rb', line 20 def initialize(gemspec_file) @gemspec_file = gemspec_file end |
Instance Attribute Details
#gemspec_file ⇒ Object (readonly)
Returns the value of attribute gemspec_file.
18 19 20 |
# File 'lib/avm/launcher/ruby/gem/specification.rb', line 18 def gemspec_file @gemspec_file end |
Class Method Details
.parse_version_file(file) ⇒ Object
11 12 13 14 15 |
# File 'lib/avm/launcher/ruby/gem/specification.rb', line 11 def parse_version_file(file) s = ::File.read(file) m = /VERSION\s*=\s*[\'\"]([^\'\"]+)[\'\"]/.match(s) m ? m[1] : nil end |
Instance Method Details
#full_name ⇒ Object
35 36 37 |
# File 'lib/avm/launcher/ruby/gem/specification.rb', line 35 def full_name "#{name}-#{version}" end |
#name ⇒ Object
31 32 33 |
# File 'lib/avm/launcher/ruby/gem/specification.rb', line 31 def name ::File.basename(gemspec_file).gsub(/\.gemspec\z/, '') end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/avm/launcher/ruby/gem/specification.rb', line 39 def to_s full_name end |
#version ⇒ Object
24 25 26 27 28 29 |
# File 'lib/avm/launcher/ruby/gem/specification.rb', line 24 def version v = self.class.parse_version_file(version_file) return v if v.present? raise "Version not found on file \"#{version_file}\"" end |