author | Mahlon E. Smith <mahlon@martini.nu> |
Tue, 28 Apr 2020 10:10:19 -0700 | |
changeset 26 | 54f2f57cc0b0 |
parent 20 | 00a38d493f2c |
permissions | -rw-r--r-- |
0 | 1 |
#!/usr/bin/env rake |
2 |
# vim: set nosta noet ts=4 sw=4: |
|
3 |
||
4 |
require 'pathname' |
|
5 |
||
6 |
PROJECT = 'snmp' |
|
7 |
BASEDIR = Pathname.new( __FILE__ ).expand_path.dirname.relative_path_from( Pathname.getwd ) |
|
8 |
LIBDIR = BASEDIR + 'lib' |
|
9 |
||
10 |
if Rake.application.options.trace |
|
11 |
$trace = true |
|
12 |
$stderr.puts '$trace is enabled' |
|
13 |
end |
|
14 |
||
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 | 17 |
select{|line| line =~ /VERSION =/}.first.match(/([\d|.]+)/)[1] |
18 |
||
19 |
task :default => [ :spec, :docs, :package ] |
|
20 |
||
21 |
||
22 |
######################################################################## |
|
23 |
### P A C K A G I N G |
|
24 |
######################################################################## |
|
25 |
||
26 |
require 'rubygems' |
|
27 |
require 'rubygems/package_task' |
|
28 |
spec = Gem::Specification.new do |s| |
|
29 |
s.email = 'mahlon@martini.nu' |
|
30 |
s.homepage = 'http://bitbucket.org/mahlon/Arborist-SNMP' |
|
31 |
s.authors = [ 'Mahlon E. Smith <mahlon@martini.nu>', 'Michael Granger <ged@faeriemud.org>' ] |
|
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 | 34 |
s.name = 'arborist-' + PROJECT |
35 |
s.version = $version |
|
36 |
s.license = 'BSD-3-Clause' |
|
37 |
s.has_rdoc = true |
|
38 |
s.require_path = 'lib' |
|
39 |
s.bindir = 'bin' |
|
40 |
s.files = File.read( __FILE__ ).split( /^__END__/, 2 ).last.split |
|
41 |
# s.executables = %w[] |
|
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 | 44 |
EOF |
45 |
s.required_ruby_version = '>= 2' |
|
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 | 50 |
end |
51 |
||
52 |
Gem::PackageTask.new( spec ) do |pkg| |
|
53 |
pkg.need_zip = true |
|
54 |
pkg.need_tar = true |
|
55 |
end |
|
56 |
||
57 |
||
58 |
######################################################################## |
|
59 |
### D O C U M E N T A T I O N |
|
60 |
######################################################################## |
|
61 |
||
62 |
begin |
|
63 |
require 'rdoc/task' |
|
64 |
||
65 |
desc 'Generate rdoc documentation' |
|
66 |
RDoc::Task.new do |rdoc| |
|
67 |
rdoc.name = :docs |
|
68 |
rdoc.rdoc_dir = 'docs' |
|
69 |
rdoc.main = "README.rdoc" |
|
70 |
rdoc.options = [ '-f', 'fivefish' ] |
|
71 |
rdoc.rdoc_files = [ 'lib', *FileList['*.rdoc'] ] |
|
72 |
end |
|
73 |
||
74 |
RDoc::Task.new do |rdoc| |
|
75 |
rdoc.name = :doc_coverage |
|
76 |
rdoc.options = [ '-C1' ] |
|
77 |
end |
|
78 |
||
79 |
rescue LoadError |
|
80 |
$stderr.puts "Omitting 'docs' tasks, rdoc doesn't seem to be installed." |
|
81 |
end |
|
82 |
||
83 |
||
84 |
######################################################################## |
|
85 |
### T E S T I N G |
|
86 |
######################################################################## |
|
87 |
||
88 |
begin |
|
89 |
require 'rspec/core/rake_task' |
|
90 |
task :test => :spec |
|
91 |
||
92 |
desc "Run specs" |
|
93 |
RSpec::Core::RakeTask.new do |t| |
|
94 |
t.pattern = "spec/**/*_spec.rb" |
|
95 |
end |
|
96 |
||
97 |
desc "Build a coverage report" |
|
98 |
task :coverage do |
|
99 |
ENV[ 'COVERAGE' ] = "yep" |
|
100 |
Rake::Task[ :spec ].invoke |
|
101 |
end |
|
102 |
||
103 |
rescue LoadError |
|
104 |
$stderr.puts "Omitting testing tasks, rspec doesn't seem to be installed." |
|
105 |
end |
|
106 |
||
107 |
||
108 |
||
109 |
######################################################################## |
|
110 |
### M A N I F E S T |
|
111 |
######################################################################## |
|
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 | 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 |