Rakefile
author Mahlon E. Smith <mahlon@martini.nu>
Sun, 01 Sep 2019 13:28:18 -0700
changeset 25 6217282f6070
parent 20 00a38d493f2c
permissions -rw-r--r--
Bye, Bitbucket.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     1
#!/usr/bin/env rake
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     2
# vim: set nosta noet ts=4 sw=4:
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     3
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     4
require 'pathname'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     5
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     6
PROJECT = 'snmp'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     7
BASEDIR = Pathname.new( __FILE__ ).expand_path.dirname.relative_path_from( Pathname.getwd )
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     8
LIBDIR  = BASEDIR + 'lib'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     9
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    10
if Rake.application.options.trace
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    11
    $trace = true
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    12
    $stderr.puts '$trace is enabled'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    13
end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    14
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    15
# parse the current library version
8
e0b7c95a154f Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents: 7
diff changeset
    16
$version = ( LIBDIR + 'arborist' + "#{PROJECT}.rb" ).read.split(/\n/).
0
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    17
	select{|line| line =~ /VERSION =/}.first.match(/([\d|.]+)/)[1]
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    18
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    19
task :default => [ :spec, :docs, :package ]
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    20
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    21
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    22
########################################################################
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    23
### P A C K A G I N G
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    24
########################################################################
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    25
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    26
require 'rubygems'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    27
require 'rubygems/package_task'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    28
spec = Gem::Specification.new do |s|
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    29
	s.email        = 'mahlon@martini.nu'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    30
	s.homepage     = 'http://bitbucket.org/mahlon/Arborist-SNMP'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    31
	s.authors      = [ 'Mahlon E. Smith <mahlon@martini.nu>', 'Michael Granger <ged@faeriemud.org>' ]
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    32
	s.platform     = Gem::Platform::RUBY
8
e0b7c95a154f Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents: 7
diff changeset
    33
	s.summary      = "SNMP support for Arborist monitors"
0
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    34
	s.name         = 'arborist-' + PROJECT
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    35
	s.version      = $version
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    36
	s.license      = 'BSD-3-Clause'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    37
	s.has_rdoc     = true
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    38
	s.require_path = 'lib'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    39
	s.bindir       = 'bin'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    40
	s.files        = File.read( __FILE__ ).split( /^__END__/, 2 ).last.split
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    41
	# s.executables  = %w[]
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    42
	s.description  = <<-EOF
8
e0b7c95a154f Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents: 7
diff changeset
    43
	This library adds common SNMP resource support to Arborist monitors.
0
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    44
	EOF
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    45
	s.required_ruby_version = '>= 2'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    46
7
4548e58c8c66 Use the new #node_properties method, convery from .rvmrc
Mahlon E. Smith <mahlon@martini.nu>
parents: 4
diff changeset
    47
	s.add_dependency 'arborist', "~> 0.1"
14
d5cb8bd33170 Although faster, once aiming a few thousand nodes at net-snmp2 it leaks memory like a sieve. Use 'netsnmp' instead.
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
    48
	s.add_dependency 'netsnmp', "~> 0.1"
d5cb8bd33170 Although faster, once aiming a few thousand nodes at net-snmp2 it leaks memory like a sieve. Use 'netsnmp' instead.
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
    49
	s.add_dependency 'xorcist', "~> 1.1"
0
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    50
end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    51
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    52
Gem::PackageTask.new( spec ) do |pkg|
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    53
	pkg.need_zip = true
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    54
	pkg.need_tar = true
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    55
end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    56
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    57
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    58
########################################################################
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    59
### D O C U M E N T A T I O N
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    60
########################################################################
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    61
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    62
begin
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    63
	require 'rdoc/task'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    64
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    65
	desc 'Generate rdoc documentation'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    66
	RDoc::Task.new do |rdoc|
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    67
		rdoc.name       = :docs
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    68
		rdoc.rdoc_dir   = 'docs'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    69
		rdoc.main       = "README.rdoc"
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    70
		rdoc.options    = [ '-f', 'fivefish' ]
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    71
		rdoc.rdoc_files = [ 'lib', *FileList['*.rdoc'] ]
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    72
	end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    73
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    74
	RDoc::Task.new do |rdoc|
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    75
		rdoc.name       = :doc_coverage
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    76
		rdoc.options    = [ '-C1' ]
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    77
	end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    78
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    79
rescue LoadError
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    80
	$stderr.puts "Omitting 'docs' tasks, rdoc doesn't seem to be installed."
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    81
end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    82
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    83
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    84
########################################################################
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    85
### T E S T I N G
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    86
########################################################################
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    87
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    88
begin
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    89
    require 'rspec/core/rake_task'
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    90
    task :test => :spec
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    91
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    92
    desc "Run specs"
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    93
    RSpec::Core::RakeTask.new do |t|
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    94
        t.pattern = "spec/**/*_spec.rb"
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    95
    end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    96
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    97
    desc "Build a coverage report"
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    98
    task :coverage do
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    99
        ENV[ 'COVERAGE' ] = "yep"
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   100
        Rake::Task[ :spec ].invoke
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   101
    end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   102
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   103
rescue LoadError
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   104
    $stderr.puts "Omitting testing tasks, rspec doesn't seem to be installed."
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   105
end
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   106
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   107
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   108
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   109
########################################################################
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   110
### M A N I F E S T
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   111
########################################################################
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   112
__END__
8
e0b7c95a154f Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents: 7
diff changeset
   113
lib/arborist/snmp.rb
0
8547a1ce445e Initial commit.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   114
lib/arborist/monitor/snmp.rb
4
e6eb11b1e00d Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 1
diff changeset
   115
lib/arborist/monitor/snmp/disk.rb
e6eb11b1e00d Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 1
diff changeset
   116
lib/arborist/monitor/snmp/process.rb
e6eb11b1e00d Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents: 1
diff changeset
   117
lib/arborist/monitor/snmp/memory.rb
8
e0b7c95a154f Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents: 7
diff changeset
   118
lib/arborist/monitor/snmp/cpu.rb
20
00a38d493f2c add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents: 14
diff changeset
   119
lib/arborist/monitor/snmp/ups.rb
00a38d493f2c add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents: 14
diff changeset
   120
lib/arborist/monitor/snmp/ups/battery.rb