dog-bot 0.1.5 → 0.1.6

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODI3OTg0OTM5N2Y4ZGI4ZGVlZWE4ODNkOTI2MjA2Y2JlNzg3M2M2Yg==
5
+ data.tar.gz: !binary |-
6
+ NmJjNjcxN2QzNGEzZGM0MTk5NGFkODEyM2RlMjA4YzJiMTA2MGIxYg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZTgyZDJjMTQyMDdkZDBjZDNkODVmYjk5M2ZjYTQ1MjI0ZmEwOWQzM2Q3ZTZk
10
+ MzJlNTRiZWMxMDcwZjJiNTY5YTMyNzFjM2IzYjg4NTY2NTNhZDhmZTIwNWZl
11
+ NjcxZjJjZDA5NzU3YTY0MGVhYzJjZTE2MmNiYjNlZmY4ZDllN2U=
12
+ data.tar.gz: !binary |-
13
+ NDNhMzI2MzllZTM4MTg5M2QwNjdmZTJiNGE1ZjI1MGQ5OGFhZTQ4ZTY1YTJj
14
+ YjIyYWFlNzU1YTYyOGFmNjJlMTkwMGIyNDczMTM4MmM5NmVhY2E2YjhkZTky
15
+ MWYyYjdmZmZlNGY2ZGU0YTI1Yzg2MmI1ZDA1OTU2MDhhYWVhMTU=
@@ -0,0 +1,8 @@
1
+ command "dog" do
2
+ matches "dog"
3
+
4
+ subcommand "show available commands" do
5
+ matches "dog help", "man dog"
6
+ action { :help }
7
+ end
8
+ end
@@ -12,7 +12,7 @@
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "dog-bot"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "0.1.5"
15
+ gem.version = "0.1.6"
16
16
 
17
17
  gem.add_dependency "blather", "~> 0.8.0"
18
18
  gem.add_dependency "google_image_api", "~> 0.0.1"
@@ -48,6 +48,8 @@ module Dog
48
48
  room_name = message.split.last
49
49
  join room_name
50
50
  "joined #{room_name}"
51
+ when :help then
52
+ help
51
53
  when :reload then
52
54
  config
53
55
  "config reloaded"
@@ -89,6 +91,10 @@ module Dog
89
91
  join(*config.chat_rooms)
90
92
  end
91
93
 
94
+ def help
95
+ self.commands.map(&:help).inject(:+)
96
+ end
97
+
92
98
  def _from_self(message)
93
99
  @rooms.each do |room|
94
100
  return true if "#{room}@conference.#{@connection.jid.domain}/#{@connection.jid.node}" == message.from
@@ -48,5 +48,16 @@ module Dog
48
48
  response || @action.call(input_string)
49
49
  end
50
50
  end
51
+
52
+ def help(parent_matcher_string = nil)
53
+ matchers = @matchers.uniq
54
+
55
+ matcher_string = (matchers.count == 1 ? matchers.first.to_s : "{#{matchers.join(',')}}")
56
+ matcher_string = "#{parent_matcher_string} & #{matcher_string}" if parent_matcher_string
57
+
58
+ output = "#{@title}: #{matcher_string}\n"
59
+ output += @subcommands.map { |c| c.help(matcher_string) }.inject(:+) unless @subcommands.empty?
60
+ output
61
+ end
51
62
  end
52
63
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dog-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
5
- prerelease:
4
+ version: 0.1.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ben Mills
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-08 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: blather
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: google_image_api
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -79,6 +72,7 @@ files:
79
72
  - config_examples/default_rooms.rb
80
73
  - config_examples/dog.rb
81
74
  - config_examples/google_image.rb
75
+ - config_examples/help.rb
82
76
  - config_examples/jenkins.rb
83
77
  - config_examples/ruby_gems.rb
84
78
  - config_examples/tasks.rb
@@ -99,27 +93,26 @@ files:
99
93
  - spec/dog/test_connection_spec.rb
100
94
  homepage: https://github.com/benmills/dog
101
95
  licenses: []
96
+ metadata: {}
102
97
  post_install_message:
103
98
  rdoc_options: []
104
99
  require_paths:
105
100
  - lib
106
101
  required_ruby_version: !ruby/object:Gem::Requirement
107
- none: false
108
102
  requirements:
109
103
  - - ! '>='
110
104
  - !ruby/object:Gem::Version
111
105
  version: '0'
112
106
  required_rubygems_version: !ruby/object:Gem::Requirement
113
- none: false
114
107
  requirements:
115
108
  - - ! '>='
116
109
  - !ruby/object:Gem::Version
117
110
  version: '0'
118
111
  requirements: []
119
112
  rubyforge_project:
120
- rubygems_version: 1.8.23
113
+ rubygems_version: 2.0.8
121
114
  signing_key:
122
- specification_version: 3
115
+ specification_version: 4
123
116
  summary: Extensible XMPP chatbot
124
117
  test_files:
125
118
  - spec/dog/bot_spec.rb