newrelic-slack-ruby-bot 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d4c0f09be7b689f81ab4d713613ab3e46a6399c4
4
+ data.tar.gz: 8ac9430651de24a38c70db670e6fee5326710bbb
5
+ SHA512:
6
+ metadata.gz: 6e30e6d31bf8605419b958a71bacb8fe1a267d4cb3756b2d5d226b81a202f11131b2bee1eeb0fb8b10e329d2b6bdd9b370065644cc0c22f58b221a105f866465
7
+ data.tar.gz: 7a1adee1e43eee3b5d33ea4d4707d4f39e70ea228934f997b585f7d0d1df964dfeca0e2e341afd6f090786a1a911c802e405df150949443c4978a6d474cef4f1
@@ -0,0 +1,3 @@
1
+ ### 0.1.0 (12/27/2015)
2
+
3
+ * Initial public release - [@dblock](https://github.com/dblock).
@@ -0,0 +1,125 @@
1
+ # Contributing to Ruby-Enum
2
+
3
+ This project is work of [many contributors](https://github.com/dblock/newrelic-slack-ruby-bot/graphs/contributors).
4
+
5
+ You're encouraged to submit [pull requests](https://github.com/dblock/newrelic-slack-ruby-bot/pulls), [propose features and discuss issues](https://github.com/dblock/newrelic-slack-ruby-bot/issues).
6
+
7
+ In the examples below, substitute your Github username for `contributor` in URLs.
8
+
9
+ ### Fork the Project
10
+
11
+ Fork the [project on Github](https://github.com/dblock/newrelic-slack-ruby-bot) and check out your copy.
12
+
13
+ ```
14
+ git clone https://github.com/contributor/newrelic-slack-ruby-bot.git
15
+ cd newrelic-slack-ruby-bot
16
+ git remote add upstream https://github.com/dblock/newrelic-slack-ruby-bot.git
17
+ ```
18
+
19
+ ### Bundle Install and Test
20
+
21
+ Ensure that you can build the project and run tests.
22
+
23
+ ```
24
+ bundle install
25
+ bundle exec rake
26
+ ```
27
+
28
+ ## Contribute Code
29
+
30
+ ### Create a Topic Branch
31
+
32
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
33
+
34
+ ```
35
+ git checkout master
36
+ git pull upstream master
37
+ git checkout -b my-feature-branch
38
+ ```
39
+
40
+ ### Write Tests
41
+
42
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add tests to [spec](spec).
43
+
44
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
45
+
46
+ ### Write Code
47
+
48
+ Implement your feature or bug fix.
49
+
50
+ Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ingored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
51
+
52
+ Make sure that `bundle exec rake` completes without errors.
53
+
54
+ ### Write Documentation
55
+
56
+ Document any external behavior in the [README](README.md).
57
+
58
+ ### Update Changelog
59
+
60
+ Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Don't remove *Your contribution here*.
61
+
62
+ Make it look like every other line, including a link to the issue being fixed, your name and link to your Github account.
63
+
64
+ ### Commit Changes
65
+
66
+ Make sure git knows your name and email address:
67
+
68
+ ```
69
+ git config --global user.name "Your Name"
70
+ git config --global user.email "contributor@example.com"
71
+ ```
72
+
73
+ Writing good commit logs is important. A commit log should describe what changed and why.
74
+
75
+ ```
76
+ git add ...
77
+ git commit
78
+ ```
79
+
80
+ ### Push
81
+
82
+ ```
83
+ git push origin my-feature-branch
84
+ ```
85
+
86
+ ### Make a Pull Request
87
+
88
+ Go to https://github.com/contributor/newrelic-slack-ruby-bot and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
89
+
90
+ ### Update CHANGELOG Again
91
+
92
+ Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
93
+
94
+ ```
95
+ * [#123](https://github.com/dblock/newrelic-slack-ruby-bot/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
96
+ ```
97
+
98
+ Amend your previous commit and force push the changes.
99
+
100
+ ```
101
+ git commit --amend
102
+ git push origin my-feature-branch -f
103
+ ```
104
+
105
+ ### Rebase
106
+
107
+ If you've been working on a change for a while, rebase with upstream/master.
108
+
109
+ ```
110
+ git fetch upstream
111
+ git rebase upstream/master
112
+ git push origin my-feature-branch -f
113
+ ```
114
+
115
+ ### Check on Your Pull Request
116
+
117
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
118
+
119
+ ### Be Patient
120
+
121
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
122
+
123
+ ## Thank You
124
+
125
+ Please do know that we really appreciate and value your time and work. We love you, really.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'rspec', '~> 3.4.0'
6
+ gem 'rake'
7
+ gem 'rubocop', '0.35.1'
@@ -0,0 +1,105 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ newrelic-slack-ruby-bot (0.1.0)
5
+ newrelic_rpm
6
+ slack-ruby-bot
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ activesupport (4.2.5)
12
+ i18n (~> 0.7)
13
+ json (~> 1.7, >= 1.7.7)
14
+ minitest (~> 5.1)
15
+ thread_safe (~> 0.3, >= 0.3.4)
16
+ tzinfo (~> 1.1)
17
+ addressable (2.4.0)
18
+ ast (2.2.0)
19
+ astrolabe (1.3.1)
20
+ parser (~> 2.2)
21
+ diff-lcs (1.2.5)
22
+ eventmachine (1.0.8)
23
+ faraday (0.9.2)
24
+ multipart-post (>= 1.2, < 3)
25
+ faraday_middleware (0.9.2)
26
+ faraday (>= 0.7.4, < 0.10)
27
+ faraday_middleware-parse_oj (0.3.0)
28
+ faraday (~> 0.9.0)
29
+ faraday_middleware (~> 0.9.1)
30
+ oj (~> 2.0)
31
+ faye-websocket (0.10.2)
32
+ eventmachine (>= 0.12.0)
33
+ websocket-driver (>= 0.5.1)
34
+ giphy (2.0.2)
35
+ faraday (~> 0.9)
36
+ faraday_middleware (~> 0.9)
37
+ faraday_middleware-parse_oj (~> 0.3)
38
+ launchy (~> 2.4)
39
+ gli (2.13.4)
40
+ hashie (3.4.3)
41
+ i18n (0.7.0)
42
+ json (1.8.3)
43
+ launchy (2.4.3)
44
+ addressable (~> 2.3)
45
+ minitest (5.8.3)
46
+ multipart-post (2.0.0)
47
+ newrelic_rpm (3.14.0.305)
48
+ oj (2.14.2)
49
+ parser (2.2.3.0)
50
+ ast (>= 1.1, < 3.0)
51
+ powerpack (0.1.1)
52
+ rainbow (2.0.0)
53
+ rake (10.4.2)
54
+ rspec (3.4.0)
55
+ rspec-core (~> 3.4.0)
56
+ rspec-expectations (~> 3.4.0)
57
+ rspec-mocks (~> 3.4.0)
58
+ rspec-core (3.4.1)
59
+ rspec-support (~> 3.4.0)
60
+ rspec-expectations (3.4.0)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.4.0)
63
+ rspec-mocks (3.4.0)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.4.0)
66
+ rspec-support (3.4.1)
67
+ rubocop (0.35.1)
68
+ astrolabe (~> 1.3)
69
+ parser (>= 2.2.3.0, < 3.0)
70
+ powerpack (~> 0.1)
71
+ rainbow (>= 1.99.1, < 3.0)
72
+ ruby-progressbar (~> 1.7)
73
+ tins (<= 1.6.0)
74
+ ruby-progressbar (1.7.5)
75
+ slack-ruby-bot (0.5.2)
76
+ activesupport
77
+ faye-websocket
78
+ giphy (~> 2.0.2)
79
+ hashie
80
+ slack-ruby-client (>= 0.5.0)
81
+ slack-ruby-client (0.5.0)
82
+ faraday
83
+ faraday_middleware
84
+ gli
85
+ json
86
+ websocket-driver
87
+ thread_safe (0.3.5)
88
+ tins (1.6.0)
89
+ tzinfo (1.2.2)
90
+ thread_safe (~> 0.1)
91
+ websocket-driver (0.6.3)
92
+ websocket-extensions (>= 0.1.0)
93
+ websocket-extensions (0.1.2)
94
+
95
+ PLATFORMS
96
+ ruby
97
+
98
+ DEPENDENCIES
99
+ newrelic-slack-ruby-bot!
100
+ rake
101
+ rspec (~> 3.4.0)
102
+ rubocop (= 0.35.1)
103
+
104
+ BUNDLED WITH
105
+ 1.10.6
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2015 Daniel Doubrovkine.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,27 @@
1
+ NewRelic::Agent::Instrumentation::SlackRubyBot
2
+ ==============================================
3
+
4
+ [![Gem Version](http://img.shields.io/gem/v/newrelic-slack-ruby-bot.svg)](http://badge.fury.io/rb/newrelic-slack-ruby-bot)
5
+ [![Build Status](http://img.shields.io/travis/dblock/newrelic-slack-ruby-bot.svg)](https://travis-ci.org/dblock/newrelic-slack-ruby-bot)
6
+ [![Dependency Status](https://gemnasium.com/dblock/newrelic-slack-ruby-bot.svg)](https://gemnasium.com/dblock/newrelic-slack-ruby-bot)
7
+ [![Code Climate](https://codeclimate.com/github/dblock/newrelic-slack-ruby-bot.svg)](https://codeclimate.com/github/dblock/newrelic-slack-ruby-bot)
8
+
9
+ NewRelic instrumentation for [slack-ruby-bot](github.com/dblock/slack-ruby-bot).
10
+
11
+ ## Install
12
+
13
+ Add to Gemfile.
14
+
15
+ ```ruby
16
+ gem 'newrelic-slack-ruby-bot'
17
+ ```
18
+
19
+ ## Contributing
20
+
21
+ You're encouraged to contribute to this gem. See [CONTRIBUTING](CONTRIBUTING.md) for details.
22
+
23
+ ## Copyright and License
24
+
25
+ Copyright (c) 2015, Daniel Doubrovkine and [Contributors](CHANGELOG.md).
26
+
27
+ This project is licensed under the [MIT License](LICENSE.md).
@@ -0,0 +1,67 @@
1
+ # Releasing Ruby-Enum
2
+
3
+ There're no hard rules about when to release newrelic-slack-ruby-bot. Release bug fixes frequenty, features not so frequently and breaking API changes rarely.
4
+
5
+ ### Release
6
+
7
+ Run tests, check that all tests succeed locally.
8
+
9
+ ```
10
+ bundle install
11
+ rake
12
+ ```
13
+
14
+ Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/newrelic-slack-ruby-bot) for all supported platforms.
15
+
16
+ Increment the version, modify [lib/newrelic-slack-ruby-bot/version.rb](lib/newrelic-slack-ruby-bot/version.rb).
17
+
18
+ * Increment the third number if the release has bug fixes and/or very minor features, only (eg. change `0.2.1` to `0.2.2`).
19
+ * Increment the second number if the release contains major features or breaking API changes (eg. change `0.2.1` to `0.3.0`).
20
+
21
+ Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version.
22
+
23
+ ```
24
+ ### 0.2.2 (7/10/2015)
25
+ ```
26
+
27
+ Remove the line with "Your contribution here.", since there will be no more contributions to this release.
28
+
29
+ Commit your changes.
30
+
31
+ ```
32
+ git add README.md CHANGELOG.md lib/newrelic-slack-ruby-bot/version.rb
33
+ git commit -m "Preparing for release, 0.2.2."
34
+ git push origin master
35
+ ```
36
+
37
+ Release.
38
+
39
+ ```
40
+ $ rake release
41
+
42
+ newrelic-slack-ruby-bot 0.2.2 built to pkg/newrelic-slack-ruby-bot-0.2.2.gem.
43
+ Tagged v0.2.2.
44
+ Pushed git commits and tags.
45
+ Pushed newrelic-slack-ruby-bot 0.2.2 to rubygems.org.
46
+ ```
47
+
48
+ ### Prepare for the Next Version
49
+
50
+ Add the next release to [CHANGELOG.md](CHANGELOG.md).
51
+
52
+ ```
53
+ Next Release
54
+ ============
55
+
56
+ * Your contribution here.
57
+ ```
58
+
59
+ Increment the third version number in [lib/newrelic-slack-ruby-bot/version.rb](lib/newrelic-slack-ruby-bot/version.rb).
60
+
61
+ Comit your changes.
62
+
63
+ ```
64
+ git add CHANGELOG.md lib/newrelic-slack-ruby-bot/version.rb
65
+ git commit -m "Preparing for next development iteration, 0.2.3."
66
+ git push origin master
67
+ ```
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'bundler/gem_tasks'
3
+
4
+ Bundler.setup :default, :development
5
+
6
+ require 'rspec/core'
7
+ require 'rspec/core/rake_task'
8
+
9
+ RSpec::Core::RakeTask.new(:spec) do |spec|
10
+ spec.pattern = FileList['spec/**/*_spec.rb']
11
+ end
12
+
13
+ require 'rubocop/rake_task'
14
+ RuboCop::RakeTask.new(:rubocop)
15
+
16
+ task default: [:rubocop, :spec]
@@ -0,0 +1,4 @@
1
+ require 'newrelic_rpm'
2
+ require 'slack-ruby-bot'
3
+ require 'newrelic-slack-ruby-bot/version'
4
+ require 'newrelic-slack-ruby-bot/instrumentation'
@@ -0,0 +1,31 @@
1
+ DependencyDetection.defer do
2
+ named :slack_ruby_bot_instrumentation
3
+
4
+ depends_on do
5
+ !::NewRelic::Agent.config[:disable_slack_ruby_bot]
6
+ end
7
+
8
+ depends_on do
9
+ defined?(::SlackRubyBot::VERSION)
10
+ end
11
+
12
+ executes do
13
+ NewRelic::Agent.logger.info 'Installing New Relic supported SlackRubyBot instrumentation'
14
+ instrument_call
15
+ end
16
+
17
+ def instrument_call
18
+ ::SlackRubyBot::Server.class_eval do
19
+ include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
20
+
21
+ def message_with_new_relic(client, data)
22
+ perform_action_with_newrelic_trace(name: 'message', category: 'OtherTransaction/Slack') do
23
+ message_without_new_relic(client, data)
24
+ end
25
+ end
26
+
27
+ alias_method :message_without_new_relic, :message
28
+ alias_method :message, :message_with_new_relic
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,9 @@
1
+ module NewRelic
2
+ module Agent
3
+ module Instrumentation
4
+ module SlackRubyBot
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
+ require 'newrelic-slack-ruby-bot/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'newrelic-slack-ruby-bot'
6
+ s.version = NewRelic::Agent::Instrumentation::SlackRubyBot::VERSION
7
+ s.authors = ['Daniel Doubrovkine']
8
+ s.email = 'dblock@dblock.org'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.required_rubygems_version = '>= 1.3.6'
11
+ s.files = Dir['**/*']
12
+ s.require_paths = ['lib']
13
+ s.homepage = 'http://github.com/dblock/newrelic-slack-ruby-bot'
14
+ s.licenses = ['MIT']
15
+ s.summary = 'NewRelic instrumentation for slack-ruby-bot.'
16
+ s.add_dependency 'newrelic_rpm'
17
+ s.add_dependency 'slack-ruby-bot'
18
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe NewRelic::Agent::Instrumentation do
4
+ let(:client) { SlackRubyBot::Client.new }
5
+ subject do
6
+ SlackRubyBot::Server.new
7
+ end
8
+ it 'perform_action_with_newrelic_trace' do
9
+ expect(subject)
10
+ .to receive(:perform_action_with_newrelic_trace)
11
+ .with(hash_including(name: 'message'))
12
+ .and_yield
13
+
14
+ subject.message(client, message: 'message', text: 'hi')
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe NewRelic::Agent::Instrumentation::SlackRubyBot do
4
+ it 'has a version' do
5
+ expect(NewRelic::Agent::Instrumentation::SlackRubyBot::VERSION).not_to be_nil
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+
3
+ require 'rubygems'
4
+ require 'rspec'
5
+ require 'newrelic-slack-ruby-bot'
6
+
7
+ RSpec.configure do |config|
8
+ config.raise_errors_for_deprecations!
9
+ config.before do
10
+ DependencyDetection.detect!
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newrelic-slack-ruby-bot
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: 2015-12-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: newrelic_rpm
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
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'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email: dblock@dblock.org
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - CHANGELOG.md
48
+ - CONTRIBUTING.md
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE.md
52
+ - README.md
53
+ - RELEASING.md
54
+ - Rakefile
55
+ - lib/newrelic-slack-ruby-bot.rb
56
+ - lib/newrelic-slack-ruby-bot/instrumentation.rb
57
+ - lib/newrelic-slack-ruby-bot/version.rb
58
+ - newrelic-slack-ruby-bot.gemspec
59
+ - spec/newrelic-slack-ruby-bot/instrumentation_spec.rb
60
+ - spec/newrelic-slack-ruby-bot/version_spec.rb
61
+ - spec/spec_helper.rb
62
+ homepage: http://github.com/dblock/newrelic-slack-ruby-bot
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 1.3.6
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.4.8
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: NewRelic instrumentation for slack-ruby-bot.
86
+ test_files: []