Module: VersionLS

Defined in:
lib/vls.rb,
lib/vls/version.rb

Overview

The Version LiSt utility module.

Constant Summary collapse

STRING =
VERSION = "0.3.4"
DESCRIPTION =
"A command line utility that lists the versions of " +
"modules used by the specified gems/ruby files."

Class Method Summary collapse

Class Method Details

.lsObject

Perform a Versioned LiSt to the console.



9
10
11
12
# File 'lib/vls.rb', line 9

def self.ls
  vls.each{|mod| puts "#{mod[0]}, #{mod[1]}"}
  nil
end

.modulesObject

Get a list of modules that have VERSION info.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/vls.rb', line 29

def self.modules
  mods = ObjectSpace.each_object(Module).
         select do |mod|
           mod.const_defined?("VERSION")
         end.
         sort do |first, second|
           first.name <=> second.name
         end

  mods - [VersionLS]
end

.vlsObject

Execute the core of the vls command and return an array of

module, version

arrays.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vls.rb', line 16

def self.vls
  modules.map do |mod|
    begin
      version = mod::VERSION
    rescue
      version = 'version ???'
    end

    [mod, version.to_vls_version_string]
  end
end