Class: Raykit::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/raykit/version.rb

Overview

Version functionality

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#start_timeObject

Returns the value of attribute start_time.



4
5
6
# File 'lib/raykit/version.rb', line 4

def start_time
  @start_time
end

Class Method Details

.detect(name) ⇒ Object

detect a version number based on the NAME variable, if defined



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/raykit/version.rb', line 7

def self.detect(name)
        csproj_filename = "#{name}/#{name}.csproj"
        if(File.exists?(csproj_filename))
            match = IO.read(csproj_filename).match(/<Version>([\d.]+)</)
            if(!match.nil? && match.captures.length>0)
                return match.captures[0]
            end
            #return IO.read(csproj_filename).match(/<Version>([\d.]+)</).captures[0]

        end
        gemspec_filename = "#{name}.gemspec"
        if(File.exists?(gemspec_filename))
            return IO.read(gemspec_filename).match(/version[\s]+=[\s]+['"]([\w.]+)['"]/).captures[0]
        end
        nuspec_filename="#{name}.nuspec"
        if(File.exists?(nuspec_filename))
            match = IO.read(nuspec_filename).match(/<[Vv]ersion>([\d.]+)</)
            if(!match.nil? && match.captures.length>0)
                return match.captures[0]
            end
        end
    '0.0.0'
end