sunspot_solr 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/Gemfile +1 -1
- data/Rakefile +9 -0
- data/lib/sunspot/solr/installer.rb +66 -8
- data/lib/sunspot/solr/java.rb +17 -4
- data/lib/sunspot/solr/server.rb +2 -13
- data/spec/installer_spec.rb +82 -0
- data/spec/java_spec.rb +58 -0
- data/spec/server_spec.rb +36 -68
- data/spec/spec_helper.rb +4 -16
- data/sunspot_solr.gemspec +2 -6
- metadata +17 -18
- data/lib/sunspot/solr/installer/config_installer.rb +0 -87
- data/lib/sunspot/solr/installer/task_helper.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a087d9d877cc686d5f2c13d0f432d1716a6f554
|
4
|
+
data.tar.gz: 62626a3807fd8db96f3386e80898ac32f7163431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07097ad6bc5a3a557898097ded608601c56216fbbca639c8beaad203f98295168ef9550a471f621d79b02dab826b0aa4676a2f56dc1997e3dc3111fc3f14b09e
|
7
|
+
data.tar.gz: 80d9f86e9187be17713a4531252d2bc124b8f6741291bdd43b47f77a9a125a994d94fcf1444234a2a723c207dd252d62020b11bb04c7fd9a4d25f4cc647191a0
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
CHANGED
data/Rakefile
ADDED
@@ -1,24 +1,82 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
end
|
1
|
+
require "fileutils"
|
2
|
+
require "pathname"
|
4
3
|
|
5
4
|
module Sunspot
|
6
5
|
module Solr
|
7
6
|
class Installer
|
8
7
|
class <<self
|
9
8
|
def execute(solr_home, options = {})
|
10
|
-
new(solr_home, options).execute
|
9
|
+
new(Pathname(solr_home).expand_path, options).execute
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_reader :config_path, :options
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def execute(config_path, options = {})
|
17
|
+
new(config_path, options).execute
|
11
18
|
end
|
19
|
+
end
|
12
20
|
|
13
|
-
|
21
|
+
def initialize(config_path, options)
|
22
|
+
@config_path = config_path
|
23
|
+
@options = options
|
14
24
|
end
|
15
25
|
|
16
|
-
def
|
17
|
-
|
26
|
+
def force?
|
27
|
+
!!@options[:force]
|
28
|
+
end
|
29
|
+
|
30
|
+
def verbose?
|
31
|
+
!!@options[:verbose]
|
18
32
|
end
|
19
33
|
|
20
34
|
def execute
|
21
|
-
|
35
|
+
return if sunspot_config_path == config_path
|
36
|
+
|
37
|
+
config_source_files.each do |source_path|
|
38
|
+
destination_path = get_destination_path(source_path)
|
39
|
+
|
40
|
+
if destination_path.exist?
|
41
|
+
next unless force?
|
42
|
+
output "Removing existing file #{ destination_path }"
|
43
|
+
end
|
44
|
+
|
45
|
+
destination_dir = destination_path.dirname
|
46
|
+
unless destination_dir.exist?
|
47
|
+
output "Creating directory #{ destination_dir }"
|
48
|
+
destination_dir.mkpath
|
49
|
+
end
|
50
|
+
|
51
|
+
output "Copying #{ source_path } => #{ destination_path }"
|
52
|
+
FileUtils.copy(source_path, destination_path)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def sunspot_config_path
|
57
|
+
@sunspot_config_path ||= Pathname(__FILE__).join("../../../../solr/solr")
|
58
|
+
end
|
59
|
+
|
60
|
+
def config_source_files
|
61
|
+
@config_source_files ||= glob_source_files
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def get_destination_path(source_path)
|
67
|
+
source_path.sub(sunspot_config_path.to_s, config_path.to_s)
|
68
|
+
end
|
69
|
+
|
70
|
+
def glob_source_files
|
71
|
+
source_files = []
|
72
|
+
source_files += Pathname.glob(sunspot_config_path.join("solr.xml"))
|
73
|
+
source_files += Pathname.glob(sunspot_config_path.join("configsets/**/*"))
|
74
|
+
source_files += Pathname.glob(sunspot_config_path.join("**/core.properties"))
|
75
|
+
source_files.select(&:file?).map(&:expand_path)
|
76
|
+
end
|
77
|
+
|
78
|
+
def output message
|
79
|
+
STDOUT.puts(message) if verbose?
|
22
80
|
end
|
23
81
|
end
|
24
82
|
end
|
data/lib/sunspot/solr/java.rb
CHANGED
@@ -1,12 +1,25 @@
|
|
1
|
-
require
|
1
|
+
require "rbconfig"
|
2
2
|
|
3
3
|
module Sunspot
|
4
4
|
module Solr
|
5
5
|
module Java
|
6
|
-
|
6
|
+
class << self
|
7
|
+
def ensure_install!
|
8
|
+
if installed?
|
9
|
+
true
|
10
|
+
else
|
11
|
+
raise Sunspot::Solr::Server::JavaMissing, "You need a Java Runtime Environment to run the Solr server"
|
12
|
+
end
|
13
|
+
end
|
7
14
|
|
8
|
-
|
9
|
-
|
15
|
+
def installed?
|
16
|
+
system("java", "-version", [:out, :err] => null_device)
|
17
|
+
$?.exitstatus.zero?
|
18
|
+
end
|
19
|
+
|
20
|
+
def null_device
|
21
|
+
RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? "NUL" : "/dev/null"
|
22
|
+
end
|
10
23
|
end
|
11
24
|
end
|
12
25
|
end
|
data/lib/sunspot/solr/server.rb
CHANGED
@@ -23,9 +23,8 @@ module Sunspot
|
|
23
23
|
|
24
24
|
attr_writer :pid_dir, :pid_file, :solr_home, :solr_executable
|
25
25
|
|
26
|
-
def initialize
|
27
|
-
|
28
|
-
super(*args)
|
26
|
+
def initialize
|
27
|
+
Sunspot::Solr::Java.ensure_install!
|
29
28
|
end
|
30
29
|
|
31
30
|
#
|
@@ -195,16 +194,6 @@ module Sunspot
|
|
195
194
|
|
196
195
|
private
|
197
196
|
|
198
|
-
def ensure_java_installed
|
199
|
-
unless defined?(@java_installed)
|
200
|
-
@java_installed = Sunspot::Solr::Java.installed?
|
201
|
-
unless @java_installed
|
202
|
-
raise JavaMissing.new("You need a Java Runtime Environment to run the Solr server")
|
203
|
-
end
|
204
|
-
end
|
205
|
-
@java_installed
|
206
|
-
end
|
207
|
-
|
208
197
|
def logging_config_path
|
209
198
|
return @logging_config_path if defined?(@logging_config_path)
|
210
199
|
@logging_config_path =
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Sunspot::Solr::Installer do
|
4
|
+
let(:install_dir) { Pathname(Dir.mktmpdir + "/test_install_directory") }
|
5
|
+
let(:install_manifest) do
|
6
|
+
[ "solr.xml",
|
7
|
+
"configsets/sunspot/conf/_rest_managed.json",
|
8
|
+
"configsets/sunspot/conf/admin-extra.html",
|
9
|
+
"configsets/sunspot/conf/currency.xml",
|
10
|
+
"configsets/sunspot/conf/elevate.xml",
|
11
|
+
"configsets/sunspot/conf/lang/stopwords_en.txt",
|
12
|
+
"configsets/sunspot/conf/mapping-ISOLatin1Accent.txt",
|
13
|
+
"configsets/sunspot/conf/protwords.txt",
|
14
|
+
"configsets/sunspot/conf/schema.xml",
|
15
|
+
"configsets/sunspot/conf/scripts.conf",
|
16
|
+
"configsets/sunspot/conf/solrconfig.xml",
|
17
|
+
"configsets/sunspot/conf/spellings.txt",
|
18
|
+
"configsets/sunspot/conf/synonyms.txt",
|
19
|
+
"default/core.properties",
|
20
|
+
"development/core.properties",
|
21
|
+
"test/core.properties" ]
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:destination_files) { install_manifest.map { |file| install_dir.join(file) } }
|
25
|
+
|
26
|
+
it "creates the install directory" do
|
27
|
+
expect { described_class.execute(install_dir.to_s) }.
|
28
|
+
to change { install_dir.exist? }.from(false).to(true)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "installs the Solr config files into the specified directory" do
|
32
|
+
described_class.execute(install_dir.to_s)
|
33
|
+
installed_files = Pathname.glob(install_dir.join("**/*")).select(&:file?)
|
34
|
+
expect(installed_files).to contain_exactly(*destination_files).and all( be_exist )
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "force" do
|
38
|
+
let(:existing_file) { install_dir.join("solr.xml") }
|
39
|
+
|
40
|
+
before do
|
41
|
+
install_dir.mkpath
|
42
|
+
File.write(existing_file, "Hello, World!")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "does not overwrite existing files when 'force' is false (default)" do
|
46
|
+
expect { described_class.execute(install_dir) }.
|
47
|
+
not_to change { existing_file.read }.from "Hello, World!"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "overwrites existing files when 'force' is true" do
|
51
|
+
expect { described_class.execute(install_dir, force: true) }.
|
52
|
+
to change { existing_file.read }.
|
53
|
+
from("Hello, World!").
|
54
|
+
to(%r{<solr>(.|\n)*</solr>})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "verbose" do
|
59
|
+
let(:fake_stdout) { StringIO.new }
|
60
|
+
|
61
|
+
before do
|
62
|
+
stub_const("STDOUT", fake_stdout)
|
63
|
+
install_dir.mkpath
|
64
|
+
File.write(install_dir.join("solr.xml"), "Hello, World!")
|
65
|
+
end
|
66
|
+
|
67
|
+
it "does not output to STDOUT when 'verbose' is false (default)" do
|
68
|
+
described_class.execute(install_dir, force: true)
|
69
|
+
fake_stdout.rewind
|
70
|
+
expect(fake_stdout.read).to be_empty
|
71
|
+
end
|
72
|
+
|
73
|
+
it "outputs to STDOUT when 'verbose' is true" do
|
74
|
+
described_class.execute(install_dir, force: true, verbose: true)
|
75
|
+
fake_stdout.rewind
|
76
|
+
expect(fake_stdout.read).
|
77
|
+
to match(/Removing existing file .+/).
|
78
|
+
and match(/Creating directory .+/).
|
79
|
+
and match(/Copying .+ => .+/)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
data/spec/java_spec.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Sunspot::Solr::Java do
|
4
|
+
|
5
|
+
describe ".ensure_install!" do
|
6
|
+
subject { described_class.ensure_install! }
|
7
|
+
|
8
|
+
context "when Java is installed" do
|
9
|
+
before { expect(described_class).to receive(:installed?) { true } }
|
10
|
+
it { should be true }
|
11
|
+
end
|
12
|
+
|
13
|
+
context "when Java is not installed" do
|
14
|
+
before { expect(described_class).to receive(:installed?) { false } }
|
15
|
+
it "should raise a JavaMissing error" do
|
16
|
+
expect { subject }.
|
17
|
+
to raise_error Sunspot::Solr::Server::JavaMissing, /You need a Java/
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe ".installed?" do
|
23
|
+
subject { described_class.installed? }
|
24
|
+
|
25
|
+
context "when Java can be found" do
|
26
|
+
let(:command) { system("echo") }
|
27
|
+
before do
|
28
|
+
expect(described_class).to receive(:system).
|
29
|
+
with("java", "-version", [:out, :err] => "/dev/null") { system("echo", out: "/dev/null") }
|
30
|
+
end
|
31
|
+
it { should be true }
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when Java cannot be found" do
|
35
|
+
before do
|
36
|
+
expect(described_class).to receive(:system).
|
37
|
+
with("java", "-version", [:out, :err] => "/dev/null") { system("some-command-not-found") }
|
38
|
+
end
|
39
|
+
it { should be false }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe ".null_device" do
|
44
|
+
subject { described_class.null_device }
|
45
|
+
|
46
|
+
before { stub_const("RbConfig::CONFIG", { "host_os" => host_os }) }
|
47
|
+
|
48
|
+
context "when the OS is Windows" do
|
49
|
+
let(:host_os) { "mswin32" }
|
50
|
+
it { should eq "NUL" }
|
51
|
+
end
|
52
|
+
|
53
|
+
context "when the OS is not Windows" do
|
54
|
+
let(:host_os) { "darwin15.2.0" }
|
55
|
+
it { should eq "/dev/null" }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/spec/server_spec.rb
CHANGED
@@ -1,87 +1,55 @@
|
|
1
|
-
require
|
2
|
-
require 'tempfile'
|
1
|
+
require "spec_helper"
|
3
2
|
|
4
3
|
describe Sunspot::Solr::Server do
|
5
|
-
SUNSPOT_START_JAR = File.expand_path(
|
6
|
-
File.join(File.dirname(__FILE__), '..', '..', 'solr', 'start.jar')
|
7
|
-
)
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@server.should_not_receive(:fork)
|
15
|
-
@server.should_receive(:exec).with(/java .*-jar start.jar/)
|
16
|
-
@server.run
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'runs Java with memory set' do
|
20
|
-
@server.memory = 2048
|
21
|
-
@server.should_receive(:exec).with(/-Xmx2048/)
|
22
|
-
@server.should_receive(:exec).with(/-Xms2048/)
|
23
|
-
@server.run
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'runs Jetty with specified port' do
|
27
|
-
@server.port = 8981
|
28
|
-
@server.should_receive(:exec).with(/-Djetty\.port=8981/)
|
29
|
-
@server.run
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'runs Solr with specified Solr home' do
|
33
|
-
@server.solr_home = '/tmp/var/solr'
|
34
|
-
@server.should_receive(:exec).with(%r(-Dsolr\.solr\.home=/tmp/var/solr))
|
35
|
-
@server.run
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'runs Solr with specified Solr jar' do
|
39
|
-
@server.solr_jar = SUNSPOT_START_JAR
|
40
|
-
FileUtils.should_receive(:cd).with(File.dirname(SUNSPOT_START_JAR))
|
41
|
-
@server.run
|
5
|
+
describe ".new" do
|
6
|
+
it "ensures Java is installed upon initialization" do
|
7
|
+
expect(Sunspot::Solr::Java).to receive(:ensure_install!)
|
8
|
+
described_class.new
|
9
|
+
end
|
42
10
|
end
|
43
11
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
12
|
+
describe "#bootstrap" do
|
13
|
+
it "installs the solr home directory if it doesn't yet exist" do
|
14
|
+
specified_dir = Dir.mktmpdir + "/test_directory"
|
15
|
+
subject.solr_home = specified_dir
|
16
|
+
expect(Sunspot::Solr::Installer).to receive(:execute).
|
17
|
+
with(specified_dir, force: true, verbose: true)
|
18
|
+
subject.bootstrap
|
19
|
+
end
|
49
20
|
end
|
50
21
|
|
51
|
-
describe
|
52
|
-
before :
|
53
|
-
@server.log_level = 'info'
|
54
|
-
@server.log_file = 'log/sunspot-development.log'
|
55
|
-
Tempfile.should_receive(:new).with('logging.properties').and_return(@tempfile = StringIO.new)
|
56
|
-
@tempfile.should_receive(:flush)
|
57
|
-
@tempfile.should_receive(:close)
|
58
|
-
@tempfile.stub(:path).and_return('/tmp/logging.properties.12345')
|
59
|
-
@server.stub(:exec)
|
60
|
-
end
|
22
|
+
describe "#run" do
|
23
|
+
before { expect(subject).to receive(:bootstrap) }
|
61
24
|
|
62
|
-
it 'runs Solr
|
63
|
-
|
64
|
-
|
25
|
+
it 'runs the Solr server in the foreground' do
|
26
|
+
expect(subject).to receive(:exec).with("./solr", "start", "-f", any_args)
|
27
|
+
subject.run
|
65
28
|
end
|
66
29
|
|
67
|
-
it '
|
68
|
-
|
69
|
-
|
30
|
+
it 'runs the Solr server with the memory specified' do
|
31
|
+
subject.memory = 2048
|
32
|
+
expect(subject).to receive(:exec).with("./solr", "start", "-f", "-m", "2048", any_args)
|
33
|
+
subject.run
|
70
34
|
end
|
71
35
|
|
72
|
-
it '
|
73
|
-
|
74
|
-
|
36
|
+
it 'runs the Solr server with the port specified' do
|
37
|
+
subject.port = 8981
|
38
|
+
expect(subject).to receive(:exec).with("./solr", "start", "-f", "-p", "8981", any_args)
|
39
|
+
subject.run
|
75
40
|
end
|
76
41
|
|
77
|
-
it '
|
78
|
-
|
79
|
-
|
42
|
+
it 'runs the Solr server with the hostname specified' do
|
43
|
+
subject.bind_address = "0.0.0.0"
|
44
|
+
expect(subject).to receive(:exec).with("./solr", "start", "-f", "-h", "0.0.0.0", any_args)
|
45
|
+
subject.run
|
80
46
|
end
|
81
47
|
|
82
|
-
it '
|
83
|
-
|
84
|
-
|
48
|
+
it 'runs the Solr server with the solr home directory specified' do
|
49
|
+
specified_dir = Dir.mktmpdir + "/test_directory"
|
50
|
+
subject.solr_home = specified_dir
|
51
|
+
expect(subject).to receive(:exec).with(any_args, "-s", specified_dir)
|
52
|
+
subject.run
|
85
53
|
end
|
86
54
|
end
|
87
55
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,18 +1,6 @@
|
|
1
|
-
|
2
|
-
require 'rspec'
|
3
|
-
rescue LoadError => e
|
4
|
-
require 'spec'
|
5
|
-
end
|
6
|
-
|
7
|
-
require 'sunspot_solr'
|
8
|
-
|
9
|
-
rspec =
|
10
|
-
begin
|
11
|
-
RSpec
|
12
|
-
rescue NameError, ArgumentError
|
13
|
-
Spec::Runner
|
14
|
-
end
|
1
|
+
require "sunspot_solr"
|
15
2
|
|
16
|
-
|
17
|
-
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.filter_run_including focus: true
|
5
|
+
config.run_all_when_everything_filtered = true
|
18
6
|
end
|
data/sunspot_solr.gemspec
CHANGED
@@ -29,10 +29,6 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
30
30
|
s.require_paths = ["lib"]
|
31
31
|
|
32
|
-
s.add_development_dependency '
|
33
|
-
s.add_development_dependency '
|
34
|
-
|
35
|
-
s.rdoc_options << '--webcvs=http://github.com/outoftime/sunspot/tree/master/%s' <<
|
36
|
-
'--title' << 'Sunspot-Solr - Bundled Solr distribution for Sunspot - API Documentation' <<
|
37
|
-
'--main' << 'README.rdoc'
|
32
|
+
s.add_development_dependency 'rake', '~> 11.1.2'
|
33
|
+
s.add_development_dependency 'rspec', '~> 3.4.0'
|
38
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunspot_solr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Brown
|
@@ -26,36 +26,36 @@ authors:
|
|
26
26
|
autorequire:
|
27
27
|
bindir: bin
|
28
28
|
cert_chain: []
|
29
|
-
date: 2016-
|
29
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
30
30
|
dependencies:
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: rake
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
35
|
- - "~>"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 11.1.2
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
42
|
- - "~>"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
44
|
+
version: 11.1.2
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
|
-
name:
|
46
|
+
name: rspec
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- - "
|
49
|
+
- - "~>"
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version:
|
51
|
+
version: 3.4.0
|
52
52
|
type: :development
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- - "
|
56
|
+
- - "~>"
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
58
|
+
version: 3.4.0
|
59
59
|
description: |2
|
60
60
|
Sunspot::Solr provides a bundled Solr distribution for use with Sunspot.
|
61
61
|
Typical deployment environments will require more configuration, but this
|
@@ -68,13 +68,13 @@ executables:
|
|
68
68
|
extensions: []
|
69
69
|
extra_rdoc_files: []
|
70
70
|
files:
|
71
|
+
- ".rspec"
|
71
72
|
- Gemfile
|
72
73
|
- README.rdoc
|
74
|
+
- Rakefile
|
73
75
|
- bin/sunspot-installer
|
74
76
|
- bin/sunspot-solr
|
75
77
|
- lib/sunspot/solr/installer.rb
|
76
|
-
- lib/sunspot/solr/installer/config_installer.rb
|
77
|
-
- lib/sunspot/solr/installer/task_helper.rb
|
78
78
|
- lib/sunspot/solr/java.rb
|
79
79
|
- lib/sunspot/solr/railtie.rb
|
80
80
|
- lib/sunspot/solr/server.rb
|
@@ -556,6 +556,8 @@ files:
|
|
556
556
|
- solr/solr/solr.xml
|
557
557
|
- solr/solr/test/core.properties
|
558
558
|
- solr/solr/zoo.cfg
|
559
|
+
- spec/installer_spec.rb
|
560
|
+
- spec/java_spec.rb
|
559
561
|
- spec/server_spec.rb
|
560
562
|
- spec/spec_helper.rb
|
561
563
|
- sunspot_solr.gemspec
|
@@ -564,12 +566,7 @@ licenses:
|
|
564
566
|
- MIT
|
565
567
|
metadata: {}
|
566
568
|
post_install_message:
|
567
|
-
rdoc_options:
|
568
|
-
- "--webcvs=http://github.com/outoftime/sunspot/tree/master/%s"
|
569
|
-
- "--title"
|
570
|
-
- Sunspot-Solr - Bundled Solr distribution for Sunspot - API Documentation
|
571
|
-
- "--main"
|
572
|
-
- README.rdoc
|
569
|
+
rdoc_options: []
|
573
570
|
require_paths:
|
574
571
|
- lib
|
575
572
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -589,5 +586,7 @@ signing_key:
|
|
589
586
|
specification_version: 4
|
590
587
|
summary: Bundled Solr distribution for Sunspot
|
591
588
|
test_files:
|
589
|
+
- spec/installer_spec.rb
|
590
|
+
- spec/java_spec.rb
|
592
591
|
- spec/server_spec.rb
|
593
592
|
- spec/spec_helper.rb
|
@@ -1,87 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'rake/file_list'
|
3
|
-
|
4
|
-
module Sunspot
|
5
|
-
module Solr
|
6
|
-
class Installer
|
7
|
-
class ConfigInstaller
|
8
|
-
include TaskHelper
|
9
|
-
include FileUtils
|
10
|
-
|
11
|
-
attr_accessor :config_path, :force
|
12
|
-
alias_method :force?, :force
|
13
|
-
|
14
|
-
class <<self
|
15
|
-
def execute(config_path, options = {})
|
16
|
-
new(config_path, options).execute
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize(config_path, options)
|
21
|
-
self.config_path = File.expand_path config_path
|
22
|
-
self.force = !!options[:force]
|
23
|
-
@verbose = !!options[:verbose]
|
24
|
-
end
|
25
|
-
|
26
|
-
def execute
|
27
|
-
return if sunspot_config_path == config_path
|
28
|
-
|
29
|
-
sunspot_config_files do |file, dest|
|
30
|
-
if File.exist?(dest)
|
31
|
-
next unless force?
|
32
|
-
say("Removing existing file #{dest}")
|
33
|
-
end
|
34
|
-
|
35
|
-
dir = dest.pathmap('%d')
|
36
|
-
unless File.exist?(dir)
|
37
|
-
say("Creating directory #{dir}")
|
38
|
-
mkdir_p dir
|
39
|
-
end
|
40
|
-
|
41
|
-
next if File.directory? file
|
42
|
-
|
43
|
-
say("Copying #{file} => #{dest}")
|
44
|
-
cp(file, dest)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def sunspot_config_files(&blk)
|
51
|
-
src, dest = expand_files(config_source_files), expand_files(config_dest_files)
|
52
|
-
src.zip(dest).each(&blk)
|
53
|
-
end
|
54
|
-
|
55
|
-
def config_dest_files
|
56
|
-
@config_dest_files ||= config_source_files.pathmap("%{^#{sunspot_config_path},#{config_path}}p")
|
57
|
-
end
|
58
|
-
|
59
|
-
def config_source_files
|
60
|
-
@config_source_files ||= glob_source_files
|
61
|
-
end
|
62
|
-
|
63
|
-
def glob_source_files
|
64
|
-
list = Rake::FileList.new("#{sunspot_config_path}/**/*") do |fl|
|
65
|
-
fl.include "#{sunspot_config_path}/../solr.xml", "#{sunspot_config_path}/../**/core.properties"
|
66
|
-
end
|
67
|
-
|
68
|
-
list.map! { |path| path.first(2) == '..' ? File.join(sunspot_config_path, path) : path }
|
69
|
-
|
70
|
-
list
|
71
|
-
end
|
72
|
-
|
73
|
-
def sunspot_config_path
|
74
|
-
@sunspot_config_path ||= File.expand_path sunspot_relative_config_path
|
75
|
-
end
|
76
|
-
|
77
|
-
def sunspot_relative_config_path
|
78
|
-
File.join File.dirname(__FILE__), '..', '..', '..', '..', 'solr', 'solr', 'configsets'
|
79
|
-
end
|
80
|
-
|
81
|
-
def expand_files(filelist)
|
82
|
-
filelist.map { |file| File.expand_path file }
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|