cinch-reddit 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +13 -12
- data/cinch-reddit.gemspec +3 -3
- data/lib/cinch/plugins/reddit.rb +10 -4
- metadata +7 -7
data/.gitignore
CHANGED
@@ -1,18 +1,19 @@
|
|
1
|
+
tmp
|
2
|
+
spec/reports
|
3
|
+
test/tmp
|
4
|
+
*.DS_STORE
|
1
5
|
*.gem
|
6
|
+
InstalledFiles
|
2
7
|
*.rbc
|
3
|
-
.bundle
|
4
8
|
.config
|
9
|
+
rdoc
|
10
|
+
test/version_tmp
|
11
|
+
lib/bundler/man
|
12
|
+
.bundle
|
13
|
+
doc/
|
14
|
+
coverage
|
5
15
|
.yardoc
|
16
|
+
lib/cinch/plugins/test.rb
|
6
17
|
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
18
|
_yardoc
|
9
|
-
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.DS_STORE
|
19
|
+
pkg
|
data/cinch-reddit.gemspec
CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |gem|
|
|
14
14
|
%w{cinch json actionpack}.each { |x| gem.add_dependency x }
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($\)
|
17
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
# gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
# gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.name = "cinch-reddit"
|
20
20
|
gem.require_paths = ["lib"]
|
21
|
-
gem.version = "1.1.
|
21
|
+
gem.version = "1.1.2"
|
22
22
|
end
|
data/lib/cinch/plugins/reddit.rb
CHANGED
@@ -46,6 +46,12 @@ module Cinch
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# Utility to join an array into a gramarically correct sentence.
|
50
|
+
def pluralJoin(array)
|
51
|
+
return array[0] unless array.length > 1
|
52
|
+
array[0..-2].join(", ") + ", and " + array[-1]
|
53
|
+
end
|
54
|
+
|
49
55
|
# Plugin code
|
50
56
|
|
51
57
|
# Karma Lookup
|
@@ -68,9 +74,9 @@ module Cinch
|
|
68
74
|
if data
|
69
75
|
subMods = []
|
70
76
|
data.each { |mod| subMods << mod["name"] }
|
71
|
-
m.reply("
|
77
|
+
m.reply("/r/%s has %s: %s" % [Format(:bold, subreddit), pluralize( subMods.length, "moderator"), pluralJoin(subMods) ])
|
72
78
|
else
|
73
|
-
m.reply("
|
79
|
+
m.reply("/r/%s doesn't appear to exist and therefore can't have moderators" % subreddit)
|
74
80
|
end
|
75
81
|
end
|
76
82
|
|
@@ -80,9 +86,9 @@ module Cinch
|
|
80
86
|
url = "%s/r/%s/about.json" % [RedditBaseUrl, subreddit]
|
81
87
|
data = JSON.parse(urlload url)["data"]["subscribers"] rescue nil
|
82
88
|
if data
|
83
|
-
m.reply("
|
89
|
+
m.reply("/r/%s has %s" % [Format(:bold, subreddit), pluralize(data, "reader")])
|
84
90
|
else
|
85
|
-
m.reply("
|
91
|
+
m.reply("/r/%s doesn't appear to exist and therefore can't have subscribers" % subreddit)
|
86
92
|
end
|
87
93
|
end
|
88
94
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch-reddit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cinch
|
16
|
-
requirement: &
|
16
|
+
requirement: &70133818245280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70133818245280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70133818244820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70133818244820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: actionpack
|
38
|
-
requirement: &
|
38
|
+
requirement: &70133818244340 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70133818244340
|
47
47
|
description: ! " This is a simple reddit plugin for the excellent cinch irc bot
|
48
48
|
framework.\n It provides a few simple commands, !karma, !mods, and !readers.\n
|
49
49
|
\ See the github page for more details\n"
|