Skip to content

Commit

Permalink
update repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Jones committed Mar 2, 2016
1 parent 5f004c4 commit 3db74ba
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 70 deletions.
28 changes: 28 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Pull Request Checklist

**Is this in reference to an existing issue?**

#### General

- [ ] Update Changelog following the conventions laid out on [Keep A Changelog](http://keepachangelog.com/)

- [ ] Update README with any necessary configuration snippets

- [ ] Binstubs are created if needed

- [ ] RuboCop passes

- [ ] Existing tests pass

#### New Plugins

- [ ] Tests

- [ ] Add the plugin to the README

- [ ] Does it have a complete header as outlined [here](http://sensu-plugins.io/docs/developer_guidelines.html#coding-style)

#### Purpose

#### Known Compatablity Issues

32 changes: 23 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
language: ruby
cache:
- bundler
- bundler
install:
- bundle install
- bundle install
rvm:
- 1.9.3
- 2.0
- 2.1
- 2.2
- 1.9.3
- 2.0
- 2.1
- 2.2
notifications:
email:
recipients:
- sensu-plugin@sensu-plugins.io
- sensu-plugin@sensu-plugins.io
on_success: change
on_failure: always

script:
- 'bundle exec rake default'
- bundle exec rake default
- gem build sensu-plugins-memcached.gemspec
- gem install sensu-plugins-memcached-*.gem
deploy:
provider: rubygems
api_key:
secure: ex7+p6lF5VakTYYTMh6yBg+p1eumkm4ewZhGlqLLertZdlxhdyWXUnZ+wc3i0KwK4rSHSQMuptGbaG8lSIYMC1Nd4OBJTgWWKqz8kPUVZWyRWGWteaCUHB/DVXH9g+dmu7fJGZ57y0hK9VWXewJ6WBacuPmQDDzfqO3NQ+qkrcU=
gem: sensu-plugins-memcached
on:
tags: true
all_branches: true
rvm: 1.9.3
rvm: 2.0
rvm: 2.1
rvm: 2.2
repo: sensu-plugins/sensu-plugins-memcached
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).

This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)

## Unreleased
## [Unreleased]

## [0.0.2] - 2015-07-14
### Changed
- updated sensu-plugin gem to 1.2.0

## 0.0.1 - 2015-05-21

### Added
- initial release

[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-memcached/compare/0.0.2...HEAD
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-memcached/compare/0.0.1...0.0.2
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-memcached/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-memcached)
[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-memcached/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-memcached)
[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-memcached.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-memcached)
[ ![Codeship Status for sensu-plugins/sensu-plugins-memcached](https://codeship.com/projects/f9a3d390-dbf3-0132-bdc9-1e3fe125131b/status?branch=master)](https://codeship.com/projects/79841)

## Functionality

Expand Down
42 changes: 19 additions & 23 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'github/markup'
require 'redcarpet'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'yard'
require 'yard/rake/yardoc_task'

desc 'Don\'t run Rubocop for unsupported versions'
begin
if RUBY_VERSION >= '2.0.0'
args = [:spec, :make_bin_executable, :yard, :rubocop]
else
args = [:spec, :make_bin_executable, :yard]
end
args = if RUBY_VERSION >= '2.0.0'
[:spec, :make_bin_executable, :yard, :rubocop, :check_binstubs]
else
[:spec, :make_bin_executable, :yard]
end
end

YARD::Rake::YardocTask.new do |t|
OTHER_PATHS = %w()
OTHER_PATHS = %w().freeze
t.files = ['lib/**/*.rb', 'bin/**/*.rb', OTHER_PATHS]
t.options = %w(--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md,CONTRIBUTING.md)
t.options = %w(--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md)
end

RuboCop::RakeTask.new
Expand All @@ -32,20 +32,16 @@ task :make_bin_executable do
`chmod -R +x bin/*`
end

desc 'Retrieve the current version'
task :version do
puts SensuPluginsMemcached::Version.json_version
end

desc 'Bump the PATCH version'
task :bump do
version_file = 'lib/sensu-plugins-memcached/version.rb'

# Read the file, bump the PATCH version
contents = File.read(version_file).gsub(/(PATCH = )(\d+)/) { |_| Regexp.last_match[1] + (Regexp.last_match[2].to_i + 1).to_s }

# Write the new contents of the file
File.open(version_file, 'w') { |file| file.puts contents }
desc 'Test for binstubs'
task :check_binstubs do
bin_list = Gem::Specification.load('sensu-plugins-memcached.gemspec').executables
bin_list.each do |b|
`which #{ b }`
unless $CHILD_STATUS.success?
puts "#{b} was not a binstub"
exit
end
end
end

task default: args
4 changes: 2 additions & 2 deletions bin/metrics-memcached-key-stats-graphite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ class MemcachedKeyStatsGraphite < Sensu::Plugin::Metric::CLI::Graphite

def run
Timeout.timeout(config[:timeout]) do
TCPSocket.open("#{config[:host]}", "#{config[:port]}") do |socket|
TCPSocket.open(config[:host].to_s, config[:port].to_s) do |socket|
socket.print "stats detail dump\r\n"
socket.close_write
recv = socket.read
# #YELLOW
recv.each_line do |line|
if line.match('PREFIX')
if line =~ 'PREFIX'
_, key, _, get, _, hit, _, set, _, del = line.split(' ', -1)
output "#{config[:scheme]}.#{key}.get", get.to_i
output "#{config[:scheme]}.#{key}.hit", hit.to_i
Expand Down
4 changes: 2 additions & 2 deletions bin/metrics-memcached-socket-graphite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def run
stats = {}
metrics = {}
Timeout.timeout(30) do
TCPSocket.open("#{config[:host]}", "#{config[:port]}") do |socket|
TCPSocket.open(config[:host].to_s, config[:port].to_s) do |socket|
socket.print "stats\r\n"
socket.close_write
recv = socket.read
recv.each_line do |line|
stats[line.split(' ')[1]] = line.split(' ')[2] if line.match('STAT')
stats[line.split(' ')[1]] = line.split(' ')[2] if line =~ 'STAT'
end
metrics.update(sort_metrics(stats))
metrics.each do |k, v|
Expand Down
21 changes: 0 additions & 21 deletions certs/sensu-plugins.pem

This file was deleted.

20 changes: 10 additions & 10 deletions sensu-plugins-memcached.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ else
require_relative 'lib/sensu-plugins-memcached'
end

pvt_key = '~/.ssh/gem-private_key.pem'
# pvt_key = '~/.ssh/gem-private_key.pem'

Gem::Specification.new do |s|
s.authors = ['Sensu Plugins and contributors']
s.cert_chain = ['certs/sensu-plugins.pem']
# s.cert_chain = ['certs/sensu-plugins.pem']
s.date = Date.today.to_s
s.description = 'This plugin provides native memcached instrumentation
for monitoring and metrics collection, including:
stats service health and metrics via `stats` protocol'
s.email = '<sensu-users@googlegroups.com>'
s.executables = Dir.glob('bin/**/*').map { |file| File.basename(file) }
s.executables = Dir.glob('bin/**/*.rb').map { |file| File.basename(file) }
s.files = Dir.glob('{bin,lib}/**/*') + %w(LICENSE README.md CHANGELOG.md)
s.homepage = 'https://github.com/sensu-plugins/sensu-plugins-memcached'
s.license = 'MIT'
Expand All @@ -34,21 +34,21 @@ Gem::Specification.new do |s|
s.post_install_message = 'You can use the embedded Ruby by setting EMBEDDED_RUBY=true in /etc/default/sensu'
s.require_paths = ['lib']
s.required_ruby_version = '>= 1.9.3'
s.signing_key = File.expand_path(pvt_key) if $PROGRAM_NAME =~ /gem\z/
# s.signing_key = File.expand_path(pvt_key) if $PROGRAM_NAME =~ /gem\z/
s.summary = 'Sensu plugins for memcached'
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.version = SensuPluginsMemcached::Version::VER_STRING

s.add_runtime_dependency 'sensu-plugin', '1.2.0'
s.add_runtime_dependency 'sensu-plugin', '~> 1.2'
s.add_runtime_dependency 'memcached', '1.8.0'

s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
s.add_development_dependency 'rubocop', '0.32.1'
s.add_development_dependency 'rspec', '~> 3.1'
s.add_development_dependency 'bundler', '~> 1.7'
s.add_development_dependency 'rake', '~> 10.0'
s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
s.add_development_dependency 'github-markup', '~> 1.3'
s.add_development_dependency 'pry', '~> 0.10'
s.add_development_dependency 'rake', '~> 10.5'
s.add_development_dependency 'redcarpet', '~> 3.2'
s.add_development_dependency 'rubocop', '~> 0.37'
s.add_development_dependency 'rspec', '~> 3.4'
s.add_development_dependency 'yard', '~> 0.8'
s.add_development_dependency 'pry', '~> 0.10'
end

0 comments on commit 3db74ba

Please sign in to comment.