class Desi::LocalInstall::Release
Public Class Methods
all_in(workdir)
click to toggle source
# File lib/desi/local_install/release.rb, line 10 def self.all_in(workdir) Dir[workdir.join('*')]. select {|subdir| File.directory?(subdir) && File.basename(subdir) =~ /^elasticsearch\-\d+\.\d+\.\d+/ }. map {|dirname| new(dirname, workdir) } end
new(dirname, workdir)
click to toggle source
# File lib/desi/local_install/release.rb, line 16 def initialize(dirname, workdir) @dirname = Pathname.new(dirname) @workdir = workdir end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/desi/local_install/release.rb, line 47 def <=>(other) name <=> other.name end
==(other)
click to toggle source
# File lib/desi/local_install/release.rb, line 43 def ==(other) other.version.to_s == version.to_s end
current?()
click to toggle source
# File lib/desi/local_install/release.rb, line 25 def current? current_symlink? && current_symlink.realpath == @dirname end
name()
click to toggle source
# File lib/desi/local_install/release.rb, line 21 def name @name ||= File.basename(@dirname) end
pre_one_zero?()
click to toggle source
# File lib/desi/local_install/release.rb, line 51 def pre_one_zero? @pre_one_zero ||= (version < Semantic::Version.new("1.0.0-alpha")) end
to_path()
click to toggle source
# File lib/desi/local_install/release.rb, line 55 def to_path @dirname.to_path end
to_s()
click to toggle source
# File lib/desi/local_install/release.rb, line 37 def to_s current_mark = current? ? '*' : '-' " #{current_mark} #{name} (#{@dirname})" end
version()
click to toggle source
# File lib/desi/local_install/release.rb, line 29 def version @version ||= Semantic::Version.new(version_number) end
with_version?(other_version)
click to toggle source
# File lib/desi/local_install/release.rb, line 33 def with_version?(other_version) version == Semantic::Version.new(other_version) end
Private Instance Methods
current_symlink()
click to toggle source
# File lib/desi/local_install/release.rb, line 61 def current_symlink @current_symlink ||= Pathname(@workdir).join('current') end
current_symlink?()
click to toggle source
# File lib/desi/local_install/release.rb, line 65 def current_symlink? current_symlink.exist? end
version_number()
click to toggle source
Ugly hack to get around elasticsearch’s flakey semver naming (e.g. ‘1.4.0.Beta1` instead of `1.4.0-beta1`)
# File lib/desi/local_install/release.rb, line 71 def version_number /^elasticsearch\-(?<version>.*)$/.match(name.to_s)[:version]. sub(/\.(alpha|beta)/i, '-\1') end