cogbot 0.1.4 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d1a138004dfa342f389a176058fb5c98bdb3e5f
4
- data.tar.gz: 8ec4aea178e649f086b80bd9ef4ea09055798544
3
+ metadata.gz: 1f16b0b37bbea72ce7979e650e772a922d46dfd5
4
+ data.tar.gz: ab58a7fdc12c091258d4ea37693f19bab9f4e2e3
5
5
  SHA512:
6
- metadata.gz: fe86d05ee5153329893589d5cfe153ea29c7692f54abbcb2ae45279165cab8cb8b0dd6abd94c7c84646f3a9f7d07c1f320f90393294f52d86a6a7d068557cfc6
7
- data.tar.gz: 1c625d6f58ec222786c9394541da53c43f9c5d93052fb24f1dabe78e162cc3bb0c0dbd03ed40876bebde3c0bd5728f891e50876ba65cbb1562f20732a09614b1
6
+ metadata.gz: 9d5c5367f126d993dc6e275b1344f5ebd20107442b9d1256cdf7cce1e6efa1794778ce7ea47508b27b079347176c7cebbf0fe28a152c2a7e99545130bfd83a7c
7
+ data.tar.gz: 2dd93319994aa4eafa7e632487b09d3605435c0bd322a127cd306d80c99b29ee1830146ce5f89add35464371ef6216c09620e8e8fd0b8c4bd782638adce563b6
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.3
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Cogbot Changelog
2
2
  ===================
3
3
 
4
+ ### v0.1.5 - 2016-03-21
5
+ - add config support for SASL auth
6
+ - add a rss plugin
7
+ - enabled multi-cogbot instantiation using the CONFIG_DIR env variable
8
+
4
9
  ### v0.1.4 - 2015-11-23
5
10
  - removed a debug require from twitter plugin
6
11
 
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cogbot (0.1.4)
4
+ cogbot (0.1.5)
5
5
  cinch (= 2.3.1)
6
6
  daemons (~> 1.2.3)
7
- eventmachine (= 1.0.8)
7
+ eventmachine (= 1.0.9.1)
8
8
  eventmachine_httpserver (~> 0.2.1)
9
9
  fortune_gem (~> 0.0.8)
10
10
  json (~> 1.8.3)
11
- nokogiri (~> 1.6.6.4)
11
+ nokogiri (~> 1.6.7.1)
12
12
  thor (~> 0.19.1)
13
13
  twitter (~> 5.15.0)
14
14
  yajl-ruby (~> 1.2.1)
@@ -16,17 +16,17 @@ PATH
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- addressable (2.3.8)
19
+ addressable (2.4.0)
20
20
  awesome_print (1.6.1)
21
21
  buftok (0.2.0)
22
22
  cinch (2.3.1)
23
- coderay (1.1.0)
23
+ coderay (1.1.1)
24
24
  daemons (1.2.3)
25
25
  docile (1.1.5)
26
- domain_name (0.5.25)
26
+ domain_name (0.5.20160309)
27
27
  unf (>= 0.0.5, < 1.0.0)
28
28
  equalizer (0.0.10)
29
- eventmachine (1.0.8)
29
+ eventmachine (1.0.9.1)
30
30
  eventmachine_httpserver (0.2.1)
31
31
  faraday (0.9.2)
32
32
  multipart-post (>= 1.2, < 3)
@@ -47,24 +47,24 @@ GEM
47
47
  memoizable (0.4.2)
48
48
  thread_safe (~> 0.3, >= 0.3.1)
49
49
  method_source (0.8.2)
50
- mini_portile (0.6.2)
51
- minitest (5.8.2)
50
+ mini_portile2 (2.0.0)
51
+ minitest (5.8.4)
52
52
  minitest-ci (3.0.3)
53
53
  minitest (~> 5.0, >= 5.0.6)
54
54
  multipart-post (2.0.0)
55
55
  naught (1.1.0)
56
- nokogiri (1.6.6.4)
57
- mini_portile (~> 0.6.0)
56
+ nokogiri (1.6.7.2)
57
+ mini_portile2 (~> 2.0.0.rc2)
58
58
  pry (0.10.3)
59
59
  coderay (~> 1.1.0)
60
60
  method_source (~> 0.8.1)
61
61
  slop (~> 3.4)
62
- rake (10.4.2)
63
- ruby_parser (3.7.2)
62
+ rake (11.1.0)
63
+ ruby_parser (3.8.1)
64
64
  sexp_processor (~> 4.1)
65
- sexp_processor (4.6.0)
65
+ sexp_processor (4.7.0)
66
66
  simple_oauth (0.3.1)
67
- simplecov (0.10.0)
67
+ simplecov (0.11.2)
68
68
  docile (~> 1.1.0)
69
69
  json (~> 1.8)
70
70
  simplecov-html (~> 0.10.0)
@@ -87,7 +87,7 @@ GEM
87
87
  simple_oauth (~> 0.3.0)
88
88
  unf (0.1.4)
89
89
  unf_ext
90
- unf_ext (0.0.7.1)
90
+ unf_ext (0.0.7.2)
91
91
  yajl-ruby (1.2.1)
92
92
 
93
93
  PLATFORMS
data/README.md CHANGED
@@ -18,6 +18,7 @@ team that uses irc as a main shared communication space:
18
18
  * the urban dictionary to make us laugh
19
19
  * a twitter search plugin
20
20
  * a trello webhooks listener
21
+ * a RSS announce poller
21
22
  * and some other more or less used features
22
23
 
23
24
 
@@ -34,6 +35,15 @@ At first launch:
34
35
  you will be prompted to create a configuration file in ~/.cogbot/cogbot.yml
35
36
  When this is done you can launch again and it will just run according to your configuration.
36
37
 
38
+ To stop the robot, just use
39
+
40
+ cogbot stop
41
+
42
+ You can specify an alternative config directory using the COGBOT_DIR environment variable:
43
+
44
+ COGBOT_DIR=~/.cogbot-alt cogbot start
45
+ COGBOT_DIR=~/.cogbot-alt cogbot stop
46
+
37
47
  ## Configuration
38
48
 
39
49
  Some plugins require extra config parameters:
data/bin/cogbot CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ROOT_DIR = File.expand_path('../..', __FILE__)
4
4
  $LOAD_PATH.unshift(ROOT_DIR)
5
- CONFIG_DIR = File.join(File.expand_path('~'),'.cogbot')
5
+ CONFIG_DIR = ENV['CONFIG_DIR'] || File.join(File.expand_path('~'),'.cogbot')
6
6
  CONFIG_FILE = File.join(CONFIG_DIR,'cogbot.yml')
7
7
  LOG_DIR = File.join(CONFIG_DIR,'logs')
8
8
 
data/cogbot.gemspec CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.add_dependency 'cinch', '2.3.1'
20
20
  gem.add_dependency "thor", '~> 0.19.1'
21
- gem.add_dependency "eventmachine", '1.0.8'
21
+ gem.add_dependency "eventmachine", '1.0.9.1'
22
22
  gem.add_dependency "eventmachine_httpserver", '~> 0.2.1'
23
- gem.add_dependency 'nokogiri', '~> 1.6.6.4'
23
+ gem.add_dependency 'nokogiri', '~> 1.6.7.1'
24
24
  gem.add_dependency "daemons", '~> 1.2.3'
25
25
 
26
26
  gem.add_dependency 'twitter', '~> 5.15.0' # twitter plugin
@@ -35,3 +35,8 @@ trello:
35
35
  -
36
36
  channel: "#trello-dev"
37
37
  board: "Dev"
38
+ rss:
39
+ polling: 5
40
+ announce:
41
+ - "#cogbot-rss"
42
+ channel: http://example.com/feed/
@@ -1,4 +1,4 @@
1
1
  # just the cogbot version
2
2
  module Cogbot
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
data/lib/cogbot.rb CHANGED
@@ -35,7 +35,7 @@ module Cogbot
35
35
  :dir_mode => :normal,
36
36
  :log_dir => LOG_DIR,
37
37
  :log_output => true,
38
- :dir => File.join('/', 'tmp')
38
+ :dir => CONFIG_DIR
39
39
  )
40
40
 
41
41
  # checkout plugins
@@ -59,6 +59,8 @@ module Cogbot
59
59
  c.user = config['main']['nick']
60
60
  c.realname = config['main']['nick']
61
61
  c.channels = config['main']['channels']
62
+ c.sasl.username = config['main']['sasl_user']
63
+ c.sasl.password = config['main']['sasl_pass']
62
64
  c.options = { 'cogconf' => config }
63
65
  c.plugins.prefix = config['main']['prefix']
64
66
  c.plugins.plugins = plugins
@@ -91,7 +93,7 @@ module Cogbot
91
93
  desc "stop", "stop cogbot"
92
94
  # manages the stop cli command
93
95
  def stop
94
- pid_file = File.join('/', 'tmp', 'cogbot.pid')
96
+ pid_file = File.join(CONFIG_DIR, 'cogbot.pid')
95
97
  pid = File.read(pid_file).to_i if File.exist?(pid_file)
96
98
  Process.kill('TERM', pid)
97
99
  end
data/plugins/rss.rb ADDED
@@ -0,0 +1,48 @@
1
+ require 'open-uri'
2
+ require 'rss'
3
+
4
+ module Cinch
5
+ module Plugins
6
+ class Rss
7
+ include Cinch::Plugin
8
+
9
+ set :plugin_name, 'rss'
10
+ set :help, <<EOT
11
+ The RSS plugin will poll rss feed every 5 minutes
12
+ EOT
13
+
14
+ timer 300, method: :fetch_rss
15
+
16
+ def new(bot)
17
+ @bot = bot
18
+ @feeds = []
19
+ end
20
+
21
+ def fetch_rss
22
+ @feeds ||= []
23
+ open(@bot.config.options['cogconf']['rss']['channel']) do |rss|
24
+ feed = RSS::Parser.parse(rss)
25
+ p @feeds.length
26
+ p feed.items.length
27
+ feed.items.reverse.each do |item|
28
+ p item.link
29
+ unless @feeds.include? item.link
30
+ @feeds << item.link
31
+ p @feeds.length
32
+ # to prevent the first run displays all the items
33
+ if @feeds.length > feed.items.length
34
+ @bot.config.options['cogconf']['rss']['announce'].each do |announce|
35
+ Channel(announce).send "#{item.title} (#{item.link})"
36
+ end
37
+ end
38
+ end
39
+ end
40
+ if @feeds.length > feed.items.length
41
+ @feeds = @feeds[-feed.items.length, feed.items.length]
42
+ end
43
+ end
44
+ end
45
+
46
+ end
47
+ end
48
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cogbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - mose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-23 00:00:00.000000000 Z
11
+ date: 2016-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cinch
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.8
47
+ version: 1.0.9.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.8
54
+ version: 1.0.9.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: eventmachine_httpserver
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.6.6.4
75
+ version: 1.6.7.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.6.6.4
82
+ version: 1.6.7.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: daemons
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -293,6 +293,7 @@ files:
293
293
  - plugins/google.rb
294
294
  - plugins/manager.rb
295
295
  - plugins/redmine.rb
296
+ - plugins/rss.rb
296
297
  - plugins/rubygems.rb
297
298
  - plugins/shorturl.rb
298
299
  - plugins/stackoverflow.rb