ruboty-itamae_search 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: 22ceac508ce1e6bdd901fa014c50ae47d17d7876
4
+ data.tar.gz: e304f2f6219abcfb9da1aa759eee85cc97babdef
5
+ SHA512:
6
+ metadata.gz: 3a2cf2bb0388fb705654f84363f589df94f254f1da3d214de6e69e52e7851586e929fee67a9f36e1ad89cea67e7890a94b8ab2475db47695ad8dd7691c299850
7
+ data.tar.gz: d4241b70860c90120d4a870bb5cfc52c36fd8593fe29a4c29ea04a2d1eb9c485dc1c039f11ec59434c12eb081af11a3ae7303576901e95dbfccee999f85f7181
@@ -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-itamae_search.gemspec
4
+ gemspec
5
+ gem 'itamae-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,104 @@
1
+ # Ruboty::ItamaeSearch
2
+
3
+ An Ruboty Handler + Actions to output itamae plugin search result.
4
+
5
+ * [Ruboty](https://github.com/r7kamura/ruboty) is Chat bot framework. Ruby + Bot = Ruboty
6
+ * [Itamae](https://github.com/ryotarai/itamae) is Simple and lightweight configuration management tool inspired by Chef.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'ruboty-itamae_search'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install ruboty-itamae_search
23
+
24
+
25
+ ## Commands
26
+
27
+ |Command|Pattern|Description|
28
+ |:--|:--|:--|
29
+ |[info](#info)|/itamae_search info (?<gem_name>.+)\z/|get itamae-plugin info|
30
+ |[random](#random)|/itamae_search random\z/|get itamae-plugin info at random|
31
+ |[ranking](#ranking)|/itamae_search ranking (?<limit>\d+)\z/|get itamae-plugin ranking|
32
+ |[author_ranking](#author_ranking)|/itamae_search author_ranking (?<limit>\d+)\z/|get itamae-plugin author_ranking|
33
+
34
+ ## Usage
35
+ ### info
36
+ * get itamae-plugin info
37
+
38
+ ~~~
39
+ > ruboty itamae_search info itamae
40
+ name:itamae
41
+ desc:Simple Configuration Management Tool
42
+ downloads:6895
43
+ rubygems_uri:http://rubygems.org/gems/itamae
44
+ homepage_uri:https://github.com/ryotarai/itamae
45
+ ~~~
46
+
47
+ ### random
48
+ * get itamae-plugin info at random
49
+
50
+ ~~~
51
+ > ruboty itamae_search random
52
+ name:itamae-plugin-recipe-openresty
53
+ desc:Itamae openresty recipe plugin
54
+ downloads:96
55
+ rubygems_uri:http://rubygems.org/gems/itamae-plugin-recipe-openresty
56
+ homepage_uri:
57
+
58
+ > ruboty itamae_search random
59
+ name:itamae-plugin-resource-ghq
60
+ desc:Itamae resource plugin to manage repositories with ghq.
61
+ downloads:165
62
+ rubygems_uri:http://rubygems.org/gems/itamae-plugin-resource-ghq
63
+ homepage_uri:https://github.com/k0kubun/itamae-plugin-resource-ghq
64
+ ~~~
65
+
66
+ ### ranking
67
+ * get itamae-plugin ranking
68
+
69
+ ~~~
70
+ > ruboty itamae_search ranking 3
71
+ no:1,name:itamae-plugin-resource-mail_alias,downloads:1069
72
+ no:2,name:itamae-plugin-recipe-selinux,downloads:1065
73
+ no:3,name:itamae-plugin-resource-cask,downloads:628
74
+ ~~~
75
+
76
+ ### author_ranking
77
+ * get itamae-plugin author_ranking
78
+
79
+ ~~~
80
+ > ruboty itamae_search author_ranking 3
81
+ no:1,author:Gosuke Miyashita,downloads:2134
82
+ no:2,author:Takashi Kokubun,downloads:915
83
+ no:3,author:Ru/MuckRu,downloads:308
84
+ ~~~
85
+
86
+ ## ENV
87
+
88
+ |Name|Description|
89
+ |:--|:--|
90
+ |--|--|
91
+
92
+ ## Dependency
93
+
94
+ |Name|Description|
95
+ |:--|:--|
96
+ |ruboty-sonar gem|<i class="fa fa-github-square" style="font-size:1em;"></i> [itamae-sonar gem](https://github.com/tbpgr/itamae-sonar)|
97
+
98
+ ## Contributing
99
+
100
+ 1. Fork it ( https://github.com/tbpgr/ruboty-itamae_search/fork )
101
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
102
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
103
+ 4. Push to the branch (`git push origin my-new-feature`)
104
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,31 @@
1
+ require "ruboty/itamae_search/actions/info"
2
+ require "ruboty/itamae_search/actions/random"
3
+ require "ruboty/itamae_search/actions/ranking"
4
+ require "ruboty/itamae_search/actions/author_ranking"
5
+
6
+ module Ruboty
7
+ module Handlers
8
+ class ItamaeSearch < Base
9
+ on /itamae_search info (?<gem_name>.+)\z/, name: 'info', description: 'get itamae-plugin info'
10
+ on /itamae_search random\z/, name: 'random', description: 'get itamae-plugin info at random'
11
+ on /itamae_search ranking (?<limit>\d+)\z/, name: 'ranking', description: 'get itamae-plugin ranking'
12
+ on /itamae_search author_ranking (?<limit>\d+)\z/, name: 'author_ranking', description: 'get itamae-plugin author_ranking'
13
+
14
+ def info(message)
15
+ Ruboty::ItamaeSearch::Actions::Info.new(message).call
16
+ end
17
+
18
+ def random(message)
19
+ Ruboty::ItamaeSearch::Actions::Random.new(message).call
20
+ end
21
+
22
+ def ranking(message)
23
+ Ruboty::ItamaeSearch::Actions::Ranking.new(message).call
24
+ end
25
+
26
+ def author_ranking(message)
27
+ Ruboty::ItamaeSearch::Actions::AuthorRanking.new(message).call
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,8 @@
1
+ require "ruboty/itamae_search/version"
2
+ require "ruboty/handlers/itamae_search"
3
+
4
+ module Ruboty
5
+ module ItamaeSearch
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ require 'ruboty/itamae_search/actions/itamae-sonar_helper'
2
+
3
+ module Ruboty
4
+ module ItamaeSearch
5
+ module Actions
6
+ class AuthorRanking < Ruboty::Actions::Base
7
+ include ItamaeSonarHelper
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/itamae_search/actions/itamae-sonar_helper'
2
+
3
+ module Ruboty
4
+ module ItamaeSearch
5
+ module Actions
6
+ class Info < Ruboty::Actions::Base
7
+ include ItamaeSonarHelper
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,19 @@
1
+ require 'itamae-sonar'
2
+
3
+ module ItamaeSonarHelper
4
+ def call_method(method_name, *args)
5
+ if args.size == 0
6
+ ItamaeSonar.send(method_name)
7
+ else
8
+ ItamaeSonar.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,28 @@
1
+ require 'ruboty/itamae_search/actions/itamae-sonar_helper'
2
+
3
+ module Ruboty
4
+ module ItamaeSearch
5
+ module Actions
6
+ class Random < Ruboty::Actions::Base
7
+ include ItamaeSonarHelper
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/itamae_search/actions/itamae-sonar_helper'
2
+
3
+ module Ruboty
4
+ module ItamaeSearch
5
+ module Actions
6
+ class Ranking < Ruboty::Actions::Base
7
+ include ItamaeSonarHelper
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,5 @@
1
+ module Ruboty
2
+ module ItamaeSearch
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/itamae_search/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-itamae_search"
8
+ spec.version = Ruboty::ItamaeSearch::VERSION
9
+ spec.authors = ["tbpgr"]
10
+ spec.email = ["tbpgr@tbpgr.jp"]
11
+ spec.summary = %q{An Ruboty Handler + Actions to output itamae plugin search result.}
12
+ spec.description = %q{An Ruboty Handler + Actions to output itamae plugin search result.}
13
+ spec.homepage = "https://github.com/tbpgr/ruboty-itamae_search"
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 "itamae-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-itamae_search
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-04 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: itamae-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 itamae 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/itamae_search.rb
82
+ - lib/ruboty/itamae_search.rb
83
+ - lib/ruboty/itamae_search/actions/author_ranking.rb
84
+ - lib/ruboty/itamae_search/actions/info.rb
85
+ - lib/ruboty/itamae_search/actions/itamae-sonar_helper.rb
86
+ - lib/ruboty/itamae_search/actions/random.rb
87
+ - lib/ruboty/itamae_search/actions/ranking.rb
88
+ - lib/ruboty/itamae_search/version.rb
89
+ - ruboty-itamae_search.gemspec
90
+ homepage: https://github.com/tbpgr/ruboty-itamae_search
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 itamae plugin search result.
114
+ test_files: []