This repository has been archived by the owner on Feb 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Rakefile
98 lines (83 loc) · 2.19 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
require 'rake'
require 'rake/clean'
require 'rake/testtask'
include Object.const_defined?(:RbConfig) ? RbConfig : Config
CLEAN.include("**/*.gem", "**/*.rbc")
namespace 'gem' do
desc 'Create the net-ping gem'
task :create => [:clean] do
spec = eval(IO.read('net-ping.gemspec'))
if Gem::VERSION.to_f < 2.0
Gem::Builder.new(spec).build
else
require 'rubygems/package'
Gem::Package.build(spec)
end
end
desc 'Install the net-ping gem'
task :install => [:create] do
gem_file = Dir["*.gem"].first
if RUBY_PLATFORM == 'java'
sh "jruby -S gem install -l #{gem_file}"
else
sh "gem install -l #{gem_file}"
end
end
end
namespace 'example' do
desc 'Run the external ping example program'
task :external do
ruby '-Ilib examples/example_pingexternal.rb'
end
desc 'Run the http ping example program'
task :http do
ruby '-Ilib examples/example_pinghttp.rb'
end
desc 'Run the tcp ping example program'
task :tcp do
ruby '-Ilib examples/example_pingtcp.rb'
end
desc 'Run the udp ping example program'
task :udp do
ruby '-Ilib examples/example_pingudp.rb'
end
end
Rake::TestTask.new do |t|
t.libs << 'test'
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_net_ping.rb']
end
namespace 'test' do
Rake::TestTask.new('external') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_net_ping_external.rb']
end
Rake::TestTask.new('http') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_net_ping_http.rb']
end
Rake::TestTask.new('icmp') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_net_ping_icmp.rb']
end
Rake::TestTask.new('tcp') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_net_ping_tcp.rb']
end
Rake::TestTask.new('udp') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_net_ping_udp.rb']
end
Rake::TestTask.new('wmi') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_net_ping_wmi.rb']
end
end
task :default => :test