Commit f9a9c7383c9dc65150333ae5e0d2206933d85eb9

Authored by MoisesMachado
1 parent dd5c4530

ActionItem1: acts_as_ferret files added

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@149 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/manage_tags/_search_box.rhtml 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<div class="search_box">
  2 +<% form_tag :action => 'search' do %>
  3 + <%= text_field 'query', 'term'%>
  4 + <%= submit_tag _('Search') %>
  5 +<% end %>
  6 +</div>
... ...
config/ferret_server.yml 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +production:
  2 + host: ferret.yourdomain.com
  3 + port: 9010
  4 + pid_file: log/ferret.pid
  5 +development:
  6 + host: localhost
  7 + port: 9010
  8 + pid_file: log/ferret.pid
  9 +test:
  10 + host: localhost
  11 + port: 9009
  12 + pid_file: log/ferret.pid
... ...
index/development/tag/_5.cfs 0 → 100644
No preview for this file type
index/development/tag/_6.cfs 0 → 100644
No preview for this file type
index/development/tag/segments 0 → 100644
No preview for this file type
index/development/tag/segments_7 0 → 100644
No preview for this file type
index/test/tag/_1n.cfs 0 → 100644
No preview for this file type
index/test/tag/_1n_3.del 0 → 100644
No preview for this file type
index/test/tag/_1o.cfs 0 → 100644
No preview for this file type
index/test/tag/_1p.cfs 0 → 100644
No preview for this file type
index/test/tag/_1q.cfs 0 → 100644
No preview for this file type
index/test/tag/_1q_0.del 0 → 100644
No preview for this file type
index/test/tag/segments 0 → 100644
No preview for this file type
index/test/tag/segments_35 0 → 100644
No preview for this file type
script/ferret_start 0 → 100755
... ... @@ -0,0 +1,72 @@
  1 +#!/usr/bin/env ruby
  2 +# Ferret DRb server launcher script
  3 +#
  4 +# Place doc/ferret_server.yml into RAILS_ROOT/config and fit to taste. Start
  5 +# it with RAILS_ENV set to the desired environment.
  6 +#
  7 +#
  8 +# To run the demo project's unit tests against the drb server, start it with
  9 +#
  10 +# RAILS_ENV=test script/ferret_start
  11 +#
  12 +# and run your tests with the AAF_REMOTE environment variable set to a
  13 +# non-empty value:
  14 +#
  15 +# AAF_REMOTE=true rake
  16 +#
  17 +# The server writes a log file in log/ferret_server.log, it's
  18 +# STDOUT gets redirected to log/ferret_server.out
  19 +
  20 +ENV['FERRET_USE_LOCAL_INDEX'] = 'true'
  21 +require File.dirname(__FILE__) + '/../config/boot'
  22 +require RAILS_ROOT + '/config/environment'
  23 +
  24 +
  25 +config = ActsAsFerret::Remote::Config.load
  26 +@pid_file = config['pid_file']
  27 +
  28 +def write_pid_file
  29 + raise "No PID file defined" if @pid_file.blank?
  30 + open(@pid_file,"w") {|f| f.write(Process.pid) }
  31 +end
  32 +
  33 +def safefork
  34 + tryagain = true
  35 +
  36 + while tryagain
  37 + tryagain = false
  38 + begin
  39 + if pid = fork
  40 + return pid
  41 + end
  42 + rescue Errno::EWOULDBLOCK
  43 + sleep 5
  44 + tryagain = true
  45 + end
  46 + end
  47 +end
  48 +
  49 +safefork and exit
  50 +at_exit do
  51 + File.unlink(@pid_file) if @pid_file && File.exists?(@pid_file) && File.read(@pid_file).to_i == Process.pid
  52 +end
  53 +print "Starting ferret DRb server..."
  54 +trap("TERM") { exit(0) }
  55 +sess_id = Process.setsid
  56 +
  57 +
  58 +begin
  59 + ActsAsFerret::Remote::Server.start
  60 + write_pid_file
  61 + puts "Done."
  62 + STDIN.reopen "/dev/null" # Free file descriptors and
  63 + STDOUT.reopen "#{RAILS_ROOT}/log/ferret_server.out", "a" # point them somewhere sensible
  64 + STDERR.reopen STDOUT # STDOUT/STDERR should go to a logfile
  65 +rescue
  66 + $stderr.puts "Error starting ferret DRb server: #{$!}"
  67 + $stderr.puts $!.backtrace
  68 + exit(1)
  69 +end
  70 +DRb.thread.join
  71 +
  72 +# vim:set filetype=ruby:
... ...
script/ferret_stop 0 → 100755
... ... @@ -0,0 +1,26 @@
  1 +#!/usr/bin/env script/runner
  2 +
  3 +config = ActsAsFerret::Remote::Config.load
  4 +
  5 +def send_signal(signal, pid_file)
  6 + pid = open(pid_file).read.to_i
  7 + print "Sending #{signal} to ferret_server with PID #{pid}..."
  8 + begin
  9 + Process.kill(signal, pid)
  10 + rescue Errno::ESRCH
  11 + puts "Process does not exist. Not running. Removing stale pid file anyway."
  12 + File.unlink(pid_file)
  13 + end
  14 +
  15 + puts "Done."
  16 +end
  17 +
  18 +pid_file = config['pid_file']
  19 +puts "Stopping ferret_server..."
  20 +if File.file?(pid_file)
  21 + send_signal("TERM", pid_file)
  22 +else
  23 + puts "no pid file found"
  24 +end
  25 +
  26 +# vim:set filetype=ruby:
... ...