gojee-sunspot-solr 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- metadata +4 -51
- data/Gemfile +0 -3
- data/README.rdoc +0 -24
- data/bin/sunspot-installer +0 -20
- data/bin/sunspot-solr +0 -80
- data/lib/sunspot/solr/installer.rb +0 -25
- data/lib/sunspot/solr/installer/config_installer.rb +0 -46
- data/lib/sunspot/solr/installer/task_helper.rb +0 -13
- data/lib/sunspot/solr/java.rb +0 -10
- data/lib/sunspot/solr/railtie.rb +0 -15
- data/lib/sunspot/solr/server.rb +0 -229
- data/lib/sunspot/solr/tasks.rb +0 -49
- data/lib/sunspot_solr.rb +0 -5
- data/solr/README.txt +0 -42
- data/solr/etc/jetty.xml +0 -219
- data/solr/etc/webdefault.xml +0 -379
- data/solr/lib/jetty-6.1.26-patched-JETTY-1340.jar +0 -0
- data/solr/lib/jetty-util-6.1.26-patched-JETTY-1340.jar +0 -0
- data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
- data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
- data/solr/lib/servlet-api-2.5-20081211.jar +0 -0
- data/solr/solr/.gitignore +0 -1
- data/solr/solr/README.txt +0 -54
- data/solr/solr/conf/admin-extra.html +0 -31
- data/solr/solr/conf/elevate.xml +0 -36
- data/solr/solr/conf/mapping-ISOLatin1Accent.txt +0 -246
- data/solr/solr/conf/protwords.txt +0 -21
- data/solr/solr/conf/schema.xml +0 -250
- data/solr/solr/conf/scripts.conf +0 -24
- data/solr/solr/conf/solrconfig.xml +0 -934
- data/solr/solr/conf/spellings.txt +0 -2
- data/solr/solr/conf/stopwords.txt +0 -58
- data/solr/solr/conf/synonyms.txt +0 -31
- data/solr/solr/conf/xslt/example.xsl +0 -132
- data/solr/solr/conf/xslt/example_atom.xsl +0 -67
- data/solr/solr/conf/xslt/example_rss.xsl +0 -66
- data/solr/solr/conf/xslt/luke.xsl +0 -337
- data/solr/start.jar +0 -0
- data/solr/webapps/solr.war +0 -0
- data/spec/server_spec.rb +0 -98
- data/spec/spec_helper.rb +0 -18
- data/sunspot_solr.gemspec +0 -39
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gojee-sunspot-solr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -82,55 +82,10 @@ description: ! " Sunspot::Solr provides a bundled Solr distribution for use w
|
|
82
82
|
this\n distribution is well suited to development and testing.\n"
|
83
83
|
email:
|
84
84
|
- mat@patch.com
|
85
|
-
executables:
|
86
|
-
- sunspot-installer
|
87
|
-
- sunspot-solr
|
85
|
+
executables: []
|
88
86
|
extensions: []
|
89
87
|
extra_rdoc_files: []
|
90
|
-
files:
|
91
|
-
- Gemfile
|
92
|
-
- README.rdoc
|
93
|
-
- bin/sunspot-installer
|
94
|
-
- bin/sunspot-solr
|
95
|
-
- lib/sunspot/solr/installer.rb
|
96
|
-
- lib/sunspot/solr/installer/config_installer.rb
|
97
|
-
- lib/sunspot/solr/installer/task_helper.rb
|
98
|
-
- lib/sunspot/solr/java.rb
|
99
|
-
- lib/sunspot/solr/railtie.rb
|
100
|
-
- lib/sunspot/solr/server.rb
|
101
|
-
- lib/sunspot/solr/tasks.rb
|
102
|
-
- lib/sunspot_solr.rb
|
103
|
-
- solr/README.txt
|
104
|
-
- solr/etc/jetty.xml
|
105
|
-
- solr/etc/webdefault.xml
|
106
|
-
- solr/lib/jetty-6.1.26-patched-JETTY-1340.jar
|
107
|
-
- solr/lib/jetty-util-6.1.26-patched-JETTY-1340.jar
|
108
|
-
- solr/lib/jsp-2.1/ant-1.6.5.jar
|
109
|
-
- solr/lib/jsp-2.1/core-3.1.1.jar
|
110
|
-
- solr/lib/jsp-2.1/jsp-2.1.jar
|
111
|
-
- solr/lib/jsp-2.1/jsp-api-2.1.jar
|
112
|
-
- solr/lib/servlet-api-2.5-20081211.jar
|
113
|
-
- solr/solr/.gitignore
|
114
|
-
- solr/solr/README.txt
|
115
|
-
- solr/solr/conf/admin-extra.html
|
116
|
-
- solr/solr/conf/elevate.xml
|
117
|
-
- solr/solr/conf/mapping-ISOLatin1Accent.txt
|
118
|
-
- solr/solr/conf/protwords.txt
|
119
|
-
- solr/solr/conf/schema.xml
|
120
|
-
- solr/solr/conf/scripts.conf
|
121
|
-
- solr/solr/conf/solrconfig.xml
|
122
|
-
- solr/solr/conf/spellings.txt
|
123
|
-
- solr/solr/conf/stopwords.txt
|
124
|
-
- solr/solr/conf/synonyms.txt
|
125
|
-
- solr/solr/conf/xslt/example.xsl
|
126
|
-
- solr/solr/conf/xslt/example_atom.xsl
|
127
|
-
- solr/solr/conf/xslt/example_rss.xsl
|
128
|
-
- solr/solr/conf/xslt/luke.xsl
|
129
|
-
- solr/start.jar
|
130
|
-
- solr/webapps/solr.war
|
131
|
-
- spec/server_spec.rb
|
132
|
-
- spec/spec_helper.rb
|
133
|
-
- sunspot_solr.gemspec
|
88
|
+
files: []
|
134
89
|
homepage: https://github.com/outoftime/sunspot/tree/master/sunspot_solr
|
135
90
|
licenses: []
|
136
91
|
post_install_message:
|
@@ -160,6 +115,4 @@ rubygems_version: 1.8.24
|
|
160
115
|
signing_key:
|
161
116
|
specification_version: 3
|
162
117
|
summary: Bundled Solr distribution for Sunspot
|
163
|
-
test_files:
|
164
|
-
- spec/server_spec.rb
|
165
|
-
- spec/spec_helper.rb
|
118
|
+
test_files: []
|
data/Gemfile
DELETED
data/README.rdoc
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
= Sunspot::Solr
|
2
|
-
|
3
|
-
Sunspot::Solr is a packaged distribution of Solr for use with the
|
4
|
-
Sunspot[http://outoftime.github.com/sunspot] and
|
5
|
-
Sunspot::Rails[https://github.com/outoftime/sunspot/tree/master/sunspot_rails]
|
6
|
-
gems. See those gems' documentation for more information.
|
7
|
-
|
8
|
-
== Installation
|
9
|
-
|
10
|
-
gem install sunspot_solr
|
11
|
-
|
12
|
-
In order to start the daemon, run:
|
13
|
-
|
14
|
-
sunspot-solr start -- [-d /path/to/data/directory] [-p port] [-s path/to/solr/home] [--pid-dir=path/to/pid/dir]
|
15
|
-
|
16
|
-
If you don't specify a data directory, your Solr index will be stored in your
|
17
|
-
operating system's temporary directory.
|
18
|
-
|
19
|
-
If you specify a solr home, the directory must contain a <code>conf</code>
|
20
|
-
directory, which should contain at least <code>schema.xml</code> and
|
21
|
-
<code>solrconfig.xml</code>. Be sure to copy the <code>schema.xml</code> out of
|
22
|
-
the Sunspot gem's <code>solr/solr/conf</code> directory. Sunspot relies on the
|
23
|
-
field name patterns defined in the packaged <code>schema.xml</code>, so those
|
24
|
-
cannot be modified.
|
data/bin/sunspot-installer
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'solr', 'installer')
|
5
|
-
|
6
|
-
home = ARGV.select { |arg| arg !~ /^-/ }.last || File.join(Dir.pwd, "solr")
|
7
|
-
options = {}
|
8
|
-
|
9
|
-
OptionParser.new do |opts|
|
10
|
-
opts.banner = "Usage: sunspot-installer [options] [solr-home]"
|
11
|
-
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
|
12
|
-
options[:verbose] = v
|
13
|
-
end
|
14
|
-
opts.on('-f', '--[no-]force', 'Overwrite schema and solrconfig files with Sunspot default, instead of modifying them (recommended for new Solr installation)') do |f|
|
15
|
-
options[:force] = f
|
16
|
-
end
|
17
|
-
end.parse!
|
18
|
-
|
19
|
-
Sunspot::Solr::Installer.execute(home, options)
|
20
|
-
puts "Installed to #{home}"
|
data/bin/sunspot-solr
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
begin
|
3
|
-
require 'fileutils'
|
4
|
-
require 'tempfile'
|
5
|
-
require 'tmpdir'
|
6
|
-
require 'optparse'
|
7
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'solr', 'server')
|
8
|
-
rescue LoadError => e
|
9
|
-
if require 'rubygems'
|
10
|
-
retry
|
11
|
-
else
|
12
|
-
raise(e)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
server = Sunspot::Solr::Server.new
|
17
|
-
|
18
|
-
opts = OptionParser.new do |opts|
|
19
|
-
opts.banner = "Usage: sunspot-solr (start|stop|run) [options]"
|
20
|
-
|
21
|
-
opts.on '-p', '--port=PORT', 'Port on which to run Solr (default 8983)' do |p|
|
22
|
-
server.port = p
|
23
|
-
end
|
24
|
-
|
25
|
-
opts.on '-b', '--bind-address=address', 'Interface on which to run Solr (default 0.0.0.0)' do |b|
|
26
|
-
server.bind_address = b
|
27
|
-
end
|
28
|
-
|
29
|
-
opts.on '-d', '--data-directory=DIRECTORY', 'Solr data directory' do |d|
|
30
|
-
server.solr_data_dir = File.expand_path(d)
|
31
|
-
end
|
32
|
-
|
33
|
-
opts.on '-s', '--solr-home=HOME', 'Solr home directory (should contain conf/ directory)' do |s|
|
34
|
-
server.solr_home = File.expand_path(s)
|
35
|
-
end
|
36
|
-
|
37
|
-
opts.on '-j', '--solr-jar=JAR', 'Solr start jar' do |j|
|
38
|
-
server.solr_jar = File.expand_path(j)
|
39
|
-
end
|
40
|
-
|
41
|
-
opts.on '--pid-dir=PID_DIR', 'Directory for pid files' do |pd|
|
42
|
-
server.pid_dir = File.expand_path(pd)
|
43
|
-
end
|
44
|
-
|
45
|
-
opts.on '-l', '--log-level=LOG_LEVEL', 'Solr logging level' do |l|
|
46
|
-
server.log_level = l
|
47
|
-
end
|
48
|
-
|
49
|
-
opts.on '--log-file=LOG_FILE', 'Path to Solr log file' do |lf|
|
50
|
-
server.log_file = File.expand_path(lf)
|
51
|
-
end
|
52
|
-
|
53
|
-
opts.on '--max-memory=MEMORY', 'Specify the maximum size of the memory allocation pool' do |mm|
|
54
|
-
server.max_memory = mm
|
55
|
-
end
|
56
|
-
|
57
|
-
opts.on '--min-memory=MEMORY', 'Specify the initial size of the memory allocation pool' do |mm|
|
58
|
-
server.min_memory = mm
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
opts.parse!
|
63
|
-
|
64
|
-
begin
|
65
|
-
case ARGV[0]
|
66
|
-
when 'start'
|
67
|
-
server.start
|
68
|
-
when 'run'
|
69
|
-
server.run
|
70
|
-
when 'stop'
|
71
|
-
server.stop
|
72
|
-
when 'restart'
|
73
|
-
server.stop
|
74
|
-
server.start
|
75
|
-
else
|
76
|
-
abort(opts.help)
|
77
|
-
end
|
78
|
-
rescue Sunspot::Solr::Server::ServerError => e
|
79
|
-
abort(e.message)
|
80
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
%w(task_helper config_installer).each do |file|
|
2
|
-
require File.join(File.dirname(__FILE__), 'installer', file)
|
3
|
-
end
|
4
|
-
|
5
|
-
module Sunspot
|
6
|
-
module Solr
|
7
|
-
class Installer
|
8
|
-
class <<self
|
9
|
-
def execute(solr_home, options = {})
|
10
|
-
new(solr_home, options).execute
|
11
|
-
end
|
12
|
-
|
13
|
-
private :new
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(solr_home, options)
|
17
|
-
@solr_home, @options = solr_home, options
|
18
|
-
end
|
19
|
-
|
20
|
-
def execute
|
21
|
-
ConfigInstaller.execute(File.join(@solr_home, 'conf'), @options)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module Sunspot
|
4
|
-
module Solr
|
5
|
-
class Installer
|
6
|
-
class ConfigInstaller
|
7
|
-
include TaskHelper
|
8
|
-
|
9
|
-
class <<self
|
10
|
-
def execute(config_path, options = {})
|
11
|
-
new(config_path, options).execute
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize(config_path, options)
|
16
|
-
@config_path = config_path
|
17
|
-
@verbose = !!options[:verbose]
|
18
|
-
@force = !!options[:force]
|
19
|
-
end
|
20
|
-
|
21
|
-
def execute
|
22
|
-
sunspot_config_path = File.join(File.dirname(__FILE__), '..', '..',
|
23
|
-
'..', '..', 'solr', 'solr', 'conf')
|
24
|
-
return if File.expand_path(sunspot_config_path) == File.expand_path(@config_path)
|
25
|
-
|
26
|
-
FileUtils.mkdir_p(@config_path)
|
27
|
-
Dir.glob(File.join(sunspot_config_path, '*.*')).each do |file|
|
28
|
-
file = File.expand_path(file)
|
29
|
-
dest = File.join(@config_path, File.basename(file))
|
30
|
-
|
31
|
-
if File.exist?(dest)
|
32
|
-
if @force
|
33
|
-
say("Removing existing file #{dest}")
|
34
|
-
else
|
35
|
-
next
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
say("Copying #{file} => #{dest}")
|
40
|
-
FileUtils.cp(file, dest)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/sunspot/solr/java.rb
DELETED
data/lib/sunspot/solr/railtie.rb
DELETED
data/lib/sunspot/solr/server.rb
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
require 'escape'
|
2
|
-
require 'set'
|
3
|
-
require 'tempfile'
|
4
|
-
require 'sunspot/solr/java'
|
5
|
-
require 'sunspot/solr/installer'
|
6
|
-
|
7
|
-
module Sunspot
|
8
|
-
module Solr
|
9
|
-
class Server #:nodoc:
|
10
|
-
# Raised if #stop is called but the server is not running
|
11
|
-
ServerError = Class.new(RuntimeError)
|
12
|
-
AlreadyRunningError = Class.new(ServerError)
|
13
|
-
NotRunningError = Class.new(ServerError)
|
14
|
-
JavaMissing = Class.new(ServerError)
|
15
|
-
|
16
|
-
# Name of the sunspot executable (shell script)
|
17
|
-
SOLR_START_JAR = File.expand_path(
|
18
|
-
File.join(File.dirname(__FILE__), '..', '..', '..', 'solr', 'start.jar')
|
19
|
-
)
|
20
|
-
|
21
|
-
LOG_LEVELS = Set['SEVERE', 'WARNING', 'INFO', 'CONFIG', 'FINE', 'FINER', 'FINEST']
|
22
|
-
|
23
|
-
attr_accessor :min_memory, :max_memory, :bind_address, :port, :solr_data_dir, :solr_home, :log_file, :multicore
|
24
|
-
attr_writer :pid_dir, :pid_file, :log_level, :solr_data_dir, :solr_home, :solr_jar
|
25
|
-
|
26
|
-
def initialize(*args)
|
27
|
-
ensure_java_installed
|
28
|
-
super(*args)
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# Bootstrap a new solr_home by creating all required
|
33
|
-
# directories.
|
34
|
-
#
|
35
|
-
# ==== Returns
|
36
|
-
#
|
37
|
-
# Boolean:: success
|
38
|
-
#
|
39
|
-
def bootstrap
|
40
|
-
unless @bootstrapped
|
41
|
-
install_solr_home
|
42
|
-
create_solr_directories
|
43
|
-
@bootstrapped = true
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
#
|
48
|
-
# Start the sunspot-solr server. Bootstrap solr_home first,
|
49
|
-
# if neccessary.
|
50
|
-
#
|
51
|
-
# ==== Returns
|
52
|
-
#
|
53
|
-
# Boolean:: success
|
54
|
-
#
|
55
|
-
def start
|
56
|
-
bootstrap
|
57
|
-
|
58
|
-
if File.exist?(pid_path)
|
59
|
-
existing_pid = IO.read(pid_path).to_i
|
60
|
-
begin
|
61
|
-
Process.kill(0, existing_pid)
|
62
|
-
raise(AlreadyRunningError, "Server is already running with PID #{existing_pid}")
|
63
|
-
rescue Errno::ESRCH
|
64
|
-
STDERR.puts("Removing stale PID file at #{pid_path}")
|
65
|
-
FileUtils.rm(pid_path)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
fork do
|
69
|
-
pid = fork do
|
70
|
-
Process.setsid
|
71
|
-
STDIN.reopen('/dev/null')
|
72
|
-
STDOUT.reopen('/dev/null', 'a')
|
73
|
-
STDERR.reopen(STDOUT)
|
74
|
-
run
|
75
|
-
end
|
76
|
-
FileUtils.mkdir_p(pid_dir)
|
77
|
-
File.open(pid_path, 'w') do |file|
|
78
|
-
file << pid
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
#
|
84
|
-
# Run the sunspot-solr server in the foreground. Boostrap
|
85
|
-
# solr_home first, if neccessary.
|
86
|
-
#
|
87
|
-
# ==== Returns
|
88
|
-
#
|
89
|
-
# Boolean:: success
|
90
|
-
#
|
91
|
-
def run
|
92
|
-
bootstrap
|
93
|
-
|
94
|
-
command = ['java']
|
95
|
-
command << "-Xms#{min_memory}" if min_memory
|
96
|
-
command << "-Xmx#{max_memory}" if max_memory
|
97
|
-
command << "-Djetty.port=#{port}" if port
|
98
|
-
command << "-Djetty.host=#{bind_address}" if bind_address
|
99
|
-
command << "-Dsolr.data.dir=#{solr_data_dir}" if solr_data_dir && !multicore
|
100
|
-
command << "-Dsolr.solr.home=#{solr_home}" if solr_home
|
101
|
-
command << "-Djava.util.logging.config.file=#{logging_config_path}" if logging_config_path
|
102
|
-
command << '-jar' << File.basename(solr_jar)
|
103
|
-
FileUtils.cd(File.dirname(solr_jar)) do
|
104
|
-
exec(Escape.shell_command(command))
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
#
|
109
|
-
# Stop the sunspot-solr server.
|
110
|
-
#
|
111
|
-
# ==== Returns
|
112
|
-
#
|
113
|
-
# Boolean:: success
|
114
|
-
#
|
115
|
-
def stop
|
116
|
-
if File.exist?(pid_path)
|
117
|
-
pid = IO.read(pid_path).to_i
|
118
|
-
begin
|
119
|
-
Process.kill('TERM', pid)
|
120
|
-
rescue Errno::ESRCH
|
121
|
-
raise NotRunningError, "Process with PID #{pid} is no longer running"
|
122
|
-
ensure
|
123
|
-
FileUtils.rm(pid_path)
|
124
|
-
end
|
125
|
-
else
|
126
|
-
raise NotRunningError, "No PID file at #{pid_path}"
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
|
131
|
-
def multicore
|
132
|
-
@multicore || false
|
133
|
-
end
|
134
|
-
|
135
|
-
def log_level=(level)
|
136
|
-
unless LOG_LEVELS.include?(level.to_s.upcase)
|
137
|
-
raise(ArgumentError, "#{level} is not a valid log level: Use one of #{LOG_LEVELS.to_a.join(',')}")
|
138
|
-
end
|
139
|
-
@log_level = level.to_s.upcase
|
140
|
-
end
|
141
|
-
|
142
|
-
def log_level
|
143
|
-
@log_level || 'WARNING'
|
144
|
-
end
|
145
|
-
|
146
|
-
def pid_path
|
147
|
-
File.join(pid_dir, pid_file)
|
148
|
-
end
|
149
|
-
|
150
|
-
def pid_file
|
151
|
-
@pid_file || 'sunspot-solr.pid'
|
152
|
-
end
|
153
|
-
|
154
|
-
def pid_dir
|
155
|
-
File.expand_path(@pid_dir || FileUtils.pwd)
|
156
|
-
end
|
157
|
-
|
158
|
-
def solr_data_dir
|
159
|
-
File.expand_path(@solr_data_dir || Dir.tmpdir)
|
160
|
-
end
|
161
|
-
|
162
|
-
def solr_home
|
163
|
-
File.expand_path(@solr_home || File.join(File.dirname(solr_jar), 'solr'))
|
164
|
-
end
|
165
|
-
|
166
|
-
def solr_jar
|
167
|
-
@solr_jar || SOLR_START_JAR
|
168
|
-
end
|
169
|
-
|
170
|
-
#
|
171
|
-
# Copy default solr configuration files from sunspot
|
172
|
-
# gem to the new solr_home/config directory
|
173
|
-
#
|
174
|
-
# ==== Returns
|
175
|
-
#
|
176
|
-
# Boolean:: success
|
177
|
-
#
|
178
|
-
def install_solr_home
|
179
|
-
unless File.exists?(File.join(File.dirname(solr_jar), solr_home))
|
180
|
-
Sunspot::Solr::Installer.execute(
|
181
|
-
solr_home,
|
182
|
-
:force => true,
|
183
|
-
:verbose => true
|
184
|
-
)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
#
|
189
|
-
# Create new solr_home, config, log and pid directories
|
190
|
-
#
|
191
|
-
# ==== Returns
|
192
|
-
#
|
193
|
-
# Boolean:: success
|
194
|
-
#
|
195
|
-
def create_solr_directories
|
196
|
-
[solr_data_dir, pid_dir].each do |path|
|
197
|
-
FileUtils.mkdir_p(path) unless File.exists?(path)
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
private
|
202
|
-
|
203
|
-
def ensure_java_installed
|
204
|
-
unless defined?(@java_installed)
|
205
|
-
@java_installed = Sunspot::Solr::Java.installed?
|
206
|
-
unless @java_installed
|
207
|
-
raise JavaMissing.new("You need a Java Runtime Environment to run the Solr server")
|
208
|
-
end
|
209
|
-
end
|
210
|
-
@java_installed
|
211
|
-
end
|
212
|
-
|
213
|
-
def logging_config_path
|
214
|
-
return @logging_config_path if defined?(@logging_config_path)
|
215
|
-
@logging_config_path =
|
216
|
-
if log_file
|
217
|
-
logging_config = Tempfile.new('logging.properties')
|
218
|
-
logging_config.puts("handlers = java.util.logging.FileHandler")
|
219
|
-
logging_config.puts("java.util.logging.FileHandler.level = #{log_level.to_s.upcase}")
|
220
|
-
logging_config.puts("java.util.logging.FileHandler.pattern = #{log_file}")
|
221
|
-
logging_config.puts("java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter")
|
222
|
-
logging_config.flush
|
223
|
-
logging_config.close
|
224
|
-
logging_config.path
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
end
|
229
|
-
end
|