solr_makr 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solr_makr/application.rb +14 -2
- data/lib/solr_makr/commands/shared.rb +3 -1
- data/lib/solr_makr/commands/write_yaml.rb +31 -0
- data/lib/solr_makr/core.rb +1 -1
- data/lib/solr_makr/solr_configuration.rb +6 -0
- data/lib/solr_makr/solr_request.rb +1 -1
- data/lib/solr_makr/version.rb +1 -1
- data/lib/solr_makr.rb +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2720cbe35de26ce4b3589136cdb8f27084f7156
|
4
|
+
data.tar.gz: 421721ad39cf9a26323a6c1d13b2956b14c4901e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 700f6670a45689960c28c0a886d1eac4ce8f8e6318505ccda24a2120393e5563956044ca574e673aee96b2c5183aa38d4151469d27090d7171626a7ad833039d
|
7
|
+
data.tar.gz: 2613c3fb361948f4d66baeb13ac69cc29c35de4afb8bf41299745469da7c7b9580877072b7a1faa839974cb9e203452cde083461889e1da55ebb463fdd7d2a8b
|
@@ -15,6 +15,7 @@ module SolrMakr
|
|
15
15
|
|
16
16
|
global_option '-d', '--solr-home DIR', 'Path to the solr home directory'
|
17
17
|
global_option '-p', '--solr-port PORT', Integer, 'Port to use to communicate with the solr API'
|
18
|
+
global_option '-H', '--solr-host HOST', String, 'Host [default localhost]'
|
18
19
|
global_option '-V', '--verbose', 'Show verbose output.'
|
19
20
|
|
20
21
|
command :create do |c|
|
@@ -36,11 +37,22 @@ module SolrMakr
|
|
36
37
|
command :destroy do |c|
|
37
38
|
c.syntax = "#{NAME} destroy NAME"
|
38
39
|
|
39
|
-
c.option '--purge', 'Purge the solr core\'s instance directory'
|
40
|
-
|
41
40
|
c.description = "Unload and remove a solr core."
|
42
41
|
|
43
42
|
c.when_called Commands::DestroyCore, :run!
|
43
|
+
|
44
|
+
c.option '--purge', 'Purge the solr core\'s instance directory'
|
45
|
+
end
|
46
|
+
|
47
|
+
command :yaml do |c|
|
48
|
+
c.syntax = "#{NAME} yaml NAME"
|
49
|
+
|
50
|
+
c.description = 'Print a YAML config for sunspot to stdout'
|
51
|
+
|
52
|
+
c.when_called Commands::WriteYaml, :run!
|
53
|
+
|
54
|
+
c.option '-e', '--env ENVIRONMENT', 'Environment name'
|
55
|
+
c.option '--log-level LEVEL', String, 'Log level'
|
44
56
|
end
|
45
57
|
|
46
58
|
run!
|
@@ -23,7 +23,7 @@ module SolrMakr
|
|
23
23
|
# @return [Struct]
|
24
24
|
attr_reader :options
|
25
25
|
|
26
|
-
delegate :home, :port, prefix: :solr, to: :solr_config
|
26
|
+
delegate :home, :host, :port, prefix: :solr, to: :solr_config
|
27
27
|
|
28
28
|
alias_method :port, :solr_port
|
29
29
|
|
@@ -41,6 +41,7 @@ module SolrMakr
|
|
41
41
|
options.default shared_options
|
42
42
|
|
43
43
|
solr_config.home = options.solr_home
|
44
|
+
solr_config.host = options.solr_host
|
44
45
|
solr_config.port = options.solr_port
|
45
46
|
|
46
47
|
run
|
@@ -74,6 +75,7 @@ module SolrMakr
|
|
74
75
|
def shared_options
|
75
76
|
{
|
76
77
|
solr_home: solr_home,
|
78
|
+
solr_host: solr_host,
|
77
79
|
solr_port: solr_port
|
78
80
|
}
|
79
81
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module SolrMakr
|
2
|
+
module Commands
|
3
|
+
class WriteYaml
|
4
|
+
include Shared
|
5
|
+
|
6
|
+
config.acts_on_single_core = true
|
7
|
+
|
8
|
+
def run
|
9
|
+
options.default log_level: 'WARNING', env: 'production'
|
10
|
+
|
11
|
+
config = build_config
|
12
|
+
|
13
|
+
say config.to_yaml
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [{String => {String => {String => Object}}}]
|
17
|
+
def build_config
|
18
|
+
{
|
19
|
+
options.env => {
|
20
|
+
"solr" => {
|
21
|
+
"hostname" => solr_host,
|
22
|
+
"port" => solr_port,
|
23
|
+
"log_level" => options.log_level,
|
24
|
+
"path" => "/solr/#{core.name}"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/solr_makr/core.rb
CHANGED
@@ -13,9 +13,11 @@ module SolrMakr
|
|
13
13
|
include SolrRequest
|
14
14
|
|
15
15
|
DEFAULT_HOME = '/opt/solr/jetty-solr/'
|
16
|
+
DEFAULT_HOST = 'localhost'
|
16
17
|
DEFAULT_PORT = 8983
|
17
18
|
|
18
19
|
attribute :home, Pathlike, default: :default_home
|
20
|
+
attribute :host, String, default: :default_host
|
19
21
|
attribute :port, Integer, default: :default_port
|
20
22
|
|
21
23
|
def initialize(env = ENV)
|
@@ -74,5 +76,9 @@ module SolrMakr
|
|
74
76
|
def default_home
|
75
77
|
Pathname.new env.fetch 'SOLR_HOME', DEFAULT_HOME
|
76
78
|
end
|
79
|
+
|
80
|
+
def default_host
|
81
|
+
env.fetch 'SOLR_HOST', DEFAULT_HOST
|
82
|
+
end
|
77
83
|
end
|
78
84
|
end
|
data/lib/solr_makr/version.rb
CHANGED
data/lib/solr_makr.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require "pathname"
|
3
|
+
require "yaml"
|
3
4
|
|
4
5
|
class Pathname
|
5
6
|
alias_method :to_str, :to_s
|
@@ -26,6 +27,7 @@ require "solr_makr/commands/shared"
|
|
26
27
|
require "solr_makr/commands/create_core"
|
27
28
|
require "solr_makr/commands/destroy_core"
|
28
29
|
require "solr_makr/commands/list_cores"
|
30
|
+
require "solr_makr/commands/write_yaml"
|
29
31
|
require "solr_makr/application"
|
30
32
|
|
31
33
|
module SolrMakr
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solr_makr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexa Grey
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- lib/solr_makr/commands/destroy_core.rb
|
167
167
|
- lib/solr_makr/commands/list_cores.rb
|
168
168
|
- lib/solr_makr/commands/shared.rb
|
169
|
+
- lib/solr_makr/commands/write_yaml.rb
|
169
170
|
- lib/solr_makr/core.rb
|
170
171
|
- lib/solr_makr/core_status.rb
|
171
172
|
- lib/solr_makr/solr_configuration.rb
|