Class: Avm::EacRubyBase1::Launcher::Gem::Specification
- Inherits:
-
Object
- Object
- Avm::EacRubyBase1::Launcher::Gem::Specification
- Defined in:
- lib/avm/eac_ruby_base1/launcher/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.
18 19 20 |
# File 'lib/avm/eac_ruby_base1/launcher/gem/specification.rb', line 18 def initialize(gemspec_file) @gemspec_file = gemspec_file end |
Instance Attribute Details
#gemspec_file ⇒ Object (readonly)
Returns the value of attribute gemspec_file.
16 17 18 |
# File 'lib/avm/eac_ruby_base1/launcher/gem/specification.rb', line 16 def gemspec_file @gemspec_file end |
Class Method Details
.parse_version_file(file) ⇒ Object
9 10 11 12 13 |
# File 'lib/avm/eac_ruby_base1/launcher/gem/specification.rb', line 9 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
33 34 35 |
# File 'lib/avm/eac_ruby_base1/launcher/gem/specification.rb', line 33 def full_name "#{name}-#{version}" end |
#name ⇒ Object
29 30 31 |
# File 'lib/avm/eac_ruby_base1/launcher/gem/specification.rb', line 29 def name ::File.basename(gemspec_file).gsub(/\.gemspec\z/, '') end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/avm/eac_ruby_base1/launcher/gem/specification.rb', line 37 def to_s full_name end |
#version ⇒ Object
22 23 24 25 26 27 |
# File 'lib/avm/eac_ruby_base1/launcher/gem/specification.rb', line 22 def version v = self.class.parse_version_file(version_file) return v if v.present? raise "Version not found on file \"#{version_file}\"" end |