ruboty-yes 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ad559e66958c3e73901fc9cb5bbdbe73a871a20c
4
+ data.tar.gz: b28ae9690444cc32f746595fd858c5530ce4961a
5
+ SHA512:
6
+ metadata.gz: fdf7e7956a59d3c1dd874b26633f292eee019bd3594f709db1fb733e591393f8003dea516ac9db5ce14d714d6845562849f2e075afbbcfa1f25830be8727d119
7
+ data.tar.gz: 642d9a728721775598ac5e087215cb78ca323aff1f2c7020e0eccf0d00888dfd9b82acbe44682ad601e74b0e240d7025688237906b43470c209bec4c0fa9c9ec
@@ -0,0 +1,15 @@
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
15
+ vendor/bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruboty-yes.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 block_given?
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,31 @@
1
+ # Ruboty::Yes
2
+
3
+ ruboty plugin for say yes to everything.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ruboty-yes'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ruboty-yes
20
+
21
+ ## Usage
22
+
23
+ @ruboty are you robot?
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/blockgiven/ruboty-yes/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ t.pattern = ['spec/**{,/*/**}/*_spec.rb', 'spec/**{,/*/**}/*.feature']
6
+ t.rspec_opts = '-r turnip/rspec'
7
+ end
8
+ task default: :spec
@@ -0,0 +1,13 @@
1
+ require "ruboty/yes/actions/yes"
2
+
3
+ module Ruboty
4
+ module Handlers
5
+ class Yes < Base
6
+ on /.*(\?|?)/, name: 'yes', description: 'say yes to everything.', all: true
7
+
8
+ def yes(message)
9
+ Ruboty::Yes::Actions::Yes.new(message).call
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ require "ruboty/yes/version"
2
+ require "ruboty/handlers/yes"
3
+
4
+ module Ruboty
5
+ module Yes
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ module Ruboty
2
+ module Yes
3
+ module Actions
4
+ class Yes < Ruboty::Actions::Base
5
+ def call
6
+ body = %w(そうだね そうだよ いいと思う いいね YES! その通り).sample
7
+ message.reply(body, from: message.robot.name)
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module Yes
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/yes/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-yes"
8
+ spec.version = Ruboty::Yes::VERSION
9
+ spec.authors = ["block_given?"]
10
+ spec.email = ["block_given@outlook.com"]
11
+ spec.summary = %q{ruboty plugin for say yes to everything.}
12
+ spec.homepage = "https://github.com/blockgiven/ruboty-yes"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "ruboty"
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "pry"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "turnip"
26
+ end
@@ -0,0 +1,37 @@
1
+ # language: ja
2
+
3
+ フィーチャ: Rubotyにどんなことを尋ねても黙って背中を押してくれる
4
+
5
+ Rubotyのともだちとして、
6
+ 親友のRubotyに物事を相談したとき、黙って背中を押してほしい、
7
+ なぜなら、勇気をもらいたいからだ。
8
+
9
+ 背景:
10
+ 前提 テスト用のRubotyがいる
11
+ かつ Rubotyの名前はサバンナライオンである
12
+
13
+
14
+ シナリオ: 「テスト書いた方がいいですかね?」とAlliceが聞くと、サバンナライオンは肯定した
15
+ もし Aliceが"テスト書いた方がいいですかね?"と発言した
16
+ ならば サバンナライオンはAliceに次のいずれかで答える:
17
+ | そうだね |
18
+ | そうだよ |
19
+ | いいと思う |
20
+ | いいね |
21
+ | YES! |
22
+ | その通り |
23
+
24
+ シナリオ: 「でもテスト書かないほうがいいですよね?」とAliceが聞くと、サバンナライオンは肯定した
25
+ もし Aliceが"でもテスト書かないほうがいいですよね?"と発言した
26
+ ならば サバンナライオンは"それサバンナライオンの前でも同じこと言えんの?"とは答えない
27
+ しかし サバンナライオンはAliceに次のいずれかで答える:
28
+ | そうだね |
29
+ | そうだよ |
30
+ | いいと思う |
31
+ | いいね |
32
+ | YES! |
33
+ | その通り |
34
+
35
+ シナリオ: 「テスト書いた方がいいですかね...」とAlliceがつぶやく、Rubotyは黙ってそれを見守っている
36
+ もし Aliceが"テスト書いた方がいいですかね..."と発言した
37
+ ならば Rubotyは黙っている
@@ -0,0 +1,5 @@
1
+ require 'ruboty'
2
+ require 'ruboty/yes'
3
+
4
+ Dir.glob("spec/steps/**/*steps.rb") { |f| load f, true }
5
+ Dir.glob("spec/support/**/*.rb") {|f| load f }
@@ -0,0 +1,30 @@
1
+ step 'テスト用のRubotyがいる' do
2
+ @ruboty = ::Ruboty::Robot.new
3
+ @ruboty.run
4
+ end
5
+
6
+ step 'Rubotyの名前は:nameである' do |name|
7
+ @ruboty.define_singleton_method(:name) do
8
+ name
9
+ end
10
+ end
11
+
12
+ step ':nameが:bodyと発言した' do |name, body|
13
+ @ruboty.receive(from: name, body: body)
14
+ end
15
+
16
+ step ':nameは:nameに次のいずれかで答える:' do |from, to, table|
17
+ expect(@ruboty.said).to be_any {|message|
18
+ message.from == from && message.to == to && table.to_a.flatten.include?(message.body)
19
+ }
20
+ end
21
+
22
+ step ':nameは:bodyとは答えない' do |from, body|
23
+ expect(@ruboty.said).not_to be_any {|message|
24
+ message.from == from && message.body.include?(body)
25
+ }
26
+ end
27
+
28
+ step 'Rubotyは黙っている' do
29
+ expect(@ruboty.said).to be_empty
30
+ end
@@ -0,0 +1,20 @@
1
+ module Ruboty
2
+ module Adapters
3
+ class Mock < Base
4
+ def run
5
+ end
6
+ end
7
+ end
8
+
9
+ module Testable
10
+ def say(message)
11
+ said << Message.new(message)
12
+ end
13
+
14
+ def said
15
+ @said ||= []
16
+ end
17
+ end
18
+
19
+ Robot.prepend(Testable)
20
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-yes
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - block_given?
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-30 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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
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
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: turnip
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - block_given@outlook.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - lib/ruboty/handlers/yes.rb
110
+ - lib/ruboty/yes.rb
111
+ - lib/ruboty/yes/actions/yes.rb
112
+ - lib/ruboty/yes/version.rb
113
+ - ruboty-yes.gemspec
114
+ - spec/acceptance/yes.feature
115
+ - spec/spec_helper.rb
116
+ - spec/steps/ruboty_steps.rb
117
+ - spec/support/ruboty-testable.rb
118
+ homepage: https://github.com/blockgiven/ruboty-yes
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.2.2
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: ruboty plugin for say yes to everything.
142
+ test_files:
143
+ - spec/acceptance/yes.feature
144
+ - spec/spec_helper.rb
145
+ - spec/steps/ruboty_steps.rb
146
+ - spec/support/ruboty-testable.rb