slack-ruby-bot-server-rtm 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +15 -0
  5. data/.rubocop_todo.yml +29 -0
  6. data/.travis.yml +21 -0
  7. data/CHANGELOG.md +5 -0
  8. data/CONTRIBUTING.md +125 -0
  9. data/Dangerfile +3 -0
  10. data/Gemfile +40 -0
  11. data/LICENSE +21 -0
  12. data/README.md +61 -0
  13. data/RELEASING.md +61 -0
  14. data/Rakefile +16 -0
  15. data/lib/slack-ruby-bot-server-rtm.rb +10 -0
  16. data/lib/slack-ruby-bot-server-rtm/config.rb +29 -0
  17. data/lib/slack-ruby-bot-server-rtm/ext.rb +3 -0
  18. data/lib/slack-ruby-bot-server-rtm/ext/slack-ruby-bot.rb +4 -0
  19. data/lib/slack-ruby-bot-server-rtm/ext/slack-ruby-bot/client.rb +14 -0
  20. data/lib/slack-ruby-bot-server-rtm/ext/slack-ruby-bot/commands/base.rb +20 -0
  21. data/lib/slack-ruby-bot-server-rtm/lifecycle.rb +31 -0
  22. data/lib/slack-ruby-bot-server-rtm/rspec.rb +5 -0
  23. data/lib/slack-ruby-bot-server-rtm/server.rb +52 -0
  24. data/lib/slack-ruby-bot-server-rtm/version.rb +7 -0
  25. data/sample_apps/sample_app_activerecord/.rspec +3 -0
  26. data/sample_apps/sample_app_activerecord/.standalone_migrations +3 -0
  27. data/sample_apps/sample_app_activerecord/Gemfile +26 -0
  28. data/sample_apps/sample_app_activerecord/Procfile +1 -0
  29. data/sample_apps/sample_app_activerecord/README.md +12 -0
  30. data/sample_apps/sample_app_activerecord/Rakefile +16 -0
  31. data/sample_apps/sample_app_activerecord/commands.rb +4 -0
  32. data/sample_apps/sample_app_activerecord/commands/help.rb +21 -0
  33. data/sample_apps/sample_app_activerecord/commands/whoami.rb +8 -0
  34. data/sample_apps/sample_app_activerecord/config.ru +24 -0
  35. data/sample_apps/sample_app_activerecord/config/newrelic.yml +217 -0
  36. data/sample_apps/sample_app_activerecord/config/postgresql.yml +17 -0
  37. data/sample_apps/sample_app_activerecord/db/migrate/20170307164946_create_teams_table.rb +14 -0
  38. data/sample_apps/sample_app_activerecord/db/migrate/20190323181453_add_activated_fields.rb +9 -0
  39. data/sample_apps/sample_app_activerecord/db/schema.rb +31 -0
  40. data/sample_apps/sample_app_activerecord/spec/api/root_spec.rb +18 -0
  41. data/sample_apps/sample_app_activerecord/spec/commands/help_spec.rb +16 -0
  42. data/sample_apps/sample_app_activerecord/spec/commands/whoami_spec.rb +16 -0
  43. data/sample_apps/sample_app_activerecord/spec/spec_helper.rb +21 -0
  44. data/sample_apps/sample_app_mongoid/.rspec +3 -0
  45. data/sample_apps/sample_app_mongoid/Gemfile +22 -0
  46. data/sample_apps/sample_app_mongoid/Procfile +1 -0
  47. data/sample_apps/sample_app_mongoid/README.md +14 -0
  48. data/sample_apps/sample_app_mongoid/Rakefile +12 -0
  49. data/sample_apps/sample_app_mongoid/commands.rb +4 -0
  50. data/sample_apps/sample_app_mongoid/commands/help.rb +21 -0
  51. data/sample_apps/sample_app_mongoid/commands/whoami.rb +8 -0
  52. data/sample_apps/sample_app_mongoid/config.ru +16 -0
  53. data/sample_apps/sample_app_mongoid/config/mongoid.yml +27 -0
  54. data/sample_apps/sample_app_mongoid/config/newrelic.yml +217 -0
  55. data/sample_apps/sample_app_mongoid/spec/api/root_spec.rb +18 -0
  56. data/sample_apps/sample_app_mongoid/spec/commands/help_spec.rb +16 -0
  57. data/sample_apps/sample_app_mongoid/spec/commands/whoami_spec.rb +16 -0
  58. data/sample_apps/sample_app_mongoid/spec/spec_helper.rb +29 -0
  59. data/slack-ruby-bot-server-rtm.gemspec +22 -0
  60. metadata +142 -0
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ def app
6
+ SlackRubyBotServer::Api::Middleware.instance
7
+ end
8
+
9
+ describe 'API' do
10
+ include Rack::Test::Methods
11
+
12
+ it 'root' do
13
+ get '/api'
14
+ expect(last_response.status).to eq 200
15
+ links = JSON.parse(last_response.body)['_links']
16
+ expect(links.keys.sort).to eq(%w[self status team teams].sort)
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'commands/help'
5
+
6
+ describe Help do
7
+ let!(:team) { Fabricate(:team) }
8
+ let(:app) { SlackRubyBotServer::RealTime::Server.new(team: team) }
9
+ let(:client) { app.send(:client) }
10
+ let(:message_hook) { SlackRubyBot::Hooks::Message.new }
11
+ it 'default' do
12
+ expect(client).to receive(:say).with(channel: 'channel', text: [Help::HELP, SlackRubyBotServer::INFO].join("\n"))
13
+ expect(client).to receive(:say).with(channel: 'channel')
14
+ message_hook.call(client, Hashie::Mash.new(channel: 'channel', text: "#{SlackRubyBot.config.user} help"))
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'commands/whoami'
5
+
6
+ describe Whoami do
7
+ let(:team) { Fabricate(:team) }
8
+ let(:app) { SlackRubyBotServer::Server.new(team: team) }
9
+ context 'whoami' do
10
+ it 'returns username' do
11
+ expect(message: "#{SlackRubyBot.config.user} whoami", channel: 'channel', user: 'user').to respond_with_slack_message(
12
+ '<@user>'
13
+ )
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('..', __dir__)
4
+
5
+ ENV['RACK_ENV'] = 'test'
6
+
7
+ require 'mongoid'
8
+ require 'database_cleaner'
9
+ require 'slack-ruby-bot-server-rtm/rspec'
10
+
11
+ Mongoid.load!(File.expand_path('../config/mongoid.yml', __dir__), ENV['RACK_ENV'])
12
+
13
+ RSpec.configure do |config|
14
+ config.before :suite do
15
+ Mongo::Logger.logger.level = Logger::INFO
16
+
17
+ Mongoid::Tasks::Database.create_indexes
18
+ end
19
+
20
+ config.after :suite do
21
+ Mongoid.purge!
22
+ end
23
+
24
+ config.around :each do |example|
25
+ DatabaseCleaner.cleaning do
26
+ example.run
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'slack-ruby-bot-server-rtm/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'slack-ruby-bot-server-rtm'
9
+ spec.version = SlackRubyBotServer::RealTime::VERSION
10
+ spec.authors = ['Daniel Doubrovkine']
11
+ spec.email = ['dblock@dblock.org']
12
+
13
+ spec.summary = 'Slack RTM bot extension for slack-ruby-bot-server.'
14
+ spec.homepage = 'https://github.com/slack-ruby/slack-ruby-bot-server-rtm'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_dependency 'async-websocket', '~> 0.8.0'
20
+ spec.add_dependency 'slack-ruby-bot', '>= 0.12.0'
21
+ spec.add_dependency 'slack-ruby-bot-server', '>= 1.0.0'
22
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: slack-ruby-bot-server-rtm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Doubrovkine
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-11-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: async-websocket
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: slack-ruby-bot
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.12.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.12.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: slack-ruby-bot-server
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ description:
56
+ email:
57
+ - dblock@dblock.org
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".rubocop.yml"
65
+ - ".rubocop_todo.yml"
66
+ - ".travis.yml"
67
+ - CHANGELOG.md
68
+ - CONTRIBUTING.md
69
+ - Dangerfile
70
+ - Gemfile
71
+ - LICENSE
72
+ - README.md
73
+ - RELEASING.md
74
+ - Rakefile
75
+ - lib/slack-ruby-bot-server-rtm.rb
76
+ - lib/slack-ruby-bot-server-rtm/config.rb
77
+ - lib/slack-ruby-bot-server-rtm/ext.rb
78
+ - lib/slack-ruby-bot-server-rtm/ext/slack-ruby-bot.rb
79
+ - lib/slack-ruby-bot-server-rtm/ext/slack-ruby-bot/client.rb
80
+ - lib/slack-ruby-bot-server-rtm/ext/slack-ruby-bot/commands/base.rb
81
+ - lib/slack-ruby-bot-server-rtm/lifecycle.rb
82
+ - lib/slack-ruby-bot-server-rtm/rspec.rb
83
+ - lib/slack-ruby-bot-server-rtm/server.rb
84
+ - lib/slack-ruby-bot-server-rtm/version.rb
85
+ - sample_apps/sample_app_activerecord/.rspec
86
+ - sample_apps/sample_app_activerecord/.standalone_migrations
87
+ - sample_apps/sample_app_activerecord/Gemfile
88
+ - sample_apps/sample_app_activerecord/Procfile
89
+ - sample_apps/sample_app_activerecord/README.md
90
+ - sample_apps/sample_app_activerecord/Rakefile
91
+ - sample_apps/sample_app_activerecord/commands.rb
92
+ - sample_apps/sample_app_activerecord/commands/help.rb
93
+ - sample_apps/sample_app_activerecord/commands/whoami.rb
94
+ - sample_apps/sample_app_activerecord/config.ru
95
+ - sample_apps/sample_app_activerecord/config/newrelic.yml
96
+ - sample_apps/sample_app_activerecord/config/postgresql.yml
97
+ - sample_apps/sample_app_activerecord/db/migrate/20170307164946_create_teams_table.rb
98
+ - sample_apps/sample_app_activerecord/db/migrate/20190323181453_add_activated_fields.rb
99
+ - sample_apps/sample_app_activerecord/db/schema.rb
100
+ - sample_apps/sample_app_activerecord/spec/api/root_spec.rb
101
+ - sample_apps/sample_app_activerecord/spec/commands/help_spec.rb
102
+ - sample_apps/sample_app_activerecord/spec/commands/whoami_spec.rb
103
+ - sample_apps/sample_app_activerecord/spec/spec_helper.rb
104
+ - sample_apps/sample_app_mongoid/.rspec
105
+ - sample_apps/sample_app_mongoid/Gemfile
106
+ - sample_apps/sample_app_mongoid/Procfile
107
+ - sample_apps/sample_app_mongoid/README.md
108
+ - sample_apps/sample_app_mongoid/Rakefile
109
+ - sample_apps/sample_app_mongoid/commands.rb
110
+ - sample_apps/sample_app_mongoid/commands/help.rb
111
+ - sample_apps/sample_app_mongoid/commands/whoami.rb
112
+ - sample_apps/sample_app_mongoid/config.ru
113
+ - sample_apps/sample_app_mongoid/config/mongoid.yml
114
+ - sample_apps/sample_app_mongoid/config/newrelic.yml
115
+ - sample_apps/sample_app_mongoid/spec/api/root_spec.rb
116
+ - sample_apps/sample_app_mongoid/spec/commands/help_spec.rb
117
+ - sample_apps/sample_app_mongoid/spec/commands/whoami_spec.rb
118
+ - sample_apps/sample_app_mongoid/spec/spec_helper.rb
119
+ - slack-ruby-bot-server-rtm.gemspec
120
+ homepage: https://github.com/slack-ruby/slack-ruby-bot-server-rtm
121
+ licenses: []
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubygems_version: 3.1.3
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: Slack RTM bot extension for slack-ruby-bot-server.
142
+ test_files: []