mikutter_plugin_base 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +8 -0
- data/lib/mikutter_plugin_base/version.rb +1 -1
- data/lib/mikutter_plugin_base.rb +8 -3
- data/spec/plugin_base_spec.rb +10 -0
- data/spec/spec_helper.rb +5 -0
- metadata +6 -2
data/Rakefile
CHANGED
data/lib/mikutter_plugin_base.rb
CHANGED
@@ -1,17 +1,22 @@
|
|
1
|
-
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'active_support/inflector'
|
3
|
+
require 'mikutter_plugin_base/version'
|
2
4
|
|
3
5
|
module Mikutter
|
4
6
|
class PlugingBase
|
5
7
|
class << self
|
6
8
|
def register!
|
7
|
-
name = self.class.to_s.downcase.to_sym
|
8
9
|
instance = new
|
9
10
|
procedure = lambda do |plugin|
|
10
11
|
instance.method(:run).to_proc.call(
|
11
12
|
instance.method(:add_events).to_proc.call(plugin)
|
12
13
|
)
|
13
14
|
end
|
14
|
-
::Plugin.create
|
15
|
+
::Plugin.create to_plugin_name(self.class.to_s), &procedure
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_plugin_name(class_name)
|
19
|
+
class_name.underscore.to_sym
|
15
20
|
end
|
16
21
|
end
|
17
22
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Mikutter::PlugingBase do
|
5
|
+
describe '.to_plugin_name' do
|
6
|
+
it "should convert CamelCase class name to underscore symbol for plugin name" do
|
7
|
+
Mikutter::PlugingBase.to_plugin_name("CamelCase").should == :camel_case
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mikutter_plugin_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -26,6 +26,8 @@ files:
|
|
26
26
|
- lib/mikutter_plugin_base.rb
|
27
27
|
- lib/mikutter_plugin_base/version.rb
|
28
28
|
- mikutter_plugin_base.gemspec
|
29
|
+
- spec/plugin_base_spec.rb
|
30
|
+
- spec/spec_helper.rb
|
29
31
|
homepage: http://taiki45.github.com/mikutter-plugin-base/
|
30
32
|
licenses: []
|
31
33
|
post_install_message:
|
@@ -50,5 +52,7 @@ rubygems_version: 1.8.23
|
|
50
52
|
signing_key:
|
51
53
|
specification_version: 3
|
52
54
|
summary: Add new way to write mikutter plugin.
|
53
|
-
test_files:
|
55
|
+
test_files:
|
56
|
+
- spec/plugin_base_spec.rb
|
57
|
+
- spec/spec_helper.rb
|
54
58
|
has_rdoc:
|