muzang 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/muzang.rb +0 -1
- data/lib/muzang/version.rb +1 -1
- metadata +5 -6
- data/lib/muzang/helpers.rb +0 -39
data/lib/muzang.rb
CHANGED
data/lib/muzang/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muzang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2011-11-15 00:00:00.000000000Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: em-http-request
|
17
|
-
requirement: &
|
17
|
+
requirement: &69872948653680 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.3.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *69872948653680
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: coffeemaker
|
28
|
-
requirement: &
|
28
|
+
requirement: &69872948652460 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 0.0.1.beta.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *69872948652460
|
37
37
|
description: IRC bot with easy plugin managment
|
38
38
|
email:
|
39
39
|
- piotr.nielacny@gmail.com
|
@@ -51,7 +51,6 @@ files:
|
|
51
51
|
- Rakefile
|
52
52
|
- lib/muzang.rb
|
53
53
|
- lib/muzang/bot.rb
|
54
|
-
- lib/muzang/helpers.rb
|
55
54
|
- lib/muzang/version.rb
|
56
55
|
- muzang.gemspec
|
57
56
|
- spec/muzang_spec.rb
|
data/lib/muzang/helpers.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
module Muzang
|
2
|
-
module Plugin
|
3
|
-
module Helpers
|
4
|
-
DEFAULT_MATCH_OPTIONS = { position: 1 }
|
5
|
-
|
6
|
-
def on_channel?(message)
|
7
|
-
message.channel
|
8
|
-
end
|
9
|
-
|
10
|
-
def match?(message, options = {})
|
11
|
-
options = DEFAULT_MATCH_OPTIONS.merge(options)
|
12
|
-
message.message.match(options[:regexp]) ? message.message.match(options[:regexp])[options[:position]] : false
|
13
|
-
end
|
14
|
-
|
15
|
-
def on_join?(connection, message)
|
16
|
-
message.command == :join && message.nick == connection.nick
|
17
|
-
end
|
18
|
-
|
19
|
-
def create_database(file, container, variable)
|
20
|
-
unless File.exist?(@config = ENV["HOME"] + "/.muzang")
|
21
|
-
FileUtils.mkdir @config
|
22
|
-
end
|
23
|
-
|
24
|
-
unless File.exist? @config + "/#{file}"
|
25
|
-
db = YAML.dump container
|
26
|
-
File.open(@config + "/#{file}", "w"){|f| f.write(db)}
|
27
|
-
end
|
28
|
-
|
29
|
-
send(:"#{variable}=", YAML.load(File.open(@config + "/#{file}", "r").read))
|
30
|
-
|
31
|
-
unless self.respond_to?(:save)
|
32
|
-
self.class.send(:define_method, :save) do
|
33
|
-
File.open(@config + "/#{file}", "w"){|f| f.write YAML.dump(send(variable))}
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|