Class: Desi::LocalInstall
- Inherits:
-
Object
- Object
- Desi::LocalInstall
- Defined in:
- lib/desi/local_install.rb
Defined Under Namespace
Classes: Release
Constant Summary collapse
- DEFAULT_DIR =
'~/elasticsearch'
Instance Method Summary collapse
- #create! ⇒ Object
- #current_dir ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(workdir = nil, opts = {}) ⇒ LocalInstall
constructor
A new instance of LocalInstall.
- #launcher ⇒ 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.
54 55 56 57 58 |
# File 'lib/desi/local_install.rb', line 54 def initialize(workdir = nil, opts = {}) @verbose = opts[:verbose] @workdir = Pathname(File.(workdir || DEFAULT_DIR)) create! end |
Instance Method Details
#create! ⇒ Object
76 77 78 |
# File 'lib/desi/local_install.rb', line 76 def create! FileUtils.mkdir_p @workdir end |
#current_dir ⇒ Object
64 65 66 |
# File 'lib/desi/local_install.rb', line 64 def current_dir @workdir.join('current') end |
#exists? ⇒ Boolean
60 61 62 |
# File 'lib/desi/local_install.rb', line 60 def exists? @workdir.exist? end |
#launcher ⇒ Object
96 97 98 |
# File 'lib/desi/local_install.rb', line 96 def launcher current_dir.join('bin', 'elasticsearch') end |
#pidfile ⇒ Object
92 93 94 |
# File 'lib/desi/local_install.rb', line 92 def pidfile @workdir.join('elasticsearch.pid') end |
#releases ⇒ Object
80 81 82 |
# File 'lib/desi/local_install.rb', line 80 def releases Release.all_in(@workdir) end |
#to_path ⇒ Object
84 85 86 |
# File 'lib/desi/local_install.rb', line 84 def to_path @workdir.to_s end |
#to_s ⇒ Object
88 89 90 |
# File 'lib/desi/local_install.rb', line 88 def to_s to_path end |
#update_current_to(release_dir) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/desi/local_install.rb', line 68 def update_current_to(release_dir) current_dir_must_be_nil_or_symlink! puts " * Updating #{@local_install.current_dir} symlink" if @verbose FileUtils.remove(current_dir) if current_dir.exist? FileUtils.ln_sf(release_dir, current_dir) end |