Sha256: b967b84767bbccf9b04692e98c1f05da12274b5fb5ad2947fc96f05d02eb7e9b

Contents?: true

Size: 1.23 KB

Versions: 25

Compression:

Stored size: 1.23 KB

Contents

require 'fileutils'

module Sunspot
  class Installer
    class LibraryInstaller
      class <<self
        def execute(library_path, options)
          new(library_path, options).execute
        end
      end

      def initialize(library_path, options)
        @library_path = library_path
        @verbose = !!options[:verbose]
        @force = !!options[:force]
      end

      def execute
        sunspot_library_path = File.join(File.dirname(__FILE__), '..', '..',
                                         '..', 'solr', 'solr', 'lib')
        return if File.expand_path(sunspot_library_path) == File.expand_path(@library_path)
        FileUtils.mkdir_p(@library_path)
        Dir.glob(File.join(sunspot_library_path, '*.jar')).each do |jar|
          jar = File.expand_path(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

      def say(message)
        if @verbose
          STDOUT.puts(message)
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 7 rubygems

Version Path
pduey-sunspot-1.2.1.1 lib/sunspot/installer/library_installer.rb
erichummel-sunspot-1.2.1g lib/sunspot/installer/library_installer.rb
erichummel-sunspot-1.2.1f lib/sunspot/installer/library_installer.rb
erichummel-sunspot-1.2.1b lib/sunspot/installer/library_installer.rb
erichummel-sunspot-1.2.1a lib/sunspot/installer/library_installer.rb
erichummel-sunspot-1.2.1 lib/sunspot/installer/library_installer.rb
lisausa-sunspot-1.2.1.1 lib/sunspot/installer/library_installer.rb
lisausa-sunspot-1.2.1 lib/sunspot/installer/library_installer.rb
sunspot_rbg-1.3.1 lib/sunspot/installer/library_installer.rb
sunspot_rbg-1.3.0 lib/sunspot/installer/library_installer.rb
ruben-sunspot-1.1.4 lib/sunspot/installer/library_installer.rb
ruben-sunspot-1.1.3 lib/sunspot/installer/library_installer.rb
ruben-sunspot-1.1.2 lib/sunspot/installer/library_installer.rb
sunspot-1.2.1 lib/sunspot/installer/library_installer.rb
sunspot-1.2.0 lib/sunspot/installer/library_installer.rb
ruben-sunspot-1.1.1 lib/sunspot/installer/library_installer.rb
ruben-sunspot-1.1.0 lib/sunspot/installer/library_installer.rb
nuatt_sunspot-1.1.0.3 lib/sunspot/installer/library_installer.rb
sunspot-1.1.0 lib/sunspot/installer/library_installer.rb
sunspot-1.0.5 lib/sunspot/installer/library_installer.rb