cinch-quotes 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/cinch-quotes.gemspec +1 -1
- data/lib/cinch/plugins/quotes.rb +8 -4
- metadata +10 -5
data/cinch-quotes.gemspec
CHANGED
data/lib/cinch/plugins/quotes.rb
CHANGED
@@ -6,12 +6,16 @@ module Cinch
|
|
6
6
|
class Quotes
|
7
7
|
include Cinch::Plugin
|
8
8
|
|
9
|
-
QUOTES_FILE = "data/quotes.yml"
|
10
|
-
|
11
9
|
match /addquote (.+)/i, method: :addquote
|
12
10
|
match /quote (.+)/i, method: :quote
|
13
11
|
match "quote", method: :quote
|
14
12
|
|
13
|
+
def initialize
|
14
|
+
super
|
15
|
+
|
16
|
+
@quotes_file = config[:quotes_file]
|
17
|
+
end
|
18
|
+
|
15
19
|
def addquote(m, quote)
|
16
20
|
# make the quote
|
17
21
|
new_quote = { "quote" => quote, "added_by" => m.user.nick, "created_at" => Time.now, "deleted" => false }
|
@@ -25,7 +29,7 @@ module Cinch
|
|
25
29
|
existing_quotes[new_quote_index]["id"] = new_quote_index + 1
|
26
30
|
|
27
31
|
# write it to the file
|
28
|
-
output = File.new(
|
32
|
+
output = File.new(@quotes_file, 'w')
|
29
33
|
output.puts YAML.dump(existing_quotes)
|
30
34
|
output.close
|
31
35
|
|
@@ -64,7 +68,7 @@ module Cinch
|
|
64
68
|
protected
|
65
69
|
|
66
70
|
def get_quotes
|
67
|
-
output = File.new(
|
71
|
+
output = File.new(@quotes_file, 'r')
|
68
72
|
quotes = YAML.load(output.read)
|
69
73
|
output.close
|
70
74
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch-quotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cinch
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: '2.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
25
30
|
description: Gives Cinch IRC bots ability to manage quotes
|
26
31
|
email:
|
27
32
|
- caitlin@caitlinwoodward.me
|
@@ -52,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
57
|
version: '0'
|
53
58
|
requirements: []
|
54
59
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.8.
|
60
|
+
rubygems_version: 1.8.24
|
56
61
|
signing_key:
|
57
62
|
specification_version: 3
|
58
63
|
summary: Gives Cinch IRC bots ability to manage quotes
|