Sha256: c31877cb3d2342b0db4b86fb04df837ca914cf2d36da27b2e60a00221e905c81

Contents?: true

Size: 1.23 KB

Versions: 25

Compression:

Stored size: 1.23 KB

Contents

require 'fileutils'

module Sunspot
  module Solr
    class Installer
      class ConfigInstaller
        include TaskHelper

        class <<self
          def execute(config_path, options = {})
            new(config_path, options).execute
          end
        end

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

        def execute
          sunspot_config_path = File.join(File.dirname(__FILE__), '..', '..',
                                          '..', '..', 'solr', 'solr', 'conf')
          return if File.expand_path(sunspot_config_path) == File.expand_path(@config_path)

          FileUtils.mkdir_p(@config_path)
          Dir.glob(File.join(sunspot_config_path, '*.*')).each do |file|
            file = File.expand_path(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
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 8 rubygems

Version Path
sunspot_solr-2.0.0 lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-2.0.0.pre.130115 lib/sunspot/solr/installer/config_installer.rb
gojee-sunspot-solr-2.0.5 lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-2.0.0.pre.120925 lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-2.0.0.pre.120924 sunspot_solr/lib/sunspot/solr/installer/config_installer.rb
sunspot_rails-2.0.0.pre.120924 sunspot_solr/lib/sunspot/solr/installer/config_installer.rb
sunspot-2.0.0.pre.120924 sunspot_solr/lib/sunspot/solr/installer/config_installer.rb
gojee-sunspot-solr-2.0.4 lib/sunspot/solr/installer/config_installer.rb
gojee-sunspot-solr-2.0.2 lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-2.0.0.pre.120720 lib/sunspot/solr/installer/config_installer.rb
culturecode-sunspot_solr-2.0.0.pre lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-1.3.3 lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-1.3.2 lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-2.0.0.pre.120417 lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-2.0.0.pre.120415 lib/sunspot/solr/installer/config_installer.rb
erichummel-sunspot_solr-2.0.0.pre.111215d lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-1.3.1 lib/sunspot/solr/installer/config_installer.rb
erichummel-sunspot_solr-2.0.0.pre.111215 lib/sunspot/solr/installer/config_installer.rb
sunspot_solr-2.0.0.pre.111215 lib/sunspot/solr/installer/config_installer.rb
cb_sunspot_solr-2.0.0.pre.5 lib/sunspot/solr/installer/config_installer.rb