Class: Desi::LocalInstall::Release
- Inherits:
-
Object
- Object
- Desi::LocalInstall::Release
- Defined in:
- lib/desi/local_install/release.rb
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #current? ⇒ Boolean
-
#initialize(dirname, workdir) ⇒ Release
constructor
A new instance of Release.
- #name ⇒ Object
- #pre_one_zero? ⇒ Boolean
- #to_path ⇒ Object
- #to_s ⇒ Object
- #version ⇒ Object
- #with_version?(other_version) ⇒ Boolean
Constructor Details
#initialize(dirname, workdir) ⇒ Release
Returns a new instance of Release.
16 17 18 19 |
# File 'lib/desi/local_install/release.rb', line 16 def initialize(dirname, workdir) @dirname = Pathname.new(dirname) @workdir = workdir end |
Class Method Details
.all_in(workdir) ⇒ Object
10 11 12 13 14 |
# 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 |
Instance Method Details
#<=>(other) ⇒ Object
47 48 49 |
# File 'lib/desi/local_install/release.rb', line 47 def <=>(other) name <=> other.name end |
#==(other) ⇒ Object
43 44 45 |
# File 'lib/desi/local_install/release.rb', line 43 def ==(other) other.version.to_s == version.to_s end |
#current? ⇒ Boolean
25 26 27 |
# File 'lib/desi/local_install/release.rb', line 25 def current? current_symlink? && current_symlink.realpath == @dirname end |
#name ⇒ Object
21 22 23 |
# File 'lib/desi/local_install/release.rb', line 21 def name @name ||= File.basename(@dirname) end |
#pre_one_zero? ⇒ Boolean
51 52 53 |
# 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 ⇒ Object
55 56 57 |
# File 'lib/desi/local_install/release.rb', line 55 def to_path @dirname.to_path end |
#to_s ⇒ Object
37 38 39 40 41 |
# File 'lib/desi/local_install/release.rb', line 37 def to_s current_mark = current? ? '*' : '-' " #{current_mark} #{name} (#{@dirname})" end |
#version ⇒ Object
29 30 31 |
# File 'lib/desi/local_install/release.rb', line 29 def version @version ||= Semantic::Version.new(version_number) end |
#with_version?(other_version) ⇒ Boolean
33 34 35 |
# File 'lib/desi/local_install/release.rb', line 33 def with_version?(other_version) version == Semantic::Version.new(other_version) end |