acts_as_ferret 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Ferret DRb server launcher script
4
+ #
5
+ # Place doc/ferret_server.yml into RAILS_ROOT/config and fit to taste.
6
+ #
7
+ # Start this script with script/runner and RAILS_ENV set.
8
+ #
9
+ # to run the unit tests against the drb server, start it with
10
+ # RAILS_ENV=test script/runner script/ferret_server
11
+ # and run your tests with the AAF_REMOTE environment variable set to a
12
+ # non-empty value
13
+
14
+
15
+ ActsAsFerret::Remote::Server.start
16
+ DRb.thread.join
17
+
18
+
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env script/runner
2
+
3
+ # Ferret DRb server launcher script
4
+ #
5
+ # Place doc/ferret_server.yml into RAILS_ROOT/config and fit to taste. Start
6
+ # it with RAILS_ENV set to the desired environment.
7
+ #
8
+ #
9
+ # To run the demo project's unit tests against the drb server, start it with
10
+ #
11
+ # RAILS_ENV=test script/ferret_start
12
+ #
13
+ # and run your tests with the AAF_REMOTE environment variable set to a
14
+ # non-empty value:
15
+ #
16
+ # AAF_REMOTE=true rake
17
+ #
18
+ # The server writes a log file in log/ferret_server.log, it's
19
+ # STDOUT gets redirected to log/ferret_server.out
20
+
21
+
22
+ config = ActsAsFerret::Remote::Config.load
23
+ @pid_file = config['pid_file']
24
+
25
+ def write_pid_file
26
+ open(@pid_file,"w") {|f| f.write(Process.pid) }
27
+ end
28
+
29
+ def safefork
30
+ tryagain = true
31
+
32
+ while tryagain
33
+ tryagain = false
34
+ begin
35
+ if pid = fork
36
+ return pid
37
+ end
38
+ rescue Errno::EWOULDBLOCK
39
+ sleep 5
40
+ tryagain = true
41
+ end
42
+ end
43
+ end
44
+
45
+ safefork and exit
46
+ at_exit do
47
+ File.unlink(@pid_file) if @pid_file && File.exists?(@pid_file) && File.read(@pid_file).to_i == Process.pid
48
+ end
49
+ print "Starting ferret DRb server..."
50
+ trap("TERM") { exit(0) }
51
+ sess_id = Process.setsid
52
+
53
+
54
+ begin
55
+ ActsAsFerret::Remote::Server.start
56
+ write_pid_file
57
+ puts "Done."
58
+ STDIN.reopen "/dev/null" # Free file descriptors and
59
+ STDOUT.reopen "#{RAILS_ROOT}/log/ferret_server.out", "a" # point them somewhere sensible
60
+ STDERR.reopen STDOUT # STDOUT/STDERR should go to a logfile
61
+ rescue
62
+ puts "Error starting ferret DRb server: #{$!}"
63
+ exit(1)
64
+ end
65
+ DRb.thread.join
66
+
67
+ # vim:set filetype=ruby:
@@ -0,0 +1,22 @@
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
+ send_signal("TERM", pid_file)
21
+
22
+ # vim:set filetype=ruby:
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: acts_as_ferret
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.1
7
- date: 2007-01-20 00:00:00 +01:00
6
+ version: 0.4.0
7
+ date: 2007-03-24 00:00:00 +01:00
8
8
  summary: acts_as_ferret - Ferret based full text search for any ActiveRecord model
9
9
  require_paths:
10
10
  - lib
@@ -25,24 +25,36 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  platform: ruby
26
26
  signing_key:
27
27
  cert_chain:
28
+ post_install_message:
28
29
  authors:
29
30
  - Jens Kraemer
30
31
  files:
32
+ - lib
31
33
  - LICENSE
32
34
  - rakefile
33
35
  - init.rb
34
- - lib
35
36
  - README
36
- - .rakefile.swp
37
- - .init.rb.swp
38
- - lib/multi_index.rb
37
+ - script
38
+ - doc
39
+ - config
40
+ - install.rb
39
41
  - lib/acts_as_ferret.rb
42
+ - lib/multi_index.rb
43
+ - lib/more_like_this.rb
40
44
  - lib/instance_methods.rb
41
45
  - lib/class_methods.rb
42
- - lib/more_like_this.rb
43
- - lib/.class_methods.rb.swp
44
- - lib/.acts_as_ferret.rb.swp
45
- - lib/.class_methods.rb.swo
46
+ - lib/ferret_server.rb
47
+ - lib/shared_index.rb
48
+ - lib/local_index.rb
49
+ - lib/remote_index.rb
50
+ - lib/index.rb
51
+ - lib/act_methods.rb
52
+ - lib/shared_index_class_methods.rb
53
+ - lib/ferret_result.rb
54
+ - script/ferret_server
55
+ - script/ferret_start
56
+ - script/ferret_stop
57
+ - config/ferret_server.yml
46
58
  test_files: []
47
59
 
48
60
  rdoc_options: []
data/.init.rb.swp DELETED
Binary file
data/.rakefile.swp DELETED
Binary file
Binary file
Binary file
Binary file