Class: Desi::LocalInstall
- Inherits:
-
Object
- Object
- Desi::LocalInstall
- Defined in:
- lib/desi/local_install.rb
Defined Under Namespace
Classes: Release
Instance Method Summary collapse
- #create! ⇒ Object
- #current_dir ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(workdir = nil, opts = {}) ⇒ LocalInstall
constructor
A new instance of LocalInstall.
- #launcher ⇒ Object
- #logfile ⇒ Object
- #pidfile ⇒ Object
- #releases ⇒ Object
- #to_path ⇒ Object
- #to_s ⇒ Object
- #update_current_to(release_dir) ⇒ Object
Constructor Details
#initialize(workdir = nil, opts = {}) ⇒ LocalInstall
Returns a new instance of LocalInstall.
53 54 55 56 57 |
# File 'lib/desi/local_install.rb', line 53 def initialize(workdir = nil, opts = {}) @verbose = opts[:verbose] @workdir = Pathname(File.(workdir || Desi.configuration.directory)) create! end |
Instance Method Details
#create! ⇒ Object
75 76 77 |
# File 'lib/desi/local_install.rb', line 75 def create! FileUtils.mkdir_p @workdir end |
#current_dir ⇒ Object
63 64 65 |
# File 'lib/desi/local_install.rb', line 63 def current_dir @workdir.join('current') end |
#exists? ⇒ Boolean
59 60 61 |
# File 'lib/desi/local_install.rb', line 59 def exists? @workdir.exist? end |
#launcher ⇒ Object
99 100 101 |
# File 'lib/desi/local_install.rb', line 99 def launcher current_dir.join('bin', 'elasticsearch') end |
#logfile ⇒ Object
95 96 97 |
# File 'lib/desi/local_install.rb', line 95 def logfile current_dir.join('logs', 'elasticsearch.log') end |
#pidfile ⇒ Object
91 92 93 |
# File 'lib/desi/local_install.rb', line 91 def pidfile @workdir.join('elasticsearch.pid') end |
#releases ⇒ Object
79 80 81 |
# File 'lib/desi/local_install.rb', line 79 def releases Release.all_in(@workdir) end |
#to_path ⇒ Object
83 84 85 |
# File 'lib/desi/local_install.rb', line 83 def to_path @workdir.to_s end |
#to_s ⇒ Object
87 88 89 |
# File 'lib/desi/local_install.rb', line 87 def to_s to_path end |
#update_current_to(release_dir) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/desi/local_install.rb', line 67 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) end |