最適化 #615 » plugin.patch
core/miquire_plugin.rb | ||
---|---|---|
63 | 63 |
def get_spec(path) |
64 | 64 |
type_strict path => String |
65 | 65 |
plugin_dir = FileTest.directory?(path) ? path : File.dirname(path) |
66 |
spec_filename = File.join(plugin_dir, "spec") |
|
66 |
spec_filename = File.join(plugin_dir, ".mikutter_plugin") |
|
67 |
deprecated_spec = false; |
|
68 |
unless FileTest.exist? spec_filename |
|
69 |
spec_filename = File.join(plugin_dir, "spec") |
|
70 |
deprecated_spec = true |
|
71 |
end |
|
67 | 72 |
if FileTest.exist? spec_filename |
68 | 73 |
spec = YAML.load_file(spec_filename).symbolize |
69 | 74 |
spec[:path] = plugin_dir |
70 | 75 |
spec[:kind] = get_kind(path) |
71 |
spec |
|
72 | 76 |
elsif FileTest.exist? path |
73 |
{ slug: File.basename(path, ".rb").to_sym, |
|
77 |
spec = { slug: File.basename(path, ".rb").to_sym,
|
|
74 | 78 |
kind: get_kind(path), |
75 |
path: plugin_dir } end end |
|
79 |
path: plugin_dir } end |
|
80 |
spec[:deprecated_spec] = deprecated_spec |
|
81 |
spec |
|
82 |
end |
|
76 | 83 | |
77 | 84 |
def get_spec_by_slug(slug) |
78 | 85 |
type_strict slug => Symbol |
... | ... | |
131 | 138 |
::Plugin.create(spec[:slug].to_sym) do |
132 | 139 |
self.spec = spec end |
133 | 140 |
Kernel.load File.join(spec[:path], "#{spec[:slug]}.rb") |
141 |
if spec[:deprecated_spec] |
|
142 |
title = "#{spec[:slug]}: spec file is deprecated." |
|
143 |
Plugin.call(:modify_activity, |
|
144 |
{ plugin: spec[:slug], |
|
145 |
kind: "warning", |
|
146 |
title: title, |
|
147 |
date: Time.now, |
|
148 |
description: "#{title}\nUse .mikutter_plugin instead."}) end |
|
134 | 149 |
true end |
135 | 150 |
end |
136 | 151 |
end |
core/plugin/activity/activity.rb | ||
---|---|---|
323 | 323 |
defactivity "dm", _("ダイレクトメッセージ") |
324 | 324 |
defactivity "system", _("システムメッセージ") |
325 | 325 |
defactivity "error", _("エラー") |
326 |
defactivity "warning", _("警告") |
|
326 | 327 | |
327 | 328 |
end |