psq-dm-xapian 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/dm-xapian-updater +51 -0
  2. data/lib/dm-xapian.rb +1 -1
  3. metadata +14 -4
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+ # script/task_server_control.rb
3
+ #
4
+ # Background Task Server Control - A daemon for running jobs
5
+ #
6
+
7
+ require 'rubygems'
8
+ require 'daemons'
9
+ require 'merb-core'
10
+ require 'dm-core'
11
+ require 'dm-xapian'
12
+
13
+ ROOT = Dir.pwd
14
+ options = {}
15
+
16
+ default_pid_dir = ROOT+"/tmp/pids"
17
+
18
+ if File.exists?(default_pid_dir)
19
+ options[:dir_mode] = :normal
20
+ options[:dir] = default_pid_dir
21
+ options[:log_output] = true
22
+ end
23
+
24
+ ARGV.options do |opts|
25
+ opts.on( "-e", "--environment ENVIRONMENT", String, "The Environment to run under." ) do |environment|
26
+ Merb.environment = environment
27
+ end
28
+ opts.parse!
29
+ end
30
+
31
+ Merb.environment ||= ENV["MERB_ENV"]
32
+
33
+ if Merb.environment == "development" or Merb.environment == "test"
34
+ SLEEP_TIME = 5
35
+ else
36
+ SLEEP_TIME = 60
37
+ end
38
+
39
+ Merb.start_environment(:environment => Merb.environment)
40
+ ActsAsXapian.configure(Merb.environment, ROOT)
41
+ ActsAsXapian.update_index(true, true) # need to call before starting daemon???
42
+
43
+ Daemons.run_proc('server.rb', options) do
44
+
45
+ loop do
46
+ puts "Updating index for #{Merb.environment}"
47
+ ActsAsXapian.update_index(true, true)
48
+ sleep(SLEEP_TIME)
49
+ end
50
+
51
+ end
data/lib/dm-xapian.rb CHANGED
@@ -85,7 +85,7 @@ module ActsAsXapian
85
85
  return unless @@db_path.nil?
86
86
 
87
87
  # barf if we can't figure out the environment
88
- raise "Set RAILS_ENV, so acts_as_xapian can find the right Xapian database" if not @@environment
88
+ raise "Can't figure out environment, so acts_as_xapian can find the right Xapian database" if not @@environment
89
89
 
90
90
  # check for a config file
91
91
  config_file = @@root + "/config/xapian.yml"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psq-dm-xapian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshaven Potter, Pascal Belloncle
@@ -21,10 +21,19 @@ dependencies:
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.9.7
23
23
  version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: dm-core
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 0.9.6
32
+ version:
24
33
  description: Merb plugin that provides access to the Ruby Xapian search engine library
25
34
  email: yourtech@gmail.com, psq@nanorails.com
26
- executables: []
27
-
35
+ executables:
36
+ - dm-xapian-updater
28
37
  extensions: []
29
38
 
30
39
  extra_rdoc_files:
@@ -42,6 +51,7 @@ files:
42
51
  - lib/dm-xapian/merbtasks.rb
43
52
  - SETUP.txt
44
53
  - CHANGES.txt
54
+ - bin/dm-xapian-updater
45
55
  has_rdoc: true
46
56
  homepage: http://github.com/psq/dm-xapian
47
57
  post_install_message:
@@ -67,6 +77,6 @@ rubyforge_project: merb
67
77
  rubygems_version: 1.2.0
68
78
  signing_key:
69
79
  specification_version: 2
70
- summary: Merb plugin that provides access to the Ruby Xapian search engine library
80
+ summary: Merb plugin that provides indexing of datamapper mdoles using the Ruby Xapian search engine library
71
81
  test_files: []
72
82