class Desi::LocalInstall
Public Class Methods
current_release_is_pre_one_zero?()
click to toggle source
# File lib/desi/local_install.rb, line 8 def self.current_release_is_pre_one_zero? current = new.current_release current && current.pre_one_zero? end
new(workdir = nil, opts = {})
click to toggle source
# File lib/desi/local_install.rb, line 13 def initialize(workdir = nil, opts = {}) @verbose = opts[:verbose] @workdir = Pathname(File.expand_path(workdir || Desi.configuration.directory)) create! end
Public Instance Methods
add_data_symlink(release_dir)
click to toggle source
# File lib/desi/local_install.rb, line 36 def add_data_symlink(release_dir) current_dir_must_be_nil_or_symlink! symlink = current_dir.join('data') FileUtils.mkdir_p data_dir puts " * Updating data dir symlink (#{symlink} -> #{data_dir})" if @verbose FileUtils.ln_sf(data_dir, symlink) self end
create!()
click to toggle source
# File lib/desi/local_install.rb, line 45 def create! FileUtils.mkdir_p @workdir end
current_dir()
click to toggle source
# File lib/desi/local_install.rb, line 23 def current_dir @current_dir ||= @workdir.join('current') end
current_release()
click to toggle source
# File lib/desi/local_install.rb, line 53 def current_release releases.find {|r| r.current? } end
data_dir()
click to toggle source
# File lib/desi/local_install.rb, line 61 def data_dir @data_dir ||= @workdir.join('data') end
exists?()
click to toggle source
# File lib/desi/local_install.rb, line 19 def exists? @workdir.exist? end
launcher()
click to toggle source
# File lib/desi/local_install.rb, line 77 def launcher current_dir.join('bin', 'elasticsearch') end
logfile()
click to toggle source
# File lib/desi/local_install.rb, line 73 def logfile current_dir.join('logs', 'elasticsearch.log') end
pidfile()
click to toggle source
# File lib/desi/local_install.rb, line 69 def pidfile @workdir.join('elasticsearch.pid') end
releases()
click to toggle source
# File lib/desi/local_install.rb, line 49 def releases Release.all_in(@workdir) end
to_path()
click to toggle source
# File lib/desi/local_install.rb, line 57 def to_path @workdir.to_s end
to_s()
click to toggle source
# File lib/desi/local_install.rb, line 65 def to_s to_path end
update_current_to(release_dir)
click to toggle source
# File lib/desi/local_install.rb, line 27 def update_current_to(release_dir) current_dir_must_be_nil_or_symlink! puts " * Updating #{current_dir} symlink" if @verbose FileUtils.remove(current_dir) if current_dir.exist? FileUtils.ln_sf(release_dir, current_dir) self end
Private Instance Methods
current_dir_must_be_nil_or_symlink!()
click to toggle source
# File lib/desi/local_install.rb, line 83 def current_dir_must_be_nil_or_symlink! if current_dir.exist? && ! current_dir.symlink? raise "Mmmm!! #{current_dir} is not a symlink!" end end