Class: Sunspot::Solr::Installer::ConfigInstaller
- Inherits:
-
Object
- Object
- Sunspot::Solr::Installer::ConfigInstaller
- Includes:
- TaskHelper
- Defined in:
- lib/sunspot/solr/installer/config_installer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(config_path, options) ⇒ ConfigInstaller
constructor
A new instance of ConfigInstaller.
Methods included from TaskHelper
Constructor Details
#initialize(config_path, options) ⇒ ConfigInstaller
Returns a new instance of ConfigInstaller.
15 16 17 18 19 |
# File 'lib/sunspot/solr/installer/config_installer.rb', line 15 def initialize(config_path, ) @config_path = config_path @verbose = !![:verbose] @force = !![:force] end |
Class Method Details
.execute(config_path, options = {}) ⇒ Object
10 11 12 |
# File 'lib/sunspot/solr/installer/config_installer.rb', line 10 def execute(config_path, = {}) new(config_path, ).execute end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sunspot/solr/installer/config_installer.rb', line 21 def execute sunspot_config_path = File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'solr', 'solr', 'conf') return if File.(sunspot_config_path) == File.(@config_path) FileUtils.mkdir_p(@config_path) Dir.glob(File.join(sunspot_config_path, '*.*')).each do |file| file = File.(file) dest = File.join(@config_path, File.basename(file)) if File.exist?(dest) if @force say("Removing existing file #{dest}") else next end end say("Copying #{file} => #{dest}") FileUtils.cp(file, dest) end # Also copy the solr.xml file for multi core support file = File.('../solr.xml', sunspot_config_path) dest = File.(File.join(@config_path, ".."), File.basename(file)) say("Copying #{file} => #{dest}") FileUtils.cp(file, dest) end |