muck-solr 0.4.0 → 0.4.1

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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
3
- :major: 0
4
2
  :minor: 4
3
+ :patch: 1
4
+ :major: 0
@@ -15,6 +15,9 @@ end
15
15
  unless defined? SOLR_DATA_PATH
16
16
  SOLR_DATA_PATH = ENV["SOLR_DATA_PATH"] || "#{RAILS_ROOT}/solr/#{ENV['RAILS_ENV']}"
17
17
  end
18
+ unless defined? SOLR_CONFIG_PATH
19
+ SOLR_CONFIG_PATH = ENV["SOLR_CONFIG_PATH"] || SOLR_PATH
20
+ end
18
21
 
19
22
  unless defined? SOLR_PORT
20
23
  config = YAML::load_file(RAILS_ROOT+'/config/solr.yml')
@@ -1,7 +1,7 @@
1
1
  namespace :solr do
2
2
 
3
3
  desc 'Starts Solr. Options accepted: RAILS_ENV=your_env, PORT=XX. Defaults to development if none.'
4
- task :start do
4
+ task :start => :environment do
5
5
  require File.expand_path("#{File.dirname(__FILE__)}/../../../config/solr_environment")
6
6
  FileUtils.mkdir_p(SOLR_LOGS_PATH)
7
7
  FileUtils.mkdir_p(SOLR_DATA_PATH)
@@ -13,21 +13,28 @@ namespace :solr do
13
13
  rescue Net::HTTPServerException #responding
14
14
  puts "Port #{SOLR_PORT} in use" and return
15
15
 
16
- rescue Errno::ECONNREFUSED #not responding
16
+ rescue Errno::ECONNREFUSED, Errno::EBADF #not responding
17
17
  Dir.chdir(SOLR_PATH) do
18
- pid = fork do
19
- #STDERR.close
20
- exec "java #{SOLR_JVM_OPTIONS} -Dsolr.data.dir=#{SOLR_DATA_PATH} -Djetty.logs=#{SOLR_LOGS_PATH} -Djetty.port=#{SOLR_PORT} -jar start.jar"
18
+ cmd = "java #{SOLR_JVM_OPTIONS} -Djetty.logs=\"#{SOLR_LOGS_PATH}\" -Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -Djetty.port=#{SOLR_PORT} -jar start.jar"
19
+ puts "Executing: " + cmd
20
+ windows = RUBY_PLATFORM =~ /(win|w)32$/
21
+ if windows
22
+ exec cmd
23
+ else
24
+ pid = fork do
25
+ #STDERR.close
26
+ exec cmd
27
+ end
21
28
  end
22
29
  sleep(5)
23
- File.open("#{SOLR_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid}
30
+ File.open("#{SOLR_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} if windows
24
31
  puts "#{ENV['RAILS_ENV']} Solr started successfully on #{SOLR_PORT}, pid: #{pid}."
25
32
  end
26
33
  end
27
34
  end
28
35
 
29
36
  desc 'Stops Solr. Specify the environment by using: RAILS_ENV=your_env. Defaults to development if none.'
30
- task :stop do
37
+ task :stop=> :environment do
31
38
  require File.expand_path("#{File.dirname(__FILE__)}/../../../config/solr_environment")
32
39
  fork do
33
40
  file_path = "#{SOLR_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid"
@@ -46,7 +53,7 @@ namespace :solr do
46
53
  end
47
54
 
48
55
  desc 'Remove Solr index'
49
- task :destroy_index do
56
+ task :destroy_index => :environment do
50
57
  require File.expand_path("#{File.dirname(__FILE__)}/../../../config/solr_environment")
51
58
  raise "In production mode. I'm not going to delete the index, sorry." if ENV['RAILS_ENV'] == "production"
52
59
  if File.exists?("#{SOLR_DATA_PATH}")
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-solr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Meyer, Joel Duffin, Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-15 00:00:00 -06:00
12
+ date: 2009-06-16 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15