264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
# File 'lib/reaper.rb', line 264
def update
projs = Reaper.list_projects
abort unless projs
if Reaper.load_config
global_settings = {
'noffset' => $config[:daily_negative_offset],
'poffset' => $config[:daily_positive_offset]
}
else
global_settings = {
'noffset' => 0,
'poffset' => 0
}
end
projs_js = projs.values.flatten.map do |p|
{
'pid' => p[:project_id],
'code' => p[:project_code],
'name' => p[:project_name],
'client' => p[:client],
'tasks' => p[:tasks]
}
end
added_tasks = []
if $config
added_tasks = $config[:tasks].map do |t|
{
'pid': t[:pid],
'tid': t[:tid],
'pct': t[:percentage],
}
end
end
puts ''
Reaper.openWebpage("http://localhost:#{LOCAL_SERVER_PORT}/reaper-config");
Reaper.start_config_server(global_settings, projs_js, added_tasks)
if $config
File.write(Reaper::CONFIG_FILE_PATH, $config.to_yaml)
puts ''
Reaper.show_config $config
puts ''
puts 'Reaper configuration successfully updated'
end
end
|