mitten 0.0.5 → 0.0.6

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.
Files changed (47) hide show
  1. data/.gitignore +5 -24
  2. data/Gemfile +4 -0
  3. data/LICENSE +5 -4
  4. data/README.markdown +53 -0
  5. data/Rakefile +19 -45
  6. data/VERSION +1 -1
  7. data/bin/mitten +7 -0
  8. data/configs/example_environment.yaml +6 -5
  9. data/example/{sample.rb → echo.rb} +8 -2
  10. data/lib/mitten.rb +7 -9
  11. data/lib/{plugin.rb → mitten/plugin.rb} +9 -4
  12. data/lib/{utils.rb → mitten/utils.rb} +3 -2
  13. data/lib/mitten/version.rb +3 -0
  14. data/mitten.gemspec +16 -92
  15. metadata +58 -151
  16. data/.document +0 -5
  17. data/README.rdoc +0 -81
  18. data/bin/client +0 -10
  19. data/bin/daemon +0 -8
  20. data/configs/time_call.yaml +0 -13
  21. data/configs/twitter_bot.yaml +0 -3
  22. data/plugins/amazon_search.rb +0 -62
  23. data/plugins/bmi.rb +0 -48
  24. data/plugins/codepad.rb +0 -63
  25. data/plugins/fortune.rb +0 -40
  26. data/plugins/gasoline.rb +0 -46
  27. data/plugins/gmail.rb +0 -64
  28. data/plugins/google_profile.rb +0 -37
  29. data/plugins/google_transit.rb +0 -56
  30. data/plugins/google_weather.rb +0 -34
  31. data/plugins/holoscope.rb +0 -63
  32. data/plugins/loo_holoscope.rb +0 -51
  33. data/plugins/mixi_voice.rb +0 -139
  34. data/plugins/nanapi.rb +0 -31
  35. data/plugins/newspaper_headlines.rb +0 -48
  36. data/plugins/openpne_new_diary_check.rb +0 -66
  37. data/plugins/ramen.rb +0 -33
  38. data/plugins/rate.rb +0 -31
  39. data/plugins/screen_time_search.rb +0 -96
  40. data/plugins/time_call.rb +0 -25
  41. data/plugins/tweet.rb +0 -32
  42. data/plugins/twitter_bot.rb +0 -32
  43. data/plugins/typhoon.rb +0 -37
  44. data/plugins/uri_shorten.rb +0 -23
  45. data/spec/mitten_spec.rb +0 -11
  46. data/spec/spec.opts +0 -1
  47. data/spec/spec_helper.rb +0 -9
metadata CHANGED
@@ -1,175 +1,82 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mitten
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 5
9
- version: 0.0.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Tomohiro, TAIRA
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2010-03-16 00:00:00 +09:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: net-irc
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 0
30
- - 9
31
- version: 0.0.9
32
- type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: daemons
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 1
43
- - 0
44
- - 10
45
- version: 1.0.10
46
- type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: json_pure
12
+ date: 2011-10-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &75983460 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
50
23
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 1
57
- - 2
58
- - 0
59
- version: 1.2.0
24
+ version_requirements: *75983460
25
+ - !ruby/object:Gem::Dependency
26
+ name: net-irc
27
+ requirement: &75983220 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
60
33
  type: :runtime
61
- version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: rspec
64
34
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 1
71
- - 2
72
- - 9
73
- version: 1.2.9
74
- type: :development
75
- version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
77
- name: rake
78
- prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- segments:
84
- - 0
85
- - 8
86
- - 7
87
- version: 0.8.7
88
- type: :development
89
- version_requirements: *id005
35
+ version_requirements: *75983220
90
36
  description: Mitten is A Ruby IRC Bot Pluggable Framework
91
- email: tomohiro.t@gmail.com
92
- executables:
93
- - daemon
94
- - client
37
+ email:
38
+ - tomohiro.t@gmail.com
39
+ executables:
40
+ - mitten
95
41
  extensions: []
96
-
97
- extra_rdoc_files:
98
- - LICENSE
99
- - README.rdoc
100
- files:
101
- - .document
42
+ extra_rdoc_files: []
43
+ files:
102
44
  - .gitignore
45
+ - Gemfile
103
46
  - LICENSE
104
- - README.rdoc
47
+ - README.markdown
105
48
  - Rakefile
106
49
  - VERSION
107
- - bin/client
108
- - bin/daemon
50
+ - bin/mitten
109
51
  - configs/example_environment.yaml
110
- - configs/time_call.yaml
111
- - configs/twitter_bot.yaml
112
- - example/sample.rb
52
+ - example/echo.rb
113
53
  - lib/mitten.rb
114
- - lib/plugin.rb
115
- - lib/utils.rb
54
+ - lib/mitten/plugin.rb
55
+ - lib/mitten/utils.rb
56
+ - lib/mitten/version.rb
116
57
  - mitten.gemspec
117
- - plugins/amazon_search.rb
118
- - plugins/bmi.rb
119
- - plugins/codepad.rb
120
- - plugins/fortune.rb
121
- - plugins/gasoline.rb
122
- - plugins/gmail.rb
123
- - plugins/google_profile.rb
124
- - plugins/google_transit.rb
125
- - plugins/google_weather.rb
126
- - plugins/holoscope.rb
127
- - plugins/loo_holoscope.rb
128
- - plugins/mixi_voice.rb
129
- - plugins/nanapi.rb
130
- - plugins/newspaper_headlines.rb
131
- - plugins/openpne_new_diary_check.rb
132
- - plugins/ramen.rb
133
- - plugins/rate.rb
134
- - plugins/screen_time_search.rb
135
- - plugins/time_call.rb
136
- - plugins/tweet.rb
137
- - plugins/twitter_bot.rb
138
- - plugins/typhoon.rb
139
- - plugins/uri_shorten.rb
140
- - spec/mitten_spec.rb
141
- - spec/spec.opts
142
- - spec/spec_helper.rb
143
- has_rdoc: true
144
- homepage: http://rubygems.org/gems/mitten
58
+ homepage: http://github.com/Tomohiro/mittenn
145
59
  licenses: []
146
-
147
60
  post_install_message:
148
- rdoc_options:
149
- - --charset=UTF-8
150
- require_paths:
61
+ rdoc_options: []
62
+ require_paths:
151
63
  - lib
152
- required_ruby_version: !ruby/object:Gem::Requirement
153
- requirements:
154
- - - ">="
155
- - !ruby/object:Gem::Version
156
- segments:
157
- - 0
158
- version: "0"
159
- required_rubygems_version: !ruby/object:Gem::Requirement
160
- requirements:
161
- - - ">="
162
- - !ruby/object:Gem::Version
163
- segments:
164
- - 0
165
- version: "0"
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
166
76
  requirements: []
167
-
168
- rubyforge_project:
169
- rubygems_version: 1.3.6
77
+ rubyforge_project: mitten
78
+ rubygems_version: 1.8.10
170
79
  signing_key:
171
80
  specification_version: 3
172
- summary: IRC Bot Framework
173
- test_files:
174
- - spec/spec_helper.rb
175
- - spec/mitten_spec.rb
81
+ summary: Mitten
82
+ test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/README.rdoc DELETED
@@ -1,81 +0,0 @@
1
- = Mitten
2
-
3
- == Description
4
-
5
- Mitten is A Ruby IRC Bot Pluggable Framework.
6
-
7
-
8
- == Installation
9
-
10
- - RubyGems
11
-
12
- $ sudo gem install mitten
13
-
14
- - GitHub
15
-
16
- $ git clone http://github.com/Tomohiro/mitten.git
17
-
18
-
19
- == Usage
20
-
21
- 1. Usage
22
-
23
- $ ./bin/client -h
24
- $ ./bin/daemon run -- -h
25
-
26
- 2. Start
27
-
28
- $ ./bin/daemon start
29
-
30
- 3. Restart
31
-
32
- $ ./bin/daemon restart
33
-
34
- 4. Stop
35
-
36
- $ ./bin/daemon stop
37
-
38
- 5. Changed config file
39
-
40
- $ ./bin/daemon start -- -c lib/environment.yaml
41
-
42
- 6. Run on the top(not daemonize)
43
-
44
- $ ./bin/client
45
- $ ./bin/daemon run
46
-
47
-
48
- == Rake tasks
49
-
50
- 1. Display Rake tasks
51
-
52
- $ rake -T
53
-
54
- 2. Unit Test
55
-
56
- $ rake spec
57
-
58
- 3. Generates Rdoc Documentation
59
-
60
- $ rake rdoc
61
-
62
-
63
- == Note on Patches/Pull Requests
64
-
65
- - Fork the project.
66
- - Make your feature addition or bug fix.
67
- - Add tests for it. This is important so I don't break it in a
68
- future version unintentionally.
69
- - Commit, do not mess with rakefile, version, or history.
70
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
71
- - Send me a pull request. Bonus points for topic branches.
72
-
73
-
74
- == Copyright
75
-
76
- Copyright (c) 2010 Tomohiro, TAIRA.
77
-
78
-
79
- == Licence
80
-
81
- The MIT License. See LICENSE for details.
data/bin/client DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- MITTEN_ROOT = File.expand_path('..', File.dirname(__FILE__))
4
- Dir.chdir(MITTEN_ROOT)
5
- $: << MITTEN_ROOT
6
-
7
- require 'lib/mitten.rb'
8
-
9
- puts 'Booting Mitten ...'
10
- Mitten::Bot.boot
data/bin/daemon DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'daemons'
5
-
6
- root = File.expand_path(File.dirname(__FILE__))
7
-
8
- Daemons.run("#{root}/client", {:app_name => 'mittend'})
@@ -1,13 +0,0 @@
1
- time:
2
- 0900: '9時をお知らせするよ♪'
3
- 1000: '10時をお知らせするよ♪'
4
- 1100: '11時をお知らせするよ♪'
5
- 1200: '12時をお知らせするよ♪'
6
- 1300: '13時をお知らせするよ♪'
7
- 1400: '14時をお知らせするよ♪'
8
- 1500: '15時をお知らせするよ♪'
9
- 1600: '16時をお知らせするよ♪'
10
- 1700: '17時をお知らせするよ♪'
11
- 1800: '18時をお知らせするよ♪'
12
- 2100: '21時をお知らせするよ♪'
13
- 0000: '深夜0時をお知らせするよ♪'
@@ -1,3 +0,0 @@
1
- bot_list:
2
- '今日は何の日': 'nannohi'
3
- '貯水率教えて': 'i_am_dam'
@@ -1,62 +0,0 @@
1
- require 'amazon/aws/search'
2
-
3
- ENV['AMAZONRCDIR'] = '/usr/local/share/mitten'
4
- ENV['AMAZONRCFILE'] = 'amazonrc'
5
-
6
- #
7
- # It is necessary to create a amazonrc
8
- #
9
- #[global]
10
- # key_id = {AWS Access Key ID}
11
- # secret_key_id = {AWS Secret Access Key}
12
- # associate = {Amazon Associate ID}
13
- # locale = jp
14
- # cache = true
15
- # cache_dir = {Cache Directory}
16
- #
17
-
18
- class AmazonSearch < Mitten::Plugin
19
- def initialize(*args)
20
- super
21
-
22
- @suffix = @config['suffix'] || 'が欲しい'
23
- @limit = @config['limit'] || 3
24
- end
25
-
26
- def on_privmsg(prefix, channel, message)
27
- case message
28
- when /^(.+)#{@suffix}$/
29
- search($1).each { |item| notice(channel, item) }
30
- end
31
- end
32
-
33
- private
34
-
35
- def search(keyword)
36
- datas = []
37
- begin
38
- request = Amazon::AWS::Search::Request.new
39
- query = Amazon::AWS::ItemSearch.new(:All, { :Keywords => keyword })
40
- response = Amazon::AWS::ResponseGroup.new(:Small, :OfferSummary)
41
-
42
- results = request.search(query, response).item_search_response.items.item
43
-
44
- results[0...@limit].each do |item|
45
- title = CGI.unescapeHTML(item.item_attributes.title.to_s)
46
- uri = item.detail_page_url.to_s
47
-
48
- prices = item.offer_summary
49
- price = case
50
- when prices.lowest_new_price : prices.lowest_new_price.formatted_price
51
- when prices.lowest_used_price : "[中古] #{prices.lowest_used_price.formatted_price}"
52
- when prices.lowest_collectible_price : "[コレクター] #{prices.lowest_collectible_price.formatted_price}"
53
- end
54
-
55
- datas << "Amazon : #{title} #{price} だよ♪ (#{URI.short(uri)})"
56
- end
57
- rescue Exception
58
- datas << '/(^o^)\ 見つからにゃいっ'
59
- end
60
- datas
61
- end
62
- end
data/plugins/bmi.rb DELETED
@@ -1,48 +0,0 @@
1
- class BMI < Mitten::Plugin
2
- def initialize(*args)
3
- super
4
-
5
- @prefix = @config['prefix'] || 'BMI'
6
- end
7
-
8
- def on_privmsg(prefix, channel, message)
9
- case message
10
- when /^#{@prefix} ([0-9].+) ([0-9].+)$/
11
- judge = judge($1, $2)
12
- notice(channel, judge) unless judge.empty?
13
- end
14
- end
15
-
16
- private
17
-
18
- def judge(height, weight)
19
- bmi = bmi(height, weight)
20
-
21
- judge = case
22
- when 26.4 <= bmi
23
- '肥満'
24
- when 24.2 <= bmi
25
- '過体重'
26
- when 19.8 <= bmi && bmi < 24.2
27
- '理想体重'
28
- when bmi < 17.6
29
- 'やせすぎ'
30
- when bmi < 19.8
31
- 'やせ気味'
32
- end
33
-
34
- "あなたの BMI は #{bmi} で #{judge} です! 理想体重は #{ideal_body_weight(height)}kg だよっ"
35
- end
36
-
37
- def bmi(height, weight)
38
- height = height.to_f / 100
39
- weight = weight.to_f
40
-
41
- (weight / height / height).to_i
42
- end
43
-
44
- def ideal_body_weight(height)
45
- height = height.to_f / 100
46
- (22 * height * height).to_i
47
- end
48
- end