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 ed1c6f9 commit 6a476a7
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 64 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-load-checks.gemspec
- gem install sensu-plugins-load-checks-*.gem
deploy:
provider: rubygems
api_key:
secure: J19rBhFsEYozDnd5nAqLVGldCJRsyT5//9ZqbbtLIxgnoNllEPA0Qq3X358zkjZ8b1L+JrnRjv+/WyXNrUkXMP0/YLgy5T1rG90HhGp2dqXacF20Tj/6so4y8S4WKv7Y3Kf4vdxQFlPPBOaYzhvDkeIQuPUBxjMHvpmvsrK3RPg=
gem: sensu-plugins-load-checks
on:
tags: true
all_branches: true
rvm: 1.9.3
rvm: 2.0
rvm: 2.1
rvm: 2.2
repo: sensu-plugins/sensu-plugins-load-checks
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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.4] - 2015-12-11
### Changed
Expand All @@ -13,15 +13,18 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
### Changed
- updated sensu-plugin gem to 1.2.0

## 0.0.1 - 2015-05-21

### Added
- initial release

## [0.0.2] - 2015-06-03

### Fixed
- added binstubs

### Changed
- removed cruft from /lib

## 0.0.1 - 2015-05-21
### Added
- initial release

[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-load-checks/compare/0.0.4...HEAD
[0.0.4]: https://github.com/sensu-plugins/sensu-plugins-load-checks/compare/0.0.3...0.0.4
[0.0.3]: https://github.com/sensu-plugins/sensu-plugins-load-checks/compare/0.0.2...0.0.3
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-load-checks/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-load-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-load-checks)
[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-load-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-load-checks)
[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-load-checks.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-load-checks)
[ ![Codeship Status for sensu-plugins/sensu-plugins-load-checks](https://codeship.com/projects/5de2a3e0-db96-0132-e4a4-0eed4ec53b27/status?branch=master)](https://codeship.com/projects/79666)

## Functionality

Expand Down
32 changes: 22 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'yard'
require 'github/markup'
require 'rubocop/rake_task'
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)
end
Expand All @@ -29,7 +29,19 @@ end

desc 'Make all plugins executable'
task :make_bin_executable do
`chmod -R +x bin/***/*.rb`
`chmod -R +x bin/*`
end

desc 'Test for binstubs'
task :check_binstubs do
bin_list = Gem::Specification.load('sensu-plugins-load-checks.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
10 changes: 6 additions & 4 deletions bin/check-load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@

# round(n) doesn't exist in ruby < 1.9
class Float
alias_method :oldround, :round
alias oldround round

def round(precision = nil)
if precision.nil?
if precision.nil? # rubocop:disable Style/GuardClause
return self
else
return ((self * 10**precision).oldround.to_f) / (10**precision)
return (self * 10**precision).oldround.to_f / (10**precision)
end
end
end
Expand All @@ -45,7 +45,9 @@ def initialize(per_core = false)
end

def cpu_count
File.read('/proc/cpuinfo').scan(/^processor/).count rescue 0
File.read('/proc/cpuinfo').scan(/^processor/).count
rescue
0
end

def failed?
Expand Down
4 changes: 2 additions & 2 deletions bin/metrics-load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class LoadStat < Sensu::Plugin::Metric::CLI::Graphite
option :scheme,
description: 'Metric naming scheme, text to prepend to .$parent.$child',
long: '--scheme SCHEME',
default: "#{Socket.gethostname}"
default: Socket.gethostname.to_s

option :per_core,
description: 'Divide load average results by cpu/core count',
Expand All @@ -68,7 +68,7 @@ def number_of_cores
end

def run
result = `uptime`.gsub(',', '').split(' ')
result = `uptime`.delete(',').split(' ')
result = result[-3..-1]

timestamp = Time.now.to_i
Expand Down
21 changes: 0 additions & 21 deletions certs/sensu-plugins.pem

This file was deleted.

20 changes: 10 additions & 10 deletions sensu-plugins-load-checks.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ else
require_relative 'lib/sensu-plugins-load-checks'
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 load instrumentation
for monitoring and metrics collection, including:
load health, and total or per core metrics'
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-load-checks'
s.license = 'MIT'
Expand All @@ -35,20 +35,20 @@ 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 load checks'
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.version = SensuPluginsLoadChecks::Version::VER_STRING

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

s.add_development_dependency 'bundler', '~> 1.7'
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 '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 6a476a7

Please sign in to comment.