Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mikutterプラギン対応 #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "mruby"]
path = mruby
url = https://github.com/rinsuki/iMast-mruby.git
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
platform :ios, '10.0'

def based_pods
pod 'SwiftLint', '~> 0.30.1'
Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ SPEC CHECKSUMS:
XCGLogger: 7f7f43f15dfe3a305fa1342b7dc29af656289abd
"※ikemen": 0cf85af52790db21a846ad31abca356e99da1ffb

PODFILE CHECKSUM: 0792bbfe8140855e254d511284e5990241abe770
PODFILE CHECKSUM: 1e189b8a1ad2c74c270a7df9c1d6dd7848a52872

COCOAPODS: 1.5.3
50 changes: 48 additions & 2 deletions iMast.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
CE1002D9200683B30041B636 /* ReportError_AppExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE1002D7200683B00041B636 /* ReportError_AppExtension.swift */; };
CE1002DA2006840C0041B636 /* ReportError_AppExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE1002D7200683B00041B636 /* ReportError_AppExtension.swift */; };
CE109714220631E5000A5101 /* EmojiListTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE109713220631E5000A5101 /* EmojiListTableViewController.swift */; };
CE250632222455B800316BE6 /* RubyMikuWorld.bundle in Resources */ = {isa = PBXBuildFile; fileRef = CE250631222455B800316BE6 /* RubyMikuWorld.bundle */; };
CE272D651F340A7900265C07 /* MastodonPostAbuseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE272D641F340A7900265C07 /* MastodonPostAbuseViewController.swift */; };
CE2C9804210A54F200A4FECF /* UIView+ignoreSmartInvert.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE2C9803210A54F200A4FECF /* UIView+ignoreSmartInvert.swift */; };
CE2C9805210A579C00A4FECF /* UIView+ignoreSmartInvert.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE2C9803210A54F200A4FECF /* UIView+ignoreSmartInvert.swift */; };
Expand Down Expand Up @@ -184,6 +185,10 @@
CEE357231FF6067F00675DFC /* EventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE357211FF5E0B300675DFC /* EventListener.swift */; };
CEE357241FF6068000675DFC /* EventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE357211FF5E0B300675DFC /* EventListener.swift */; };
CEE357261FF6410600675DFC /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE357251FF6410600675DFC /* SettingsViewController.swift */; };
CEE3CC76222035F500D75CAE /* libmruby.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CEE3CC74222035DA00D75CAE /* libmruby.a */; };
CEE3CC78222049C700D75CAE /* PluginDirectoryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE3CC77222049C700D75CAE /* PluginDirectoryTableViewController.swift */; };
CEE3CC7A22207D9D00D75CAE /* PluginFileEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE3CC7922207D9D00D75CAE /* PluginFileEditViewController.swift */; };
CEE3CC8922210ADF00D75CAE /* ArgsOptionWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE3CC8822210ADF00D75CAE /* ArgsOptionWrapper.swift */; };
CEEB9F951FA1A32800B8AF03 /* ProfileCardBarcodeReaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEB9F941FA1A32800B8AF03 /* ProfileCardBarcodeReaderViewController.swift */; };
CEF121641FC828CA008DD494 /* MainTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF121631FC828CA008DD494 /* MainTabBarController.swift */; };
CEF15AFF1FF74F9400836A4C /* FollowRequestsListTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF15AFE1FF74F9400836A4C /* FollowRequestsListTableViewController.swift */; };
Expand Down Expand Up @@ -330,6 +335,7 @@
CE1002D4200683850041B636 /* ReportError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportError.swift; sourceTree = "<group>"; };
CE1002D7200683B00041B636 /* ReportError_AppExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportError_AppExtension.swift; sourceTree = "<group>"; };
CE109713220631E5000A5101 /* EmojiListTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiListTableViewController.swift; sourceTree = "<group>"; };
CE250631222455B800316BE6 /* RubyMikuWorld.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = RubyMikuWorld.bundle; sourceTree = "<group>"; };
CE2582D61FBD9B01004B6BFA /* iMastPlayground.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = iMastPlayground.playground; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
CE272D641F340A7900265C07 /* MastodonPostAbuseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MastodonPostAbuseViewController.swift; sourceTree = "<group>"; };
CE2C9803210A54F200A4FECF /* UIView+ignoreSmartInvert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+ignoreSmartInvert.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -436,6 +442,10 @@
CEE3571F1FF5D7D300675DFC /* WebSocketWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSocketWrapper.swift; sourceTree = "<group>"; };
CEE357211FF5E0B300675DFC /* EventListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventListener.swift; sourceTree = "<group>"; };
CEE357251FF6410600675DFC /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
CEE3CC74222035DA00D75CAE /* libmruby.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmruby.a; path = mruby/libmruby.a; sourceTree = "<group>"; };
CEE3CC77222049C700D75CAE /* PluginDirectoryTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginDirectoryTableViewController.swift; sourceTree = "<group>"; };
CEE3CC7922207D9D00D75CAE /* PluginFileEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginFileEditViewController.swift; sourceTree = "<group>"; };
CEE3CC8822210ADF00D75CAE /* ArgsOptionWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgsOptionWrapper.swift; sourceTree = "<group>"; };
CEEB9F941FA1A32800B8AF03 /* ProfileCardBarcodeReaderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCardBarcodeReaderViewController.swift; sourceTree = "<group>"; };
CEF121631FC828CA008DD494 /* MainTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabBarController.swift; sourceTree = "<group>"; };
CEF15AFE1FF74F9400836A4C /* FollowRequestsListTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowRequestsListTableViewController.swift; sourceTree = "<group>"; };
Expand All @@ -453,6 +463,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CEE3CC76222035F500D75CAE /* libmruby.a in Frameworks */,
12016E1E6EA21B23C8624547 /* Pods_iMast.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -533,6 +544,7 @@
2AF3520E1EAB9C5500777C2E = {
isa = PBXGroup;
children = (
CEE3CC74222035DA00D75CAE /* libmruby.a */,
CE9B1AA01F9C5B4D0044341A /* README.md */,
CE8DF1841FED41C4005278FE /* Podfile */,
36EBC83E8164ACB27CEDC2DA /* license_plist.yml */,
Expand Down Expand Up @@ -581,6 +593,7 @@
2AF352231EAB9C5600777C2E /* LaunchScreen.storyboard */,
2AF352261EAB9C5600777C2E /* Info.plist */,
CE69A90D1FA5D964006D1523 /* EurekaExtension.swift */,
CEE3CC7B22208B2500D75CAE /* MikuWorld */,
CEE357161FF5165700675DFC /* SharedSources */,
CEE3571F1FF5D7D300675DFC /* WebSocketWrapper.swift */,
2A66E80A1EB0254400735081 /* Bridge.h */,
Expand Down Expand Up @@ -765,6 +778,8 @@
CEE357251FF6410600675DFC /* SettingsViewController.swift */,
CECD756620FD92C1000D059A /* OtherMenuPushSettingsTableViewController.swift */,
CE8209972150EC390064FC93 /* OtherMenuPushSettingsGroupNotifyTableViewController.swift */,
CEE3CC77222049C700D75CAE /* PluginDirectoryTableViewController.swift */,
CEE3CC7922207D9D00D75CAE /* PluginFileEditViewController.swift */,
CE2D2AEF210C5CAF003B92B8 /* OtherMenuPushSettingsAccountTableViewController.swift */,
CE38C8DE1F853438004C4C9B /* OtherMenuHelpAndFeedbackViewController.swift */,
CE7ABB411FC5C1610087B387 /* ListsTableViewController.swift */,
Expand Down Expand Up @@ -827,6 +842,15 @@
path = CustomViews;
sourceTree = "<group>";
};
CEE3CC7B22208B2500D75CAE /* MikuWorld */ = {
isa = PBXGroup;
children = (
CE250631222455B800316BE6 /* RubyMikuWorld.bundle */,
CEE3CC8822210ADF00D75CAE /* ArgsOptionWrapper.swift */,
);
path = MikuWorld;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -1089,6 +1113,7 @@
files = (
CE54BC7C20E0546E0034B63E /* UserProfileBioTableViewCell.xib in Resources */,
CE415F5621D6E41300DA9A33 /* AddAccountSuccessViewController.xib in Resources */,
CE250632222455B800316BE6 /* RubyMikuWorld.bundle in Resources */,
CE54BC7820E041A50034B63E /* UserProfileInfoTableViewCell.xib in Resources */,
CE8DF1851FED41C4005278FE /* Podfile in Resources */,
CE8E8E661F172A770007A311 /* MastodonPostDetail.storyboard in Resources */,
Expand Down Expand Up @@ -1422,11 +1447,13 @@
buildActionMask = 2147483647;
files = (
CE54BC7420E033E20034B63E /* StableTableViewController.swift in Sources */,
CEE3CC7A22207D9D00D75CAE /* PluginFileEditViewController.swift in Sources */,
CEE254282004B5AA005FEB6F /* MastodonPost.swift in Sources */,
2AF3521B1EAB9C5500777C2E /* AppDelegate.swift in Sources */,
CE571B2F216E01B1003F1062 /* FeedbackViewController.swift in Sources */,
CE5DE8B721F513B40008D437 /* AVAssetExportSession+exportPromise.swift in Sources */,
CE7ABB401FC5B1880087B387 /* ListTimeLineTableViewController.swift in Sources */,
CEE3CC78222049C700D75CAE /* PluginDirectoryTableViewController.swift in Sources */,
CE818B91218570B800948309 /* ThirdpartyTrendTags.swift in Sources */,
CEE254232004A8B2005FEB6F /* MastodonAccount.swift in Sources */,
CEE357201FF5D7D300675DFC /* WebSocketWrapper.swift in Sources */,
Expand Down Expand Up @@ -1474,6 +1501,7 @@
CE6977871F0EE8A600C1B234 /* UserProfileTopViewController.swift in Sources */,
2A4A6C291EAC25AD001BB00A /* AddAccountIndexViewController.swift in Sources */,
CEE357221FF5E0B300675DFC /* EventListener.swift in Sources */,
CEE3CC8922210ADF00D75CAE /* ArgsOptionWrapper.swift in Sources */,
CE3DB68620FB07FE005CFD77 /* PushService.swift in Sources */,
CE90855D21918751006769DC /* R.generated.swift in Sources */,
CE69A90E1FA5D964006D1523 /* EurekaExtension.swift in Sources */,
Expand Down Expand Up @@ -1799,6 +1827,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/mruby/src/mruby/include";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1851,6 +1880,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/mruby/src/mruby/include";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
ONLY_ACTIVE_ARCH = YES;
Expand All @@ -1871,16 +1901,24 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 121;
DEVELOPMENT_TEAM = 4XKKKM86RN;
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
HEADER_SEARCH_PATHS = (
"$(SDKROOT)/usr/include/libxml2",
"$(SRCROOT)/mruby/src/mruby/include",
);
INFOPLIST_FILE = iMast/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/mruby",
);
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-Xfrontend\" \"-warn-long-function-bodies=1000\" \"-D\" \"IS_DEBUG_BUILD\"";
PRODUCT_BUNDLE_IDENTIFIER = jp.pronama.imast;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = iMast/Bridge.h;
SWIFT_VERSION = 4.2;
SYSTEM_HEADER_SEARCH_PATHS = "";
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
Expand All @@ -1896,16 +1934,24 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 121;
DEVELOPMENT_TEAM = 4XKKKM86RN;
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
HEADER_SEARCH_PATHS = (
"$(SDKROOT)/usr/include/libxml2",
"$(SRCROOT)/mruby/src/mruby/include",
);
INFOPLIST_FILE = iMast/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/mruby",
);
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-Xfrontend\" \"-warn-long-function-bodies=1000\"";
PRODUCT_BUNDLE_IDENTIFIER = jp.pronama.imast;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = iMast/Bridge.h;
SWIFT_VERSION = 4.2;
SYSTEM_HEADER_SEARCH_PATHS = "";
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down
22 changes: 22 additions & 0 deletions iMast/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
} catch {
print("tmp remove failed...", error)
}

try! FileManager.default.createDirectory(at: pluginHome, withIntermediateDirectories: true, attributes: nil)

mrb_define_global_const(pluginVM, "IMAST_PLUGIN_DIRECTORY", mrb_str_new_cstr(pluginVM, pluginHome.path))
// mrb_define_method(pluginVM, mrb_module_get(pluginVM, "Kernel"), "command", { (mrb, value) -> mrb_value in
// print(value)
//
// let count = mrb_get_argc(mrb)
// let argv = mrb_get_argv(mrb)
// print(count)
// var value2 = value
// let ret = mrb_funcall_argv(pluginVM, mrb_obj_value(UnsafeMutableRawPointer(pluginVM!.pointee.kernel_module)), mrb_intern_cstr(pluginVM, "p"), count, argv)
// return value
// }, .rest)
print(R.file.rubyMikuWorldBundle.url()!.appendingPathComponent("bootstrap.rb"))
mrb_load_string(pluginVM, "require '\(R.file.rubyMikuWorldBundle.url()!.appendingPathComponent("bootstrap.rb").path)'")

return true
}

Expand Down Expand Up @@ -313,3 +330,8 @@ func changeRootVC(_ viewController: UIViewController, animated: Bool) {
window.rootViewController = viewController
}
}

let pluginAppGroup = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.jp.pronama.imast.plugins")!
let pluginHome = pluginAppGroup.appendingPathComponent("Documents").appendingPathComponent("plugin")
let pluginVM = mrb_open()

3 changes: 3 additions & 0 deletions iMast/Bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
#define Briding_Header_h

#include <CommonCrypto/CommonDigest.h>
#include <mruby.h>
#include <mruby/compile.h>
#include <mruby/proc.h>

#endif /* Briding_Header_h */
18 changes: 18 additions & 0 deletions iMast/CustomViews/MastodonPostDetailTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,24 @@ class MastodonPostDetailTableViewController: UITableViewController, UITextViewDe
let actionSheet = UIAlertController(title: "アクション", message: "", preferredStyle: UIAlertController.Style.actionSheet)
actionSheet.popoverPresentationController?.sourceView = self.moreButton as UIView
actionSheet.popoverPresentationController?.sourceRect = (self.moreButton as UIView).bounds
// mruby zone
let plugin = mrb_obj_value(UnsafeMutableRawPointer(mrb_class_get(pluginVM, "Plugin")))
let args = [
mrb_symbol_value(mrb_intern_cstr(pluginVM, "command")),
mrb_class_new_instance(pluginVM, 0, nil, mrb_class_get(pluginVM, "Hash"))
]
// let argsAddr = UnsafeMutablePointer<mrb_value>(mrb_calloc(pluginVM, args.count, MemoryLayout<mrb_value>.size))
// argsAddr[0] = args[0]
let arr = mrb_funcall_argv(pluginVM, plugin, mrb_intern_cstr(pluginVM, "filtering"), 2, args)
print(mrb_any_to_s(pluginVM, arr))
print(arr)
var callback = mrb_obj_value(mrb_proc_new_cfunc(pluginVM, { (vm, prop) -> mrb_value in
print("む")
let arr = Array(UnsafeBufferPointer(start: mrb_get_argv(vm), count: Int(mrb_get_argc(vm))))
print(arr)
return prop
}))
mrb_funcall_argv(pluginVM, arr, mrb_intern_cstr(pluginVM, "foreach"), 1, &callback)
// ---
actionSheet.addAction(UIAlertAction(title: "文脈", style: UIAlertAction.Style.default, handler: { action in
MastodonUserToken.getLatestUsed()?.context(post: post).then { res in
Expand Down
35 changes: 35 additions & 0 deletions iMast/MikuWorld/ArgsOptionWrapper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// ArgsOptionWrapper.swift
// iMast
//
// Created by user on 2019/02/23.
// Copyright © 2019 rinsuki. All rights reserved.
//

import Foundation

extension mrb_aspec {
static let none: mrb_aspec = 0

static func requiredArgs(_ count: UInt32) -> mrb_aspec {
return (count & 0x1f) << 18
}

static func optionalArgs(_ count: UInt32) -> mrb_aspec {
return (count & 0x1f) << 13
}

// *hoge 的な
static let rest: mrb_aspec = 1 << 12

// *hoge の後のやつ
static func afterRestRequiredArgs(_ count: UInt32) -> mrb_aspec {
return (count & 0x1f) << 7
}

static func keyArgs(keys: UInt32, kdict: Bool) -> mrb_aspec {
return ((keys & 0x1f) << 2) | (kdict ? 1 : 0)
}

static let blockArg: mrb_aspec = 1
}
13 changes: 13 additions & 0 deletions iMast/MikuWorld/RubyMikuWorld.bundle/bootstrap.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
begin
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "Libraries")
# require "pluggaloid"
puts "Hello mruby world!"

Delayer.default = Delayer.generate_class(priority: %i<high normal low>, default: :normal)

plugins = []
require File.join(File::dirname(__FILE__), 'hoge')
rescue Exception => e
puts e.inspect.gsub(File::dirname(__FILE__), "/{APP_DIR}").gsub(IMAST_PLUGIN_DIRECTORY, "/{PLUGIN_DIR}")
puts e.backtrace.map{|v| "\t" + v}.join("\n").gsub(File::dirname(__FILE__), "/{APP_DIR}").gsub(IMAST_PLUGIN_DIRECTORY, "/{PLUGIN_DIR}")
end
21 changes: 21 additions & 0 deletions iMast/MikuWorld/RubyMikuWorld.bundle/hoge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Plugin < Pluggaloid::Plugin
# mikutterコマンドを定義
# ==== Args
# [slug] コマンドスラッグ
# [options] コマンドオプション
# [&exec] コマンドの実行内容
def command(slug, options, &exec)
command = options.merge(slug: slug, exec: exec, plugin: @name).freeze
add_event_filter(:command){ |menu|
menu[slug] = command
[menu]
}
end
end

Dir.foreach(IMAST_PLUGIN_DIRECTORY) { |f|
p f
require File.join(IMAST_PLUGIN_DIRECTORY, f) if f.end_with? ".rb"
}

p Plugin.filtering(:command, Hash.new)
Loading