author | Mahlon E. Smith <mahlon@martini.nu> |
Wed, 04 Apr 2018 13:24:51 -0700 | |
changeset 11 | 9187008b0989 |
parent 8 | e0b7c95a154f |
child 13 | 6723f3b07536 |
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" |
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
7
diff
changeset
|
48 |
s.add_dependency 'net-snmp2', "~> 0.3" |
0 | 49 |
end |
50 |
||
51 |
Gem::PackageTask.new( spec ) do |pkg| |
|
52 |
pkg.need_zip = true |
|
53 |
pkg.need_tar = true |
|
54 |
end |
|
55 |
||
56 |
||
57 |
######################################################################## |
|
58 |
### D O C U M E N T A T I O N |
|
59 |
######################################################################## |
|
60 |
||
61 |
begin |
|
62 |
require 'rdoc/task' |
|
63 |
||
64 |
desc 'Generate rdoc documentation' |
|
65 |
RDoc::Task.new do |rdoc| |
|
66 |
rdoc.name = :docs |
|
67 |
rdoc.rdoc_dir = 'docs' |
|
68 |
rdoc.main = "README.rdoc" |
|
69 |
rdoc.options = [ '-f', 'fivefish' ] |
|
70 |
rdoc.rdoc_files = [ 'lib', *FileList['*.rdoc'] ] |
|
71 |
end |
|
72 |
||
73 |
RDoc::Task.new do |rdoc| |
|
74 |
rdoc.name = :doc_coverage |
|
75 |
rdoc.options = [ '-C1' ] |
|
76 |
end |
|
77 |
||
78 |
rescue LoadError |
|
79 |
$stderr.puts "Omitting 'docs' tasks, rdoc doesn't seem to be installed." |
|
80 |
end |
|
81 |
||
82 |
||
83 |
######################################################################## |
|
84 |
### T E S T I N G |
|
85 |
######################################################################## |
|
86 |
||
87 |
begin |
|
88 |
require 'rspec/core/rake_task' |
|
89 |
task :test => :spec |
|
90 |
||
91 |
desc "Run specs" |
|
92 |
RSpec::Core::RakeTask.new do |t| |
|
93 |
t.pattern = "spec/**/*_spec.rb" |
|
94 |
end |
|
95 |
||
96 |
desc "Build a coverage report" |
|
97 |
task :coverage do |
|
98 |
ENV[ 'COVERAGE' ] = "yep" |
|
99 |
Rake::Task[ :spec ].invoke |
|
100 |
end |
|
101 |
||
102 |
rescue LoadError |
|
103 |
$stderr.puts "Omitting testing tasks, rspec doesn't seem to be installed." |
|
104 |
end |
|
105 |
||
106 |
||
107 |
||
108 |
######################################################################## |
|
109 |
### M A N I F E S T |
|
110 |
######################################################################## |
|
111 |
__END__ |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
7
diff
changeset
|
112 |
lib/arborist/snmp.rb |
0 | 113 |
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
|
114 |
lib/arborist/monitor/snmp/swap.rb |
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 |