Class: Sunspot::Installer::LibraryInstaller
- Inherits:
-
Object
- Object
- Sunspot::Installer::LibraryInstaller
- Defined in:
- lib/sunspot/installer/library_installer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(library_path, options) ⇒ LibraryInstaller
constructor
A new instance of LibraryInstaller.
- #say(message) ⇒ Object
Constructor Details
#initialize(library_path, options) ⇒ LibraryInstaller
Returns a new instance of LibraryInstaller.
12 13 14 15 16 |
# File 'lib/sunspot/installer/library_installer.rb', line 12 def initialize(library_path, ) @library_path = library_path @verbose = !![:verbose] @force = !![:force] end |
Class Method Details
.execute(library_path, options) ⇒ Object
7 8 9 |
# File 'lib/sunspot/installer/library_installer.rb', line 7 def execute(library_path, ) new(library_path, ).execute end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sunspot/installer/library_installer.rb', line 18 def execute sunspot_library_path = File.join(File.dirname(__FILE__), '..', '..', '..', 'solr', 'solr', 'lib') return if File.(sunspot_library_path) == File.(@library_path) FileUtils.mkdir_p(@library_path) Dir.glob(File.join(sunspot_library_path, '*.jar')).each do |jar| jar = File.(jar) dest = File.join(@library_path, File.basename(jar)) if File.exist?(dest) if @force say("Removing existing library #{dest}") else next end end say("Copying #{jar} => #{dest}") FileUtils.cp(jar, dest) end end |
#say(message) ⇒ Object
38 39 40 41 42 |
# File 'lib/sunspot/installer/library_installer.rb', line 38 def say() if @verbose STDOUT.puts() end end |