Project

General

Profile

最適化 #615 » plugin.patch

Osamu Koga, 2013-10-07 01:58

View differences:

core/miquire_plugin.rb
def get_spec(path)
type_strict path => String
plugin_dir = FileTest.directory?(path) ? path : File.dirname(path)
spec_filename = File.join(plugin_dir, "spec")
spec_filename = File.join(plugin_dir, ".mikutter_plugin")
deprecated_spec = false;
unless FileTest.exist? spec_filename
spec_filename = File.join(plugin_dir, "spec")
deprecated_spec = true
end
if FileTest.exist? spec_filename
spec = YAML.load_file(spec_filename).symbolize
spec[:path] = plugin_dir
spec[:kind] = get_kind(path)
spec
elsif FileTest.exist? path
{ slug: File.basename(path, ".rb").to_sym,
spec = { slug: File.basename(path, ".rb").to_sym,
kind: get_kind(path),
path: plugin_dir } end end
path: plugin_dir } end
spec[:deprecated_spec] = deprecated_spec
spec
end
def get_spec_by_slug(slug)
type_strict slug => Symbol
......
::Plugin.create(spec[:slug].to_sym) do
self.spec = spec end
Kernel.load File.join(spec[:path], "#{spec[:slug]}.rb")
if spec[:deprecated_spec]
title = "#{spec[:slug]}: spec file is deprecated."
Plugin.call(:modify_activity,
{ plugin: spec[:slug],
kind: "warning",
title: title,
date: Time.now,
description: "#{title}\nUse .mikutter_plugin instead."}) end
true end
end
end
core/plugin/activity/activity.rb
defactivity "dm", _("ダイレクトメッセージ")
defactivity "system", _("システムメッセージ")
defactivity "error", _("エラー")
defactivity "warning", _("警告")
end
(1-1/2)