ruboty-search_plugin 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7330ea7821a48cc388884648679e44ee8dca69c5
4
+ data.tar.gz: d5e3af397347f7a758e7a750fdd73aae577d4f27
5
+ SHA512:
6
+ metadata.gz: 88728aa3c8852a4094c14be3fdddec1c4b8c16f9e58dfc11a78485aec69c065899fd9c226bd4d60d9f30ca3d3a6f9511529117d2f897145bf626d9041b59bae9
7
+ data.tar.gz: 646c1395e66f1d0ab421451359d534d67511b218de54d27514633f15f016642e28fbfe5a769cd76855c08fbb74736e290cc8f8cbc24b9ffbf6631c73d2e85e21
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruboty-search_plugin.gemspec
4
+ gemspec
5
+ gem 'ruboty-sonar'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 tbpgr
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,103 @@
1
+ # Ruboty::SearchPlugin
2
+
3
+ An Ruboty Handler + Actions to output ruboty plugin search result.
4
+
5
+ [Ruboty](https://github.com/r7kamura/ruboty) is Chat bot framework. Ruby + Bot = Ruboty
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'ruboty-search_plugin'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install ruboty-search_plugin
22
+
23
+
24
+ ## Commands
25
+
26
+ |Command|Pattern|Description|
27
+ |:--|:--|:--|
28
+ |[info](#info)|/search_plugin info (?<gem_name>.+)\z/|get ruboty-plugin info|
29
+ |[random](#random)|/search_plugin random\z/|get ruboty-plugin info at random|
30
+ |[ranking](#ranking)|/search_plugin ranking (?<limit>\d+)\z/|get ruboty-plugin ranking|
31
+ |[author_ranking](#author_ranking)|/search_plugin author_ranking (?<limit>\d+)\z/|get ruboty-plugin author_ranking|
32
+
33
+ ## Usage
34
+ ### info
35
+ * get ruboty-plugin info
36
+
37
+ ~~~
38
+ >ruboty search_plugin info ruboty-megen
39
+ >name:ruboty-megen
40
+ >desc:ruboty-megen generate ruboty README.md template.
41
+ >downloads:378
42
+ >rubygems_uri:http://rubygems.org/gems/ruboty-megen
43
+ >homepage_uri:https://github.com/tbpgr/ruboty-megen
44
+ ~~~
45
+
46
+ ### random
47
+ * get ruboty-plugin info at random
48
+
49
+ ~~~
50
+ >ruboty search_plugin random
51
+ >name:ruboty-attendance
52
+ >desc:System of attendance by ruboty.
53
+ >downloads:345
54
+ >rubygems_uri:http://rubygems.org/gems/ruboty-attendance
55
+ >homepage_uri:
56
+ >
57
+ >ruboty search_plugin random
58
+ >name:ruboty-gcal
59
+ >desc:Google Calendar API Wrapper for ruboty
60
+ >downloads:128
61
+ >rubygems_uri:http://rubygems.org/gems/ruboty-gcal
62
+ >homepage_uri:https://github.com/nekova/ruboty-gcal
63
+ ~~~
64
+
65
+ ### ranking
66
+ * get ruboty-plugin ranking
67
+
68
+ ~~~
69
+ >ruboty search_plugin ranking 3
70
+ >no:1,name:ruboty-redis,downloads:881
71
+ >no:2,name:ruboty-lgtm,downloads:836
72
+ >no:3,name:ruboty-twitter,downloads:634
73
+ ~~~
74
+
75
+ ### author_ranking
76
+ * get ruboty-plugin author_ranking
77
+
78
+ ~~~
79
+ >ruboty search_plugin author_ranking 3
80
+ >no:1,author:block_given?,downloads:4674
81
+ >no:2,author:Ryo Nakamura,downloads:2021
82
+ >no:3,author:negipo,downloads:836
83
+ ~~~
84
+
85
+ ## ENV
86
+
87
+ |Name|Description|
88
+ |:--|:--|
89
+ |--|--|
90
+
91
+ ## Dependency
92
+
93
+ |Name|Description|
94
+ |:--|:--|
95
+ |ruboty-sonar gem|<i class="fa fa-github-square" style="font-size:1em;"></i> [ruboty-sonar gem](https://github.com/tbpgr/ruboty-sonar)|
96
+
97
+ ## Contributing
98
+
99
+ 1. Fork it ( https://github.com/tbpgr/ruboty-search_plugin/fork )
100
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
101
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
102
+ 4. Push to the branch (`git push origin my-new-feature`)
103
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,31 @@
1
+ require "ruboty/search_plugin/actions/info"
2
+ require "ruboty/search_plugin/actions/random"
3
+ require "ruboty/search_plugin/actions/ranking"
4
+ require "ruboty/search_plugin/actions/author_ranking"
5
+
6
+ module Ruboty
7
+ module Handlers
8
+ class SearchPlugin < Base
9
+ on /search_plugin info (?<gem_name>.+)\z/, name: 'info', description: 'get ruboty-plugin info'
10
+ on /search_plugin random\z/, name: 'random', description: 'get ruboty-plugin info at random'
11
+ on /search_plugin ranking (?<limit>\d+)\z/, name: 'ranking', description: 'get ruboty-plugin ranking'
12
+ on /search_plugin author_ranking (?<limit>\d+)\z/, name: 'author_ranking', description: 'get ruboty-plugin author_ranking'
13
+
14
+ def info(message)
15
+ Ruboty::SearchPlugin::Actions::Info.new(message).call
16
+ end
17
+
18
+ def random(message)
19
+ Ruboty::SearchPlugin::Actions::Random.new(message).call
20
+ end
21
+
22
+ def ranking(message)
23
+ Ruboty::SearchPlugin::Actions::Ranking.new(message).call
24
+ end
25
+
26
+ def author_ranking(message)
27
+ Ruboty::SearchPlugin::Actions::AuthorRanking.new(message).call
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,8 @@
1
+ require "ruboty/search_plugin/version"
2
+ require "ruboty/handlers/search_plugin"
3
+
4
+ module Ruboty
5
+ module SearchPlugin
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ require 'ruboty/search_plugin/actions/ruboty-sonar_helper'
2
+
3
+ module Ruboty
4
+ module SearchPlugin
5
+ module Actions
6
+ class AuthorRanking < Ruboty::Actions::Base
7
+ include RubotySonarHelper
8
+
9
+ def call
10
+ message.reply(author_ranking)
11
+ end
12
+
13
+ private
14
+
15
+ def author_ranking
16
+ call_method(:author_ranking, limit).map.with_index(1) do |gem_info, i|
17
+ "no:#{i},author:#{gem_info[:authors]},downloads:#{gem_info[:downloads]}"
18
+ end.join("\n")
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ require 'ruboty/search_plugin/actions/ruboty-sonar_helper'
2
+
3
+ module Ruboty
4
+ module SearchPlugin
5
+ module Actions
6
+ class Info < Ruboty::Actions::Base
7
+ include RubotySonarHelper
8
+
9
+ def call
10
+ message.reply(info)
11
+ end
12
+
13
+ private
14
+
15
+ def info
16
+ gem_info = call_method(:info, gem_name)
17
+ <<-EOS
18
+ name:#{gem_info[:name]}
19
+ desc:#{gem_info[:desc]}
20
+ downloads:#{gem_info[:downloads]}
21
+ rubygems_uri:#{gem_info[:rubygems_uri]}
22
+ homepage_uri:#{gem_info[:homepage_uri]}
23
+ EOS
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ require 'ruboty/search_plugin/actions/ruboty-sonar_helper'
2
+
3
+ module Ruboty
4
+ module SearchPlugin
5
+ module Actions
6
+ class Random < Ruboty::Actions::Base
7
+ include RubotySonarHelper
8
+
9
+ def call
10
+ message.reply(random)
11
+ end
12
+
13
+ private
14
+
15
+ def random
16
+ gem_info = call_method(:random)
17
+ <<-EOS
18
+ name:#{gem_info[:name]}
19
+ desc:#{gem_info[:desc]}
20
+ downloads:#{gem_info[:downloads]}
21
+ rubygems_uri:#{gem_info[:rubygems_uri]}
22
+ homepage_uri:#{gem_info[:homepage_uri]}
23
+ EOS
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,23 @@
1
+ require 'ruboty/search_plugin/actions/ruboty-sonar_helper'
2
+
3
+ module Ruboty
4
+ module SearchPlugin
5
+ module Actions
6
+ class Ranking < Ruboty::Actions::Base
7
+ include RubotySonarHelper
8
+
9
+ def call
10
+ message.reply(ranking)
11
+ end
12
+
13
+ private
14
+
15
+ def ranking
16
+ call_method(:ranking, limit).map.with_index(1) do |gem_info, i|
17
+ "no:#{i},name:#{gem_info[:name]},downloads:#{gem_info[:downloads]}"
18
+ end.join("\n")
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ require 'ruboty-sonar'
2
+
3
+ module RubotySonarHelper
4
+ def call_method(method_name, *args)
5
+ if args.size == 0
6
+ RubotySonar.send(method_name)
7
+ else
8
+ RubotySonar.send(method_name, args.first)
9
+ end
10
+ end
11
+
12
+ def gem_name
13
+ message[:gem_name]
14
+ end
15
+
16
+ def limit
17
+ message[:limit].to_i
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module SearchPlugin
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruboty/search_plugin/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-search_plugin"
8
+ spec.version = Ruboty::SearchPlugin::VERSION
9
+ spec.authors = ["tbpgr"]
10
+ spec.email = ["tbpgr@tbpgr.jp"]
11
+ spec.summary = %q{An Ruboty Handler + Actions to output ruboty plugin search result.}
12
+ spec.description = %q{An Ruboty Handler + Actions to output ruboty plugin search result.}
13
+ spec.homepage = "https://github.com/tbpgr/ruboty-search_plugin"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "ruboty"
22
+ spec.add_runtime_dependency "ruboty-sonar"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-search_plugin
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - tbpgr
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruboty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruboty-sonar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: An Ruboty Handler + Actions to output ruboty plugin search result.
70
+ email:
71
+ - tbpgr@tbpgr.jp
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/ruboty/handlers/search_plugin.rb
82
+ - lib/ruboty/search_plugin.rb
83
+ - lib/ruboty/search_plugin/actions/author_ranking.rb
84
+ - lib/ruboty/search_plugin/actions/info.rb
85
+ - lib/ruboty/search_plugin/actions/random.rb
86
+ - lib/ruboty/search_plugin/actions/ranking.rb
87
+ - lib/ruboty/search_plugin/actions/ruboty-sonar_helper.rb
88
+ - lib/ruboty/search_plugin/version.rb
89
+ - ruboty-search_plugin.gemspec
90
+ homepage: https://github.com/tbpgr/ruboty-search_plugin
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.3.0
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: An Ruboty Handler + Actions to output ruboty plugin search result.
114
+ test_files: []