Class: EacLauncher::Ruby::Gem::Specification
- Inherits:
-
Object
- Object
- EacLauncher::Ruby::Gem::Specification
- Defined in:
- lib/eac_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
- #version ⇒ Object
Constructor Details
#initialize(gemspec_file) ⇒ Specification
Returns a new instance of Specification.
15 16 17 |
# File 'lib/eac_launcher/ruby/gem/specification.rb', line 15 def initialize(gemspec_file) @gemspec_file = gemspec_file end |
Instance Attribute Details
#gemspec_file ⇒ Object (readonly)
Returns the value of attribute gemspec_file.
13 14 15 |
# File 'lib/eac_launcher/ruby/gem/specification.rb', line 13 def gemspec_file @gemspec_file end |
Class Method Details
.parse_version_file(file) ⇒ Object
6 7 8 9 10 |
# File 'lib/eac_launcher/ruby/gem/specification.rb', line 6 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
29 30 31 |
# File 'lib/eac_launcher/ruby/gem/specification.rb', line 29 def full_name "#{name}-#{version}" end |
#name ⇒ Object
25 26 27 |
# File 'lib/eac_launcher/ruby/gem/specification.rb', line 25 def name ::File.basename(gemspec_file).gsub(/\.gemspec\z/, '') end |
#version ⇒ Object
19 20 21 22 23 |
# File 'lib/eac_launcher/ruby/gem/specification.rb', line 19 def version v = self.class.parse_version_file(version_file) return v if v.present? raise "Version not found on file \"#{version_file}\"" end |