Commit 3d37056faa3a2379377459db9286f107aeca3e1f

Authored by Antonio Terceiro
1 parent 334e5511

Small enhancement in solr:download

I am used to run `git clean -dxf` to make sure Noosfero can bootstrap
itself in development mode with ./script/quick-start. If the solr
tarball is downloaded to /tmp, every time I reboot I have to download
everything once again. Contrary to /tmp/, /var/tmp/ is *not* wiped at
boot time.
vendor/plugins/acts_as_solr_reloaded/lib/tasks/solr.rake
@@ -18,13 +18,14 @@ namespace :solr do @@ -18,13 +18,14 @@ namespace :solr do
18 task :download do 18 task :download do
19 abort 'Solr already downloaded.' if solr_downloaded? 19 abort 'Solr already downloaded.' if solr_downloaded?
20 20
21 - Dir.chdir '/tmp' do 21 + tmpdir = [ '/var/tmp', '/tmp' ].find { |d| File.exists?(d) }
  22 + Dir.chdir tmpdir do
22 sh "wget -c #{SOLR_URL}" 23 sh "wget -c #{SOLR_URL}"
23 24
24 - sh "echo \"#{SOLR_MD5SUM} /tmp/#{SOLR_FILENAME}\" | md5sum -c -" do |ok, res| 25 + sh "echo \"#{SOLR_MD5SUM} #{SOLR_FILENAME}\" | md5sum -c -" do |ok, res|
25 abort "MD5SUM do not match" if !ok 26 abort "MD5SUM do not match" if !ok
26 27
27 - sh "tar xzf apache-solr-#{SOLR_VERSION}.tgz" 28 + sh "tar xzf #{SOLR_FILENAME}"
28 cd "apache-solr-#{SOLR_VERSION}/example" 29 cd "apache-solr-#{SOLR_VERSION}/example"
29 30
30 cp_r ['../LICENSE.txt', '../NOTICE.txt', 'README.txt', 'etc', 'lib', 'start.jar', 'webapps', 'work'], "#{PLUGIN_ROOT}/solr", :verbose => true 31 cp_r ['../LICENSE.txt', '../NOTICE.txt', 'README.txt', 'etc', 'lib', 'start.jar', 'webapps', 'work'], "#{PLUGIN_ROOT}/solr", :verbose => true