blur 1.7.1 → 1.7.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/library/blur.rb +1 -1
- data/library/blur/handling.rb +0 -1
- data/library/blur/script/dsl.rb +72 -0
- metadata +33 -41
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b624334737b721f47625f3cc950fd7a8515c477
|
4
|
+
data.tar.gz: fea9f9075bfeb39d3a146f4d2a5e002afe8174c1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b1e9c7131068b6d72f8782fd990aee42fc3e619df31625d4ec94d89d6bf6fde10c70a41bf6d6e76d4d90c677b440a675946a0580f4680d4f632d5af362e154a
|
7
|
+
data.tar.gz: c15c9953ef3f3c2ca23f7062e3a61f75c55487f6d781197ecbf1e674b3c94f6901f59b442106de8832104f54ed81a3cb04ebee3efd70c47f22ec63a782fadda6
|
data/library/blur.rb
CHANGED
@@ -28,7 +28,7 @@ require 'blur/script/messageparsing'
|
|
28
28
|
# It can be by handlers, scripts, communications, and what have you.
|
29
29
|
module Blur
|
30
30
|
# The major and minor version-values of Blur.
|
31
|
-
Version = "1.7.
|
31
|
+
Version = "1.7.2"
|
32
32
|
|
33
33
|
# Instantiates a client with given options and then makes the client instance
|
34
34
|
# evaluate the given block to form a DSL.
|
data/library/blur/handling.rb
CHANGED
@@ -0,0 +1,72 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Blur
|
4
|
+
class Script < Module
|
5
|
+
# The +DSL+ module is a module that gives the ability to turn a
|
6
|
+
# script into a DSL-like framework.
|
7
|
+
#
|
8
|
+
# What it does is automatically test to see if a message starts with a
|
9
|
+
# trigger, and then, if so, it sends the command-part of the message to
|
10
|
+
# the script object itself.
|
11
|
+
#
|
12
|
+
# This way, the plugin-writer doesn't need to have repetetive code like
|
13
|
+
# that in every script.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# Script :example do
|
17
|
+
# include Fantasy
|
18
|
+
#
|
19
|
+
# command :test do |user, channel, message|
|
20
|
+
# channel.say "I hear you."
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# # And if a user were to send the message ".test my method", it would
|
25
|
+
# # trigger the test block with the following arguments
|
26
|
+
# #
|
27
|
+
# # user => #<Blur::Network::User … >
|
28
|
+
# # channel => #<Blur::Network::Channel … >
|
29
|
+
# # message => ".test my method"
|
30
|
+
module DSL
|
31
|
+
# The prefix that turns it into a possible command.
|
32
|
+
MessageTrigger = "."
|
33
|
+
|
34
|
+
# Extend +klass+ with self.
|
35
|
+
def self.included klass
|
36
|
+
klass.extend self
|
37
|
+
end
|
38
|
+
|
39
|
+
# Called when a script has been loaded, for use in modules extending
|
40
|
+
# the script.
|
41
|
+
def module_init
|
42
|
+
@__dsl_triggers = {}
|
43
|
+
end
|
44
|
+
|
45
|
+
def command name, *args, &block
|
46
|
+
(@__dsl_triggers ||= {})[name] = block
|
47
|
+
end
|
48
|
+
|
49
|
+
# Handle all calls to the scripts +message+ method, check to see if
|
50
|
+
# the message containts a valid command, serialize it and pass it to
|
51
|
+
# the script as command_name with the parameters +user+, +channel+
|
52
|
+
# and +message+.
|
53
|
+
def message user, channel, line
|
54
|
+
return unless line.start_with? MessageTrigger
|
55
|
+
|
56
|
+
command, args = line.split $;, 2
|
57
|
+
trigger = strip command
|
58
|
+
|
59
|
+
if handler = @__dsl_triggers[trigger]
|
60
|
+
handler.(user, channel, args)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
|
66
|
+
# Strip all non-word characters from the input command.
|
67
|
+
def strip name
|
68
|
+
name.gsub /\W/, '' if name
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
metadata
CHANGED
@@ -1,97 +1,89 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.1
|
5
|
-
prerelease:
|
4
|
+
version: 1.7.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mikkel Kroman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-06-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: majic
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0.2'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: crypt19
|
27
|
-
requirement: &22641420 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
23
|
requirements:
|
30
|
-
- -
|
24
|
+
- - '>='
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *22641420
|
26
|
+
version: '0.2'
|
36
27
|
- !ruby/object:Gem::Dependency
|
37
28
|
name: eventmachine
|
38
|
-
requirement:
|
39
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
40
30
|
requirements:
|
41
|
-
- -
|
31
|
+
- - '>'
|
42
32
|
- !ruby/object:Gem::Version
|
43
33
|
version: '0.12'
|
44
34
|
type: :runtime
|
45
35
|
prerelease: false
|
46
|
-
version_requirements:
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
'
|
51
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>'
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.12'
|
41
|
+
description:
|
42
|
+
email: mk@uplink.io
|
52
43
|
executables: []
|
53
44
|
extensions: []
|
54
45
|
extra_rdoc_files: []
|
55
46
|
files:
|
56
47
|
- library/blur/client.rb
|
57
|
-
- library/blur/network.rb
|
58
|
-
- library/blur/encryption/fish.rb
|
59
48
|
- library/blur/encryption/base64.rb
|
49
|
+
- library/blur/encryption/fish.rb
|
60
50
|
- library/blur/encryption.rb
|
61
|
-
- library/blur/
|
62
|
-
- library/blur/
|
63
|
-
- library/blur/script/messageparsing.rb
|
51
|
+
- library/blur/enhancements.rb
|
52
|
+
- library/blur/handling.rb
|
64
53
|
- library/blur/network/channel.rb
|
65
54
|
- library/blur/network/command.rb
|
66
|
-
- library/blur/network/user.rb
|
67
55
|
- library/blur/network/connection.rb
|
56
|
+
- library/blur/network/user.rb
|
57
|
+
- library/blur/network.rb
|
58
|
+
- library/blur/script/cache.rb
|
59
|
+
- library/blur/script/dsl.rb
|
60
|
+
- library/blur/script/fantasy.rb
|
61
|
+
- library/blur/script/messageparsing.rb
|
68
62
|
- library/blur/script.rb
|
69
|
-
- library/blur/enhancements.rb
|
70
|
-
- library/blur/handling.rb
|
71
63
|
- library/blur.rb
|
72
64
|
homepage: https://github.com/mkroman/blur
|
73
65
|
licenses:
|
74
|
-
- ISC
|
66
|
+
- Internet Systems Consortium (ISC)
|
67
|
+
metadata: {}
|
75
68
|
post_install_message:
|
76
69
|
rdoc_options: []
|
77
70
|
require_paths:
|
78
71
|
- library
|
79
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
73
|
requirements:
|
82
|
-
- -
|
74
|
+
- - '>='
|
83
75
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
76
|
+
version: 1.9.1
|
85
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
78
|
requirements:
|
88
|
-
- -
|
79
|
+
- - '>='
|
89
80
|
- !ruby/object:Gem::Version
|
90
81
|
version: '0'
|
91
82
|
requirements: []
|
92
83
|
rubyforge_project:
|
93
|
-
rubygems_version:
|
84
|
+
rubygems_version: 2.0.0
|
94
85
|
signing_key:
|
95
|
-
specification_version:
|
86
|
+
specification_version: 4
|
96
87
|
summary: An event-driven IRC-framework for Ruby.
|
97
88
|
test_files: []
|
89
|
+
has_rdoc:
|