Class: Horatio::Detector::RubyGem
Class Method Summary
collapse
Instance Method Summary
collapse
#increment
Methods included from Validator
#validate, #validate_name, #validate_version
Constructor Details
Returns a new instance of RubyGem.
10
11
12
|
# File 'lib/horatio/detector/rubygem.rb', line 10
def initialize
File.open(Dir.glob('*.gemspec').first, 'r') { |f| @spec_file = f.read }
end
|
Class Method Details
.detect ⇒ Object
14
15
16
|
# File 'lib/horatio/detector/rubygem.rb', line 14
def self.detect
Dir.glob('*.gemspec').any?
end
|
Instance Method Details
#description ⇒ Object
27
28
29
|
# File 'lib/horatio/detector/rubygem.rb', line 27
def description
'Ruby gemspec'
end
|
#name ⇒ Object
18
19
20
|
# File 'lib/horatio/detector/rubygem.rb', line 18
def name
@spec_file.match(/spec\.name.*$/i).to_s.split('=')[1].strip.gsub(/[\'\"\\]/, '')
end
|
#version ⇒ Object
22
23
24
25
|
# File 'lib/horatio/detector/rubygem.rb', line 22
def version
File.open(Dir.glob('lib/**/version.rb').first, 'rb') { |f| @version_file = f.read }
@version_file.match(/(\d.)+\d/).to_s.strip.gsub(/[\'\"\\]/, '')
end
|