mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
Instantiate Plugin
s by plugin names
This commit is contained in:
parent
d184d6fba5
commit
7e4532fb14
@ -22,9 +22,8 @@ class Plugin
|
|||||||
|
|
||||||
def self.list
|
def self.list
|
||||||
dir = Config.current.plugin_path
|
dir = Config.current.plugin_path
|
||||||
unless Dir.exists? dir
|
Dir.mkdir_p dir unless Dir.exists? dir
|
||||||
Dir.mkdir_p dir
|
|
||||||
end
|
|
||||||
Dir.children(dir)
|
Dir.children(dir)
|
||||||
.select do |f|
|
.select do |f|
|
||||||
fp = File.join dir, f
|
fp = File.join dir, f
|
||||||
@ -35,7 +34,16 @@ class Plugin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(@path : String)
|
def initialize(filename : String)
|
||||||
|
dir = Config.current.plugin_path
|
||||||
|
pp dir
|
||||||
|
Dir.mkdir_p dir unless Dir.exists? dir
|
||||||
|
|
||||||
|
@path = File.join dir, "#{filename}.js"
|
||||||
|
unless File.exists? @path
|
||||||
|
raise Error.new "Plugin script not found at #{@path}"
|
||||||
|
end
|
||||||
|
|
||||||
@rt = Duktape::Runtime.new do |sbx|
|
@rt = Duktape::Runtime.new do |sbx|
|
||||||
sbx.push_global_object
|
sbx.push_global_object
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ class Queue
|
|||||||
property success_count : Int32 = 0
|
property success_count : Int32 = 0
|
||||||
property fail_count : Int32 = 0
|
property fail_count : Int32 = 0
|
||||||
property time : Time
|
property time : Time
|
||||||
|
property plugin_name : String?
|
||||||
|
|
||||||
def parse_query_result(res : DB::ResultSet)
|
def parse_query_result(res : DB::ResultSet)
|
||||||
@id = res.read String
|
@id = res.read String
|
||||||
@ -59,6 +60,11 @@ class Queue
|
|||||||
time = res.read Int64
|
time = res.read Int64
|
||||||
@status = JobStatus.new status
|
@status = JobStatus.new status
|
||||||
@time = Time.unix_ms time
|
@time = Time.unix_ms time
|
||||||
|
|
||||||
|
ary = @id.split("-")
|
||||||
|
if ary.size > 1
|
||||||
|
plugin_name = ary[0]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Raises if the result set does not contain the correct set of columns
|
# Raises if the result set does not contain the correct set of columns
|
||||||
|
Loading…
x
Reference in New Issue
Block a user