muck-raker 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,29 @@
1
+ **/*.pid
2
+ log/*.log
3
+ log/*.pid
4
+ tmp
5
+ .DS_Store
6
+ public/cache/**/*
7
+ public/system/**/*
8
+ doc/**/*
9
+ db/*.sqlite3
10
+ .project
11
+ .loadpath
12
+ nbproject/
13
+ .idea
14
+ testjour.log
15
+ *.so
16
+ *.o
17
+ Makefile
18
+ mkmf.log
19
+ *.bundle
20
+ conftest
21
+ content/
22
+ .idea
23
+ *.sw?
24
+ .DS_Store
25
+ coverage
26
+ rdoc
27
+ pkg
28
+ pkg/*
29
+ log/*
data/Rakefile CHANGED
@@ -35,10 +35,10 @@ begin
35
35
  gemspec.files.exclude "test/*"
36
36
  gemspec.test_files.exclude 'test/feed_archive/**'
37
37
  end
38
+ Jeweler::RubyforgeTasks.new do |rubyforge|
39
+ rubyforge.doc_task = "rdoc"
40
+ end
38
41
  Jeweler::GemcutterTasks.new
39
- # Jeweler::RubyforgeTasks.new do |rubyforge|
40
- # rubyforge.doc_task = "rdoc"
41
- # end
42
42
  rescue LoadError
43
43
  puts "Jeweler not available. Install it with: sudo gem install jeweler"
44
44
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -1,6 +1,4 @@
1
1
  ENV['RAILS_ENV'] = (ENV['RAILS_ENV'] || 'development').dup
2
- dir = File.dirname(__FILE__)
3
- SOLR_PATH = File.expand_path("#{dir}/../solr") unless defined? SOLR_PATH
4
2
 
5
3
  unless defined? SOLR_LOGS_PATH
6
4
  SOLR_LOGS_PATH = ENV["SOLR_LOGS_PATH"] || "#{RAILS_ROOT}/log"
@@ -9,32 +7,36 @@ unless defined? SOLR_PIDS_PATH
9
7
  SOLR_PIDS_PATH = ENV["SOLR_PIDS_PATH"] || "#{RAILS_ROOT}/tmp/pids/solr"
10
8
  end
11
9
  unless defined? SOLR_DATA_PATH
12
- SOLR_DATA_PATH = ENV["SOLR_DATA_PATH"] || "#{RAILS_ROOT}/solr/#{ENV['RAILS_ENV']}"
10
+ SOLR_DATA_PATH = ENV["SOLR_DATA_PATH"] || "#{RAILS_ROOT}/solr_indexes/#{ENV['RAILS_ENV']}"
13
11
  end
14
12
  unless defined? SOLR_CONFIG_PATH
15
- SOLR_CONFIG_PATH = ENV["SOLR_CONFIG_PATH"] || SOLR_PATH
13
+ SOLR_CONFIG_PATH = ENV["SOLR_CONFIG_PATH"] || File.join(RAILS_ROOT, 'config', 'solr')
16
14
  end
17
15
 
16
+ unless defined? RAKER_LOGS_PATH
17
+ RAKER_LOGS_PATH = File.join(RAILS_ROOT, 'log')
18
+ end
18
19
  unless defined? RAKER_PIDS_PATH
19
20
  RAKER_PIDS_PATH = ENV["RAKER_PIDS_PATH"] || "#{RAILS_ROOT}/tmp/pids/raker"
20
21
  end
21
-
22
- unless defined? RAILS_DB_CONFIG
22
+ unless defined? RAKER_FEED_ARCHIVE_PATH
23
+ if ENV['RAILS_ENV'] == 'production'
24
+ RAKER_FEED_ARCHIVE_PATH = File.join(RAILS_ROOT, '..', '..', 'shared', 'feed_archive')
25
+ else
26
+ RAKER_FEED_ARCHIVE_PATH = File.join(RAILS_ROOT, '..', 'feed_archive')
27
+ end
28
+ end
29
+ unless defined? RAKER_DATABASE_CONFIG
23
30
  if ENV['RAILS_ENV'] == 'production'
24
- RAILS_DB_CONFIG = File.join(RAILS_ROOT, '..', '..', 'shared', 'config', 'database.yml')
31
+ RAKER_DATABASE_CONFIG = File.join(RAILS_ROOT, '..', '..', 'shared', 'config', 'database.yml')
25
32
  else
26
- RAILS_DB_CONFIG = File.join(RAILS_ROOT, 'config', 'database.yml')
33
+ RAKER_DATABASE_CONFIG = File.join(RAILS_ROOT, 'config', 'database.yml')
27
34
  end
28
35
  end
29
- unless defined? FEED_ARCHIVE_PATH
36
+ unless defined? RAKER_LOG_TO_CONSOLE
30
37
  if ENV['RAILS_ENV'] == 'production'
31
- FEED_ARCHIVE_PATH = File.join(RAILS_ROOT, '..', '..', 'shared', 'feed_archive')
32
- elsif ENV['RAILS_ENV'] == 'development'
33
- FEED_ARCHIVE_PATH = File.join(RAILS_ROOT, '..', 'feed_archive')
38
+ RAKER_LOG_TO_CONSOLE = 'false'
34
39
  else
35
- FEED_ARCHIVE_PATH = File.join(RAILS_ROOT, '..', 'feed_archive')
40
+ RAKER_LOG_TO_CONSOLE = 'true'
36
41
  end
37
42
  end
38
- unless defined? LOG_FILE_PREFIX
39
- LOG_FILE_PREFIX = File.join(RAILS_ROOT, 'log', 'muck-raker')
40
- end
@@ -75,7 +75,6 @@ module MuckRaker
75
75
  Service.delete_all
76
76
  yml = File.join(File.dirname(__FILE__), '..', '..', 'db', 'bootstrap',"services")
77
77
  Fixtures.new(Service.connection,"services",Service,yml).insert_fixtures
78
-
79
78
  end
80
79
 
81
80
  end
@@ -87,22 +86,31 @@ module MuckRaker
87
86
  system "rsync -ruv #{path}/public ."
88
87
  system "rsync -ruv #{path}/config/solr ./config"
89
88
  end
90
-
91
- desc "Harvest without recommending"
92
- task :harvest => :environment do
93
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
89
+
90
+ def pid_file
91
+ "#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid"
92
+ end
93
+
94
+ def raker_task task = 'daemon', param = ''
94
95
  require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
96
+ show_options
97
+ FileUtils.mkdir_p(RAKER_PIDS_PATH)
98
+ FileUtils.mkdir_p(RAKER_LOGS_PATH)
95
99
  separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
96
100
  puts "RAILS_ENV=" + ENV['RAILS_ENV']
97
101
  Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
98
- jars = Dir['**','*.jar'].join(separator)
99
- options = "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
100
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
101
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
102
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
102
+ jars = Dir['*.jar','solr/*.jar'].join(separator)
103
+ options = "-DRAILS_ENV=#{ENV['RAILS_ENV']} "
104
+ options << "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" "
105
+ options << "-Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" "
106
+ options << "-Draker.database.config=\"#{RAKER_DATABASE_CONFIG}\" "
107
+ options << "-Draker.log.dir=\"#{RAKER_LOGS_PATH}\" "
108
+ options << "-Draker.feed_archive_dir=\"#{RAKER_FEED_ARCHIVE_PATH}\" "
109
+ options << "-Draker.log_to_console=\"#{RAKER_LOG_TO_CONSOLE}\" "
103
110
  classpath = "-classpath #{jars}#{separator}. "
104
- javaclass = "edu.usu.cosl.aggregatord.Harvester"
105
- cmd = "java " + options + classpath + javaclass
111
+ memory_options = "-Xms32m -Xmx128m "
112
+ javaclass = "edu.usu.cosl.recommenderd.Recommenderd "
113
+ cmd = "java " + options + classpath + memory_options + javaclass + task + " " + param
106
114
  puts ("Executing: " + cmd)
107
115
  windows = RUBY_PLATFORM =~ /(win|w)32$/
108
116
  if windows
@@ -113,277 +121,87 @@ module MuckRaker
113
121
  end
114
122
  end
115
123
  sleep(5)
116
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
124
+ File.open(pid_file, "w"){ |f| f << pid} unless windows
117
125
  puts "#{ENV['RAILS_ENV']} Muck raker harvest command started successfully, pid: #{pid}."
118
126
  end
119
127
  end
128
+
129
+ def show_options
130
+ puts "RAILS_ENV=#{ENV['RAILS_ENV']} "
131
+ puts "solr.solr.home=\"#{SOLR_CONFIG_PATH}\" "
132
+ puts "solr.data.dir=\"#{SOLR_DATA_PATH}\" "
133
+ puts "raker.db.config=\"#{RAKER_DATABASE_CONFIG}\" "
134
+ puts "raker.log.dir=\"#{RAKER_LOGS_PATH}\" "
135
+ puts "raker.feed_archive_dir=\"#{RAKER_FEED_ARCHIVE_PATH}\" "
136
+ puts "raker.log_to_console=\"#{RAKER_LOG_TO_CONSOLE}\" "
137
+ end
138
+
139
+ desc "Print out muck raker dependent environment variables"
140
+ task :show_options => :environment do
141
+ require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
142
+ show_options
143
+ end
120
144
 
121
145
  desc "Start the recommender daemon process"
122
146
  task :start => :environment do
123
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
124
- require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
125
- separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
126
- puts "RAILS_ENV=" + ENV['RAILS_ENV']
127
- Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
128
- jars = Dir['**','*.jar'].join(separator)
129
- puts Dir['**','*.jar']
130
- options = "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
131
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
132
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
133
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
134
- classpath = "-classpath #{jars}#{separator}. "
135
- javaclass = "edu.usu.cosl.recommenderd.Recommenderd"
136
- cmd = "java " + options + classpath + javaclass
137
- puts ("Executing: " + cmd)
138
- windows = RUBY_PLATFORM =~ /(win|w)32$/
139
- if windows
140
- exec cmd
141
- else
142
- pid = fork do
143
- exec cmd
144
- end
145
- end
146
- sleep(5)
147
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
148
- puts "#{ENV['RAILS_ENV']} Muck raker start command started successfully, pid: #{pid}."
149
- end
147
+ raker_task
150
148
  end
151
149
 
152
- desc "Reindex records"
153
- task :reindex => :environment do
154
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
155
- require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
156
- separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
157
- puts "RAILS_ENV=" + ENV['RAILS_ENV']
158
- Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
159
- jars = Dir['**','*.jar'].join(separator)
160
- options = "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
161
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
162
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
163
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
164
- classpath = "-classpath #{jars}#{separator}. "
165
- memory_options = "-Xms32m -Xmx128m "
166
- javaclass = "edu.usu.cosl.indexer.Indexer "
167
- cmdlineoption = "all "
168
- cmd = "java " + options + classpath + memory_options + javaclass + cmdlineoption
169
- puts ("Executing: " + cmd)
170
- windows = RUBY_PLATFORM =~ /(win|w)32$/
171
- if windows
172
- exec cmd
173
- else
174
- pid = fork do
175
- exec cmd
176
- end
177
- end
178
- sleep(5)
179
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
180
- puts "#{ENV['RAILS_ENV']} Muck raker reindex command started successfully, pid: #{pid}."
181
- end
150
+ desc "Redo everything (re-index, redo autogenerated subjects, rebuild tag clouds re-recommend)"
151
+ task :rebuild => :environment do
152
+ raker_task 'daemon', 'full'
182
153
  end
183
154
 
184
- desc "Autogenerate subjects"
185
- task :gen_subjects => :environment do
186
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
187
- require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
188
- separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
189
- puts "RAILS_ENV=" + ENV['RAILS_ENV']
190
- Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
191
- jars = Dir['**','*.jar'].join(separator)
192
- options = "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
193
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
194
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
195
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
196
- classpath = "-classpath #{jars}#{separator}. "
197
- javaclass = "edu.usu.cosl.tagclouds.SubjectAutoGenerator "
198
- cmd = "java " + options + classpath + javaclass
199
- puts ("Executing: " + cmd)
200
- windows = RUBY_PLATFORM =~ /(win|w)32$/
201
- if windows
202
- exec cmd
203
- else
204
- pid = fork do
205
- exec cmd
206
- end
207
- end
208
- sleep(5)
209
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
210
- puts "#{ENV['RAILS_ENV']} Muck raker gen_subjects command started successfully, pid: #{pid}."
211
- end
155
+ desc "Get some data into the recommender system"
156
+ task :bootstrap => :environment do
157
+ raker_task 'bootstrap'
212
158
  end
213
159
 
214
- desc "Generate tag clouds"
215
- task :gen_clouds => :environment do
216
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
217
- require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
218
- separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
219
- puts "RAILS_ENV=" + ENV['RAILS_ENV']
220
- Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
221
- jars = Dir['**','*.jar'].join(separator)
222
- options = "-DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
223
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
224
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
225
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
226
- classpath = "-classpath #{jars}#{separator}. "
227
- javaclass = "edu.usu.cosl.tagclouds.TagCloud"
228
- cmd = "java " + options + classpath + javaclass
229
- puts ("Executing: " + cmd)
230
- windows = RUBY_PLATFORM =~ /(win|w)32$/
231
- if windows
232
- exec cmd
233
- else
234
- pid = fork do
235
- exec cmd
236
- end
237
- end
238
- sleep(5)
239
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
240
- puts "#{ENV['RAILS_ENV']} Muck raker get_clouds command started successfully, pid: #{pid}."
241
- end
160
+ desc "Harvest without recommending"
161
+ task :harvest => :environment do
162
+ raker_task 'harvest'
242
163
  end
243
164
 
244
- desc "Recommend without harvesting"
245
- task :recommend => :environment do
246
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
247
- require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
248
- separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
249
- puts "RAILS_ENV=" + ENV['RAILS_ENV']
250
- Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
251
- jars = Dir['**','*.jar'].join(separator)
252
- options = "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
253
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
254
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
255
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
256
- classpath = "-classpath #{jars}#{separator}. "
257
- javaclass = "edu.usu.cosl.recommenderd.Recommenderd "
258
- cmdlineoption = "skip_harvest "
259
- cmd = "java " + options + classpath + javaclass + cmdlineoption
260
- puts ("Executing: " + cmd)
261
- windows = RUBY_PLATFORM =~ /(win|w)32$/
262
- if windows
263
- exec cmd
264
- else
265
- pid = fork do
266
- exec cmd
267
- end
268
- end
269
- sleep(5)
270
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
271
- puts "#{ENV['RAILS_ENV']} Muck raker recommend command started successfully, pid: #{pid}."
272
- end
165
+ desc "Update solr index to changes made to recommender database"
166
+ task :index => :environment do
167
+ raker_task 'index'
273
168
  end
274
169
 
275
- desc "Rebuild entry recommendation caches"
276
- task :rebuild_recommendation_cache => :environment do
277
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
278
- require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
279
- separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
280
- puts "RAILS_ENV=" + ENV['RAILS_ENV']
281
- Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
282
- jars = Dir['**','*.jar'].join(separator)
283
- options = "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
284
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
285
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
286
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
287
- classpath = "-classpath #{jars}#{separator}. "
288
- javaclass = "edu.usu.cosl.recommender.Recommender "
289
- cmdlineoption = "rebuild_cache "
290
- cmd = "java " + options + classpath + javaclass + cmdlineoption
291
- puts ("Executing: " + cmd)
292
- windows = RUBY_PLATFORM =~ /(win|w)32$/
293
- if windows
294
- exec cmd
295
- else
296
- pid = fork do
297
- exec cmd
298
- end
299
- end
300
- sleep(5)
301
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
302
- puts "#{ENV['RAILS_ENV']} Muck raker rebuild_recommendation_cache command started successfully, pid: #{pid}."
303
- end
170
+ desc "Recommend without harvesting"
171
+ task :recommend => :environment do
172
+ raker_task 'recommend'
304
173
  end
305
174
 
306
175
  desc "Redo recommendations only"
307
176
  task :redo_recommendations => :environment do
308
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
309
- require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
310
- separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
311
- puts "RAILS_ENV=" + ENV['RAILS_ENV']
312
- Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
313
- jars = Dir['**','*.jar'].join(separator)
314
- options = "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
315
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
316
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
317
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
318
- classpath = "-classpath #{jars}#{separator}. "
319
- javaclass = "edu.usu.cosl.recommender.Recommender "
320
- cmd = "java " + options + classpath + javaclass
321
- puts ("Executing: " + cmd)
322
- windows = RUBY_PLATFORM =~ /(win|w)32$/
323
- if windows
324
- exec cmd
325
- else
326
- pid = fork do
327
- exec cmd
328
- end
329
- end
330
- sleep(5)
331
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
332
- puts "#{ENV['RAILS_ENV']} Muck raker redo_recommendations command started successfully, pid: #{pid}."
333
- end
177
+ raker_task 'recommend', 'full'
334
178
  end
335
179
 
336
- desc "Redo everything (re-index, redo autogenerated subjects, rebuild tag clouds re-recommend)"
337
- task :rebuild => :environment do
338
- FileUtils.mkdir_p(RAKER_PIDS_PATH)
339
- require File.expand_path("#{File.dirname(__FILE__)}/../../config/muck_raker_environment")
340
- separator = (RUBY_PLATFORM =~ /(win|w)32$/ ? ';' : ':')
341
- puts "RAILS_ENV=" + ENV['RAILS_ENV']
342
- Dir.chdir(File.join(File.dirname(__FILE__), '../../', 'raker', 'lib')) do
343
- jars = Dir['**','*.jar'].join(separator)
344
- options = "-Dsolr.solr.home=\"#{SOLR_CONFIG_PATH}\" -Dsolr.data.dir=\"#{SOLR_DATA_PATH}\" -DRAILS_ENV=#{ENV['RAILS_ENV']} -DRAILS_DB_CONFIG=\"#{RAILS_DB_CONFIG}\" -DLOG_FILE_PREFIX=\"#{LOG_FILE_PREFIX}\" "
345
- options << "-DDEBUG=true " unless ENV['DEBUG'] == 'false'
346
- options << "-DLOG_TO_CONSOLE=true " unless ENV['DEBUG'] == 'false'
347
- options << "-DFEED_ARCHIVE_PATH=\"#{FEED_ARCHIVE_PATH}\" "
348
- classpath = "-classpath #{jars}#{separator}. "
349
- javaclass = "edu.usu.cosl.recommenderd.Recommenderd "
350
- cmdlineoption = "rebuild "
351
- cmd = "java " + options + classpath + javaclass + cmdlineoption
352
- puts ("Executing: " + cmd)
353
- windows = RUBY_PLATFORM =~ /(win|w)32$/
354
- if windows
355
- exec cmd
356
- else
357
- pid = fork do
358
- exec cmd
359
- end
360
- end
361
- sleep(5)
362
- File.open("#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid", "w"){ |f| f << pid} unless windows
363
- puts "#{ENV['RAILS_ENV']} Muck raker rebuild command started successfully, pid: #{pid}."
364
- end
180
+ desc "Autogenerate subjects"
181
+ task :subjects => :environment do
182
+ raker_task 'auto_generate_subjects'
183
+ end
184
+
185
+ desc "Generate tag clouds"
186
+ task :tag_clouds => :environment do
187
+ raker_task 'tag_clouds'
365
188
  end
366
189
 
367
190
  desc "Stop a raker daemon process"
368
191
  task :stop => :environment do
369
- file_path = "#{RAKER_PIDS_PATH}/#{ENV['RAILS_ENV']}_pid"
192
+ file_path = pid_file
370
193
  if File.exists?(file_path)
371
194
  File.open(file_path, "r") do |f|
372
195
  pid = f.readline
373
196
  Process.kill('TERM', pid.to_i)
374
197
  end
375
198
  File.unlink(file_path)
376
- puts "Raker shutdown successfully."
199
+ puts "Raker task successfully."
377
200
  else
378
201
  puts "PID file not found at #{file_path}. Either Raker is not running or no PID file was written."
379
202
  end
380
203
  end
381
204
 
382
- desc "Restart the recommender daemon process"
383
- task :restart do
384
- system "java"
385
- end
386
-
387
205
  end
388
206
 
389
207
  end
data/muck-raker.gemspec CHANGED
@@ -5,18 +5,19 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-raker}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joel Duffin Justin Ball"]
12
- s.date = %q{2009-11-04}
12
+ s.date = %q{2009-11-05}
13
13
  s.description = %q{The aggregation and recommendation daemons for the muck system.}
14
14
  s.email = %q{justinball@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
- "MIT-LICENSE",
19
+ ".gitignore",
20
+ "MIT-LICENSE",
20
21
  "README.rdoc",
21
22
  "Rakefile",
22
23
  "VERSION",
data/rails/init.rb CHANGED
@@ -1,3 +1 @@
1
1
  ActiveSupport::Dependencies.load_once_paths << lib_path
2
-
3
- require 'muck_raker'
Binary file
Binary file
@@ -1,68 +1,68 @@
1
- # number of worker threads to spawn
2
- #threads=20
3
-
4
- # size of the queue
5
- #stale_feed_queue_size=100
6
-
7
- # seconds to wait before timing out a HTTP request
8
- #request_timeout=30
9
-
10
- # seconds to wait before querying the database for stale feeds
11
- #stale_thread_poll_interval=5
12
-
13
- # minutes to wait before checking to see if a feed has new entries
14
- #feed_refresh_interval=60
15
-
16
- # whether or not to log to file
17
- #log_file_prefix=recommender
18
-
19
- # pairs to consider when calculating recommendations; default is 200
20
- #pairs_to_consider=200
21
-
22
- # maximum number of recommendations to calculate; default is 20
23
- #max_recommendations=20
24
-
25
- # smtp server to use to email admin of results
26
- #smtp_server=
27
-
28
- # email address to send reports to
29
- #admin_email=
30
-
31
- # harvest before running recommendations (default is true)
32
- #harvest=true
33
-
34
- # redo all recommendations (default is false)
35
- #redo_recommendations=false
36
-
37
- # reindex all of the entries in the DB (default is false)
38
- #reindex_all=false
39
-
40
- # solr home directory (default is config/solr)
41
- #solr_dir=c:/projects/oerrecommender/config/solr/
42
- #solr_config_filename=../../projects/muck/config/solr/solr.xml
43
- #solr_dir=../muck/config/solr
44
-
45
- # rails environment (default is development)
46
- #rails_env=development
47
-
48
- # path to database.yml (default is config/database.yml)
49
- db_yml=../../projects/muck/config/database.yml
50
-
51
- # logging
52
- log4j.rootLogger=trace, stdout, R
53
-
54
- log4j.appender.stdout=org.apache.log4j.ConsoleAppender
55
- log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
56
-
57
- # Pattern to output the caller's file name and line number.
58
- log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
59
-
60
- log4j.appender.R=org.apache.log4j.RollingFileAppender
61
- log4j.appender.R.File=log/recommenderd.log
62
-
63
- log4j.appender.R.MaxFileSize=100KB
64
- # Keep one backup file
65
- log4j.appender.R.MaxBackupIndex=1
66
-
67
- log4j.appender.R.layout=org.apache.log4j.PatternLayout
68
- log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
1
+ # number of worker threads to spawn
2
+ #threads=20
3
+
4
+ # size of the queue
5
+ #stale_feed_queue_size=100
6
+
7
+ # seconds to wait before timing out a HTTP request
8
+ #request_timeout=30
9
+
10
+ # seconds to wait before querying the database for stale feeds
11
+ #stale_thread_poll_interval=5
12
+
13
+ # minutes to wait before checking to see if a feed has new entries
14
+ #feed_refresh_interval=60
15
+
16
+ # whether or not to log to file
17
+ #log_file_prefix=recommender
18
+
19
+ # pairs to consider when calculating recommendations; default is 200
20
+ #pairs_to_consider=200
21
+
22
+ # maximum number of recommendations to calculate; default is 20
23
+ #max_recommendations=20
24
+
25
+ # smtp server to use to email admin of results
26
+ #smtp_server=
27
+
28
+ # email address to send reports to
29
+ #admin_email=
30
+
31
+ # harvest before running recommendations (default is true)
32
+ #harvest=true
33
+
34
+ # redo all recommendations (default is false)
35
+ #redo_recommendations=false
36
+
37
+ # reindex all of the entries in the DB (default is false)
38
+ #reindex_all=false
39
+
40
+ # solr home directory (default is config/solr)
41
+ #solr_dir=c:/projects/oerrecommender/config/solr/
42
+ #solr_config_filename=../../projects/muck/config/solr/solr.xml
43
+ #solr_dir=../muck/config/solr
44
+
45
+ # rails environment (default is development)
46
+ #rails_env=development
47
+
48
+ # path to database.yml (default is config/database.yml)
49
+ db_yml=../../projects/muck/config/database.yml
50
+
51
+ # logging
52
+ log4j.rootLogger=trace, stdout, R
53
+
54
+ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
55
+ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
56
+
57
+ # Pattern to output the caller's file name and line number.
58
+ log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
59
+
60
+ log4j.appender.R=org.apache.log4j.RollingFileAppender
61
+ log4j.appender.R.File=log/recommenderd.log
62
+
63
+ log4j.appender.R.MaxFileSize=100KB
64
+ # Keep one backup file
65
+ log4j.appender.R.MaxBackupIndex=1
66
+
67
+ log4j.appender.R.layout=org.apache.log4j.PatternLayout
68
+ log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-raker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Duffin Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-04 00:00:00 -07:00
12
+ date: 2009-11-05 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,6 +22,7 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.rdoc
24
24
  files:
25
+ - .gitignore
25
26
  - MIT-LICENSE
26
27
  - README.rdoc
27
28
  - Rakefile