Class: Desi::Installer
- Inherits:
-
Object
- Object
- Desi::Installer
- Defined in:
- lib/desi/installer.rb
Instance Method Summary collapse
- #config_file ⇒ Object
- #extracted? ⇒ Boolean
-
#initialize(archive, opts = {}) ⇒ Installer
constructor
A new instance of Installer.
- #install! ⇒ Object
- #install_config_file ⇒ Object
- #original_config_backup ⇒ Object
- #our_config_file ⇒ Object
- #update_symlinks! ⇒ Object
Constructor Details
#initialize(archive, opts = {}) ⇒ Installer
Returns a new instance of Installer.
9 10 11 12 13 |
# File 'lib/desi/installer.rb', line 9 def initialize(archive, opts = {}) @verbose = opts[:verbose] @archive = archive.to_s @local_install = Desi::LocalInstall.new(opts[:destination_dir], verbose: @verbose) end |
Instance Method Details
#config_file ⇒ Object
41 42 43 |
# File 'lib/desi/installer.rb', line 41 def config_file release_dir.join('config', 'elasticsearch.yml') end |
#extracted? ⇒ Boolean
22 23 24 |
# File 'lib/desi/installer.rb', line 22 def extracted? !!@extracted end |
#install! ⇒ Object
15 16 17 18 19 20 |
# File 'lib/desi/installer.rb', line 15 def install! extract! unless extracted? install_config_file update_symlinks! remove_archive! end |
#install_config_file ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/desi/installer.rb', line 26 def install_config_file unless original_config_backup.exist? puts " * Installing custom config file" if @verbose FileUtils.mv config_file, original_config_backup FileUtils.cp our_config_file, config_file end end |
#original_config_backup ⇒ Object
45 46 47 |
# File 'lib/desi/installer.rb', line 45 def original_config_backup release_dir.join('config', 'elasticsearch.yml.dist') end |
#our_config_file ⇒ Object
49 50 51 |
# File 'lib/desi/installer.rb', line 49 def our_config_file File.('../../../config/elasticsearch.yml', __FILE__) end |
#update_symlinks! ⇒ Object
35 36 37 38 39 |
# File 'lib/desi/installer.rb', line 35 def update_symlinks! @local_install. update_current_to(release_dir). add_data_symlink(release_dir) end |