hwping 0.0.1 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6cbddb5d50553a985d48cda712b992ea667ede9
4
- data.tar.gz: 72840576bfc2f86a92414f573f957ccdb040b4aa
3
+ metadata.gz: 12b5f7585b1225c1e90d2a487c2d5f530c272d64
4
+ data.tar.gz: d205c225b205e58a8b38f9a51b504a4c32d9e9eb
5
5
  SHA512:
6
- metadata.gz: bbd0ea2f0c0f574e2d144601184c3c93c9f2bdd9bff8f85951164418ca2fce61be5a06441225545288d3cb725b9a3468d40d42d1d43f434f9fa60426959e4dce
7
- data.tar.gz: af2ce63c355ff50cee63a95f92f60c786eb15b6e449339d5ab99ba6fdc5937f8e4996a6c46e8bad70b95a076e609a16a67c45a5a857b1733160f2fc7a349476d
6
+ metadata.gz: 6ccd7294ada3df2970c0f203b0968ec47f1e6808dce9d50e8ca60f0eef577d8ea6eef302d4f1e0cd3abaccb78da7d09e8a6ddc896afff95db030d20f42debd95
7
+ data.tar.gz: e1cd1ad3cf79e525d3d6804144d252edf0c6c5f41aaf80961739dd668c9341e05b524df3a72ef061c71cbae4cdac5e34d1b97202b67711171088e7baa371abce
data/lib/hwping/bot.rb CHANGED
@@ -32,36 +32,36 @@ module HWPing
32
32
 
33
33
  # Initialize a bot and return with its Cinch instance
34
34
  def initialize(handler, config = {})
35
- @nick = config.nick
36
- @server = config.server
37
- @port = config.port
38
- @channels = config.channels.map { |m| "\##{m}"}
39
- @handler = handler
40
- return setup_bot()
41
- end
42
-
43
- private
44
- def setup_bot
45
- bot = Cinch::Bot.new do |b|
35
+ @bot = Cinch::Bot.new do |b|
46
36
  configure do |c|
47
- c.nick = @nick
48
- c.server = @server
49
- c.port = @port
50
- c.channels = @channels
37
+ c.nick = config.nick
38
+ c.server = config.server
39
+ c.port = config.port
40
+ c.channels = config.channels.map { |m| "\##{m}"}
51
41
  end
52
42
 
53
43
  # For channel mesages, just reply with the matching message
54
44
  on :channel, /^hwping/ do |e|
55
- r = @handler.channel(e)
45
+ r = handler.channel(e)
56
46
  e.reply(MESSAGES[r])
57
47
  end
58
48
 
59
49
  # For private messages, build a reply message from the format strinc and the passed variables
60
50
  on :private do |e|
61
- (r, *f) = @handler.message(e)
51
+ (r, *f) = handler.private(e)
62
52
  e.reply(MESSAGES[r] % f)
63
53
  end
64
54
  end
65
55
  end
56
+
57
+ # Start the bot
58
+ def start
59
+ @bot.start
60
+ end
61
+
62
+ # Stop the bot
63
+ def stop
64
+ @bot.quit
65
+ end
66
66
  end
67
67
  end
data/lib/hwping/config.rb CHANGED
@@ -9,12 +9,12 @@ module HWPing
9
9
  attr_accessor :targets
10
10
 
11
11
  def initialize(hash = {})
12
- @server = hash.fetch(:server, 'irc.freenode.net')
13
- @port = hash.fetch(:port, 6667)
14
- @nick = hash.fetch(:nick, 'hwping')
15
- @channels = hash.fetch(:channels, ['hwping-test'])
16
- @auth = hash.fetch(:auth , [])
17
- @targets = hash.fetch(:targets, [])
12
+ @server = hash.fetch('server', 'irc.freenode.net')
13
+ @port = hash.fetch('port', 6667)
14
+ @nick = hash.fetch('nick', 'hwping')
15
+ @channels = hash.fetch('channels', ['hwping-test'])
16
+ @auth = hash.fetch('auth' , [])
17
+ @targets = hash.fetch('targets', [])
18
18
  end
19
19
 
20
20
  def to_hash
@@ -1,5 +1,5 @@
1
1
  module HWPing
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1'
3
3
  APP_NAME = 'hwping'
4
4
  REPO_URL = 'http://github.com/skateman/hwping'
5
5
  CONFIG_FILE = 'config.yml'
data/lib/hwping/hwping.rb CHANGED
@@ -15,7 +15,7 @@ module HWPing
15
15
  end
16
16
 
17
17
  def stop
18
- @bot.quit
18
+ @bot.stop
19
19
  end
20
20
 
21
21
  # Return the configuration hash for an export
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hwping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: '0.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dávid Halász
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-28 00:00:00.000000000 Z
11
+ date: 2015-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libusb