Sha256: 7b5f026756fd80f181fdbdb5f48310683d40ddaf116558bd0fd5ca79df43ad86
Contents?: true
Size: 911 Bytes
Versions: 7
Compression:
Stored size: 911 Bytes
Contents
#!/usr/bin/env ruby require 'rubygems' gem 'daemons', '~> 1.0' gem 'optiflag', '~> 0.6.5' require 'fileutils' require 'tmpdir' require 'daemons' require 'optiflag' working_directory = FileUtils.pwd solr_home = File.join(File.dirname(__FILE__), '..', 'solr') module SolrFlags extend OptiFlagSet optional_flag 'p' do description 'Port on which to run Solr (default 8983)' long_form 'port' end optional_flag 'd' do description 'Solr data directory' end and_process! end port = ARGV.flags.p || '8983' data_dir = File.expand_path(ARGV.flags.d || File.join(Dir.tmpdir, 'solr_data')) Daemons.run_proc('sunspot-solr') do FileUtils.cd(working_directory) do FileUtils.cd(solr_home) do args = ['java'] args << "-Djetty.port=#{port}" if port args << "-Dsolr.data.dir=#{data_dir}" if data_dir args << '-jar' << 'start.jar' Kernel.exec(*args) end end end
Version data entries
7 entries across 7 versions & 1 rubygems