cinch-cyberscore 0.1.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,24 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
19
+
20
+ # OS X
21
+ .DS_Store
22
+
23
+ # Bundler
24
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cinch-cyberscore.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Ricardo Mendes
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,29 @@
1
+ # Cinch::Cyberscore
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'cinch-cyberscore'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install cinch-cyberscore
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'cinch/plugins/cyberscore/version'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "cinch-cyberscore"
7
+ gem.version = Cinch::Plugins::Cyberscore::VERSION
8
+ gem.authors = ["Ricardo Mendes"]
9
+ gem.email = ["rokusu@gmail.com"]
10
+ gem.description = %q{Cyberscore plugin for Cinch}
11
+ gem.summary = %q{Cyberscore plugin for Cinch}
12
+ gem.homepage = "http://github.com/cyberscore/cinch-cyberscore"
13
+
14
+ gem.files = `git ls-files`.split($/)
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.add_dependency 'cinch'
20
+ gem.add_dependency 'hyperscore', '>= 0.0.12'
21
+
22
+ gem.add_development_dependency 'pry'
23
+ gem.add_development_dependency 'minitest'
24
+ end
@@ -0,0 +1,107 @@
1
+ require 'cinch'
2
+ require 'hyperscore'
3
+
4
+ module Cinch
5
+ module Plugins
6
+
7
+ class Cyberscore
8
+ include Cinch::Plugin
9
+
10
+
11
+ self.prefix = lambda{ |m| Regexp.new("^" + Regexp.escape(m.bot.nick + ": " ))}
12
+
13
+
14
+ def initialize(*args)
15
+ super
16
+ @client = Hyperscore::Client.new
17
+ end
18
+
19
+
20
+ match "help", method: :help
21
+ def help(m)
22
+ m.user.notice %q{Usage:
23
+ JezeBot: command subcommand
24
+ Available commands:
25
+ help
26
+ profile <username>
27
+ dashboard <username>
28
+ news
29
+ news last
30
+ subs
31
+ subs last
32
+ games
33
+ games last}
34
+ end
35
+
36
+ match "news last", method: :news_last
37
+ def news_last(m)
38
+ it = @client.news.first
39
+
40
+ m.reply "#{it.date}: #{it.headline} (#{it.site})"
41
+ end
42
+
43
+ match "news", method: :news
44
+ def news(m)
45
+ @client.news.first(5).each do |it|
46
+ m.user.notice "#{it.date}: #{it.headline} (#{it.site})"
47
+ end
48
+ end
49
+
50
+ match "subs last", method: :subs_last
51
+ def subs_last(m)
52
+ it = @client.submissions.first
53
+
54
+ m.reply "#{it.user_name} got #{it.position} place on '#{it.game_name} - #{it.chart_name}' with #{it.record} (#{it._links['self']['href']})"
55
+ end
56
+
57
+ match "subs", method: :subs
58
+ def subs(m)
59
+ @client.submissions.each do |it|
60
+ m.user.notice "#{it.user_name} | #{it.game_name} - #{it.chart_name} | #{it.position} | #{it.record} | (#{it._links['self']['href']})"
61
+ end
62
+ end
63
+
64
+ match "games last", method: :games_last
65
+ def games_last(m)
66
+ it = @client.games.first
67
+
68
+ m.reply "#{it['id']}. #{it['name']} (#{it._links['self']['href']})"
69
+ end
70
+
71
+ match "games", method: :games
72
+ def games(m)
73
+ @client.games.each do |it|
74
+ m.user.notice "#{it.attributes['id']}. #{it.attributes['name']} (#{it.url})"
75
+ end
76
+ end
77
+
78
+
79
+ match "profile", method: :profile
80
+ match /profile (.+)/i, method: :profile
81
+ def profile(m, target=nil)
82
+ target ||= m.user.nick
83
+
84
+ m.reply "#{m.user.nick}: #{target} @ #{ @client.profile target }"
85
+ end
86
+
87
+ match 'dashboard', method: :dashboard
88
+ match /dashboard (.+)/i, method: :dashboard
89
+ def dashboard(m, target=nil)
90
+ target ||= m.user.nick
91
+
92
+ m.reply "#{m.user.nick}: #{target} @ #{ @client.dashboard target }"
93
+ end
94
+
95
+
96
+ match "records", method: :records
97
+ match /records (.+)/, method: :records
98
+ def records(m, target=nil)
99
+ result = user_exists(m, target || m.user.nick)
100
+
101
+ result and m.reply "#{m.user.nick}: #{result['username']} @ #{ result['_links']['records']['href'] }"
102
+ end
103
+
104
+ end
105
+
106
+ end
107
+ end
@@ -0,0 +1,7 @@
1
+ module Cinch
2
+ module Plugins
3
+ module Cyberscore
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cinch-cyberscore
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ricardo Mendes
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: cinch
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: hyperscore
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.0.12
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.12
46
+ - !ruby/object:Gem::Dependency
47
+ name: pry
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Cyberscore plugin for Cinch
79
+ email:
80
+ - rokusu@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - .gitignore
86
+ - Gemfile
87
+ - LICENSE.txt
88
+ - README.md
89
+ - Rakefile
90
+ - cinch-cyberscore.gemspec
91
+ - lib/cinch/plugins/cyberscore.rb
92
+ - lib/cinch/plugins/cyberscore/version.rb
93
+ homepage: http://github.com/cyberscore/cinch-cyberscore
94
+ licenses: []
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 1.8.24
114
+ signing_key:
115
+ specification_version: 3
116
+ summary: Cyberscore plugin for Cinch
117
+ test_files: []
118
+ has_rdoc: