Class: Sunspot::Solr::Installer::ConfigInstaller
- Inherits:
-
Object
- Object
- Sunspot::Solr::Installer::ConfigInstaller
- Includes:
- FileUtils, TaskHelper
- Defined in:
- lib/sunspot/solr/installer/config_installer.rb
Instance Attribute Summary collapse
-
#config_path ⇒ Object
Returns the value of attribute config_path.
-
#force ⇒ Object
(also: #force?)
Returns the value of attribute force.
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.
20 21 22 23 24 |
# File 'lib/sunspot/solr/installer/config_installer.rb', line 20 def initialize(config_path, ) self.config_path = File. config_path self.force = !![:force] @verbose = !![:verbose] end |
Instance Attribute Details
#config_path ⇒ Object
Returns the value of attribute config_path.
11 12 13 |
# File 'lib/sunspot/solr/installer/config_installer.rb', line 11 def config_path @config_path end |
#force ⇒ Object Also known as: force?
Returns the value of attribute force.
11 12 13 |
# File 'lib/sunspot/solr/installer/config_installer.rb', line 11 def force @force end |
Class Method Details
.execute(config_path, options = {}) ⇒ Object
15 16 17 |
# File 'lib/sunspot/solr/installer/config_installer.rb', line 15 def execute(config_path, = {}) new(config_path, ).execute end |
Instance Method Details
#execute ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/sunspot/solr/installer/config_installer.rb', line 26 def execute return if sunspot_config_path == config_path sunspot_config_files do |file, dest| if File.exist?(dest) next unless force? say("Removing existing file #{dest}") end dir = dest.pathmap('%d') unless File.exist?(dir) say("Creating directory #{dir}") mkdir_p dir end next if File.directory? file say("Copying #{file} => #{dest}") cp(file, dest) end end |