mikutter_plugin_base 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -1 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ require "rspec/core/rake_task"
4
+ RSpec::Core::RakeTask.new(:spec) do |task|
5
+ task.rspec_opts = ["-c", "-fs"]
6
+ end
7
+
8
+ task :default => :spec
9
+ task :test => :spec
@@ -1,3 +1,3 @@
1
1
  module MikutterPluginBase
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,17 +1,22 @@
1
- require "mikutter_plugin_base/version"
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 name, &procedure
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
@@ -0,0 +1,5 @@
1
+ # -*- coding: utf-8 -*-
2
+ $LOAD_PATH.unshift File.expand_path('../', __FILE__)
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'mikutter_plugin_base'
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.2
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: