cinch-fortune 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in cinch-fortune.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ Cinch-Fortune
2
+ =============
3
+
4
+ Unix style fortunes to users for IRC.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ if you haven't already:
10
+
11
+ $ gem install cinch
12
+
13
+ then install this gem:
14
+
15
+ $ gem install cinch-fortune
16
+
17
+ Example Usage
18
+ -------------
19
+
20
+ require 'cinch'
21
+ require 'cinch/plugins/fortune'
22
+
23
+ Cinch::Plugins::Fortune.configure do |c|
24
+ c.max_length = 100
25
+ end
26
+
27
+ bot = Cinch::Bot.new do
28
+ configure do |c|
29
+ c.server = "irc.freenode.net"
30
+ c.nick = "cinch"
31
+ c.channels = ["#cinch-bots"]
32
+ c.plugins.plugins = [Cinch::Plugins::Fortune]
33
+ end
34
+
35
+ end
36
+
37
+ bot.start
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "cinch/plugins/fortune/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "cinch-fortune"
7
+ s.version = Cinch::Fortune::VERSION
8
+ s.authors = ["Brendon Murphy"]
9
+ s.email = ["xternal1+github@gmail.com"]
10
+ s.homepage = "https://github.com/bemurphy/cinch-fortune"
11
+ s.summary = %q{Unix style fortunes to users for IRC.}
12
+ s.description = s.summary
13
+
14
+ s.rubyforge_project = "cinch-fortune"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "cinch"
22
+ s.add_dependency "fortune_gem"
23
+ end
@@ -0,0 +1,36 @@
1
+ require "cinch"
2
+ require "fortune_gem"
3
+
4
+ module Cinch
5
+ module Plugins
6
+ class Fortune
7
+ include Cinch::Plugin
8
+
9
+ class << self
10
+ attr_accessor :max_length
11
+ def configure; yield self; end
12
+ end
13
+
14
+ match "fortune"
15
+
16
+ def execute(m)
17
+ m.reply [m.user.nick, fortune].join(": ")
18
+ end
19
+
20
+ private
21
+
22
+ def fortune
23
+ max_length = self.class.max_length || 256
24
+ fortune = FortuneGem.give_fortune(:max_length => max_length)
25
+ sanitize_fortune(fortune)
26
+ end
27
+
28
+ def sanitize_fortune(fortune)
29
+ fortune.gsub(/[\n]/, "").
30
+ gsub(/[\t]/, " ").
31
+ gsub("?A:", "? A:")
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Cinch
2
+ module Fortune
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cinch-fortune
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Brendon Murphy
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-10 00:00:00.000000000 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: cinch
17
+ requirement: &2164706160 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *2164706160
26
+ - !ruby/object:Gem::Dependency
27
+ name: fortune_gem
28
+ requirement: &2164705740 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *2164705740
37
+ description: Unix style fortunes to users for IRC.
38
+ email:
39
+ - xternal1+github@gmail.com
40
+ executables: []
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - README.md
47
+ - Rakefile
48
+ - cinch-fortune.gemspec
49
+ - lib/cinch/plugins/fortune.rb
50
+ - lib/cinch/plugins/fortune/version.rb
51
+ has_rdoc: true
52
+ homepage: https://github.com/bemurphy/cinch-fortune
53
+ licenses: []
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project: cinch-fortune
72
+ rubygems_version: 1.6.2
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: Unix style fortunes to users for IRC.
76
+ test_files: []