wol 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +3 -8
- data/README.rdoc +7 -8
- data/bin/wol +1 -3
- data/lib/wol.rb +2 -1
- data/lib/wol/runner.rb +87 -92
- data/lib/wol/version.rb +3 -0
- metadata +36 -50
- data/.document +0 -5
- data/.gitignore +0 -22
- data/Rakefile +0 -55
- data/VERSION +0 -1
- data/spec/hosts.wol +0 -24
- data/spec/parsefile_spec.rb +0 -42
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -9
- data/spec/wakeonlan_spec.rb +0 -27
- data/test/helper.rb +0 -10
- data/test/test_wol.rb +0 -7
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Copyright (c) 2009 Matias Korhonen
|
1
|
+
Copyright (c) 2009-2010 Matias Korhonen
|
2
2
|
|
3
|
-
Ruby Wake-On-LAN is copyrighted free software by Matias Korhonen <
|
3
|
+
Ruby Wake-On-LAN is copyrighted free software by Matias Korhonen <me@matiaskorhonen.fi>.
|
4
4
|
|
5
5
|
You can redistribute it and/or modify it under either the terms of the GPL
|
6
6
|
(see COPYING.txt file), or the conditions below:
|
@@ -41,12 +41,7 @@ You can redistribute it and/or modify it under either the terms of the GPL
|
|
41
41
|
d) make other distribution arrangements with the author.
|
42
42
|
|
43
43
|
4. You may modify and include the part of the software into any other
|
44
|
-
software (possibly commercial).
|
45
|
-
are not written by the author, so that they are not under this terms.
|
46
|
-
|
47
|
-
They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
|
48
|
-
files under the ./missing directory. See each file for the copying
|
49
|
-
condition.
|
44
|
+
software (possibly commercial).
|
50
45
|
|
51
46
|
5. The scripts and library files supplied as input to or produced as
|
52
47
|
output from the software do not automatically fall under the
|
data/README.rdoc
CHANGED
@@ -1,26 +1,25 @@
|
|
1
1
|
= WOL
|
2
2
|
|
3
|
-
Ruby Wake-On-LAN gem.
|
3
|
+
Ruby Wake-On-LAN gem.
|
4
4
|
|
5
5
|
== To Do
|
6
6
|
|
7
|
-
* Write further tests
|
8
|
-
* Refactor the gem structure to something sane
|
7
|
+
* Write further tests for teh CLI functionality
|
9
8
|
|
10
9
|
== Note on Patches/Pull Requests
|
11
10
|
|
12
11
|
* Fork the project.
|
13
12
|
* Make your feature addition or bug fix.
|
14
|
-
* Add tests for it. This is important so I don't break it in a
|
15
|
-
|
13
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
14
|
+
* Check that the test pass at least under Ruby 1.8.7, 1.9.x, and JRuby.
|
16
15
|
* Commit, do not mess with rakefile, version, or history.
|
17
16
|
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
18
|
-
* Send me a pull request.
|
17
|
+
* Send me a pull request.
|
19
18
|
|
20
19
|
== Copyright
|
21
20
|
|
22
|
-
Copyright (c) 2009 Matias Korhonen. This project is dual licensed under the Ruby License and the GNU General Public License v3.
|
21
|
+
Copyright (c) 2009-2010 Matias Korhonen. This project is dual licensed under the Ruby License and the GNU General Public License v3.
|
23
22
|
|
24
|
-
This project contains code originally written by K.Kodama. He has been identified as the original author where appropriate.
|
23
|
+
This project contains a small amount of code originally written by K.Kodama. He has been identified as the original author where appropriate.
|
25
24
|
|
26
25
|
See LICENSE for details.
|
data/bin/wol
CHANGED
data/lib/wol.rb
CHANGED
data/lib/wol/runner.rb
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
#
|
6
6
|
require 'optparse'
|
7
7
|
|
8
|
+
# Run the Ruby-Wake-On-LAN command, +wol+, and parse the given options
|
8
9
|
module Wol
|
9
|
-
# Run the Ruby-Wake-On-LAN command, +wol+, and parse the given options
|
10
10
|
module Runner
|
11
|
-
|
11
|
+
@sample_file = %{# File structure
|
12
12
|
# --------------
|
13
13
|
# - blank lines are ignored
|
14
14
|
# - comment lines are ignored (lines starting with a hash mark '#')
|
@@ -34,125 +34,120 @@ module Wol
|
|
34
34
|
:count => 3,
|
35
35
|
:macs => [],
|
36
36
|
:file => nil,
|
37
|
-
:nothing_to_wake => false}
|
37
|
+
:nothing_to_wake => false }
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
# Parse the give arguments
|
40
|
+
def self.parse!(args)
|
41
|
+
args = ["-h"] if args.empty?
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
opts = OptionParser.new do |opts|
|
44
|
+
# Set a banner, displayed at the top
|
45
|
+
# of the help screen.
|
46
|
+
opts.banner = "Ruby Wake-On-LAN #{Wol::VERSION}\nUsage: wol -i ADDRESS ff:ff:ff:ff:ff:ff"
|
47
47
|
|
48
|
-
|
48
|
+
opts.separator "\nSpecific options:"
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
opts.on( '-i', '--address 255.255.255.255', 'Set the destination address' ) do |address|
|
55
|
-
@options[:address] = address
|
56
|
-
end
|
50
|
+
opts.on( '-q', '--quiet', 'No console output' ) do
|
51
|
+
@options[:quiet] = true
|
52
|
+
end
|
57
53
|
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
opts.on( '-i', '--address 255.255.255.255', 'Set the destination address' ) do |address|
|
55
|
+
@options[:address] = address
|
56
|
+
end
|
61
57
|
|
62
|
-
|
63
|
-
|
64
|
-
|
58
|
+
opts.on( '-p', '--port 9', Integer, 'Set the destination port' ) do |port|
|
59
|
+
@options[:port] = port
|
60
|
+
end
|
65
61
|
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
opts.on( '-d', '--delay 0.01', Float, 'Delay between sending packets in seconds') do |delay|
|
63
|
+
@options[:delay] = delay
|
64
|
+
end
|
69
65
|
|
70
|
-
|
71
|
-
|
72
|
-
|
66
|
+
opts.on( '-c', '--count 3', Integer, 'Number of packets to send. Default 3') do |count|
|
67
|
+
@options[:count] = count
|
68
|
+
end
|
73
69
|
|
74
|
-
|
70
|
+
opts.on( '-f', '--file FILE', 'TODO: Uses a file as a source of addresses') do |file|
|
71
|
+
@options[:file] = file
|
72
|
+
end
|
75
73
|
|
76
|
-
|
77
|
-
@options[:nothing_to_wake] = true
|
78
|
-
puts opts
|
79
|
-
end
|
74
|
+
opts.separator "\nCommon options:"
|
80
75
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
76
|
+
opts.on_tail( '-h', '--help', 'Display this message' ) do
|
77
|
+
@options[:nothing_to_wake] = true
|
78
|
+
puts opts
|
79
|
+
end
|
85
80
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
81
|
+
opts.on_tail( '-s', '--sample-file', 'Display a sample file') do
|
82
|
+
@options[:nothing_to_wake] = true
|
83
|
+
puts @sample_file
|
90
84
|
end
|
91
85
|
|
92
|
-
|
93
|
-
|
86
|
+
opts.on_tail( '-v', '--version', 'Show version') do
|
87
|
+
@options[:nothing_to_wake] = true
|
88
|
+
puts "Ruby Wake-On-LAN #{Wol::VERSION}"
|
89
|
+
end
|
90
|
+
end
|
94
91
|
|
95
|
-
|
96
|
-
|
97
|
-
@options[:macs] << arg if /^(\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2})?$/.match(arg)
|
98
|
-
end
|
92
|
+
begin
|
93
|
+
opts.parse!(args)
|
99
94
|
|
100
|
-
|
95
|
+
if @options[:file].nil?
|
96
|
+
args.each do |arg|
|
97
|
+
@options[:macs] << arg if /^(\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2})?$/.match(arg)
|
101
98
|
end
|
102
99
|
|
103
|
-
|
104
|
-
rescue OptionParser::InvalidOption => e
|
105
|
-
STDERR.puts e.message, "\n", opts
|
106
|
-
return -1
|
100
|
+
@options[:macs].uniq!
|
107
101
|
end
|
108
|
-
end
|
109
102
|
|
110
|
-
|
111
|
-
|
112
|
-
|
103
|
+
return @options
|
104
|
+
rescue OptionParser::InvalidOption => e
|
105
|
+
STDERR.puts e.message, "\n", opts
|
106
|
+
return -1
|
113
107
|
end
|
108
|
+
end
|
114
109
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
hosts.each do |host|
|
121
|
-
@options[:address], @options[:macs], @options[:port] = host[:address], host[:mac], host[:port]
|
110
|
+
# Send WOL MagicPackets based on the parsed options
|
111
|
+
def self.wake
|
112
|
+
if @options[:file]
|
113
|
+
hosts = ParseFile.read_and_parse_file(@options[:file])
|
122
114
|
|
123
|
-
|
124
|
-
|
115
|
+
hosts.each do |host|
|
116
|
+
@options[:address], @options[:macs], @options[:port] = host[:address], host[:mac], host[:port]
|
125
117
|
|
126
|
-
|
127
|
-
|
128
|
-
elsif !@options[:macs].empty?
|
129
|
-
@options[:macs].each do |mac|
|
130
|
-
@options[:mac] = mac
|
131
|
-
message = WakeOnLan.new(@options).wake.to_s
|
132
|
-
puts message unless @options[:quiet]
|
133
|
-
end
|
118
|
+
message = WakeOnLan.new(@options).wake.to_s
|
119
|
+
puts message unless options[:quiet]
|
134
120
|
|
135
121
|
return 0
|
136
|
-
elsif @options[:macs].empty? && @options[:file].nil? && !@options[:nothing_to_wake]
|
137
|
-
raise Exception, "You must supply a MAC address or a file"
|
138
|
-
else
|
139
|
-
return -1
|
140
122
|
end
|
123
|
+
elsif !@options[:macs].empty?
|
124
|
+
@options[:macs].each do |mac|
|
125
|
+
@options[:mac] = mac
|
126
|
+
message = WakeOnLan.new(@options).wake.to_s
|
127
|
+
puts message unless @options[:quiet]
|
128
|
+
end
|
129
|
+
|
130
|
+
return 0
|
131
|
+
elsif @options[:macs].empty? && @options[:file].nil? && !@options[:nothing_to_wake]
|
132
|
+
raise Exception, "You must supply a MAC address or a file"
|
133
|
+
else
|
134
|
+
return -1
|
141
135
|
end
|
136
|
+
end
|
142
137
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
end
|
138
|
+
# Parse the command line options, then use them to wake up any given hosts.
|
139
|
+
def self.run(argv)
|
140
|
+
begin
|
141
|
+
parse!(argv)
|
142
|
+
|
143
|
+
return wake
|
144
|
+
rescue SocketError => e
|
145
|
+
puts e.message
|
146
|
+
return -1
|
147
|
+
rescue Exception => e
|
148
|
+
STDERR.puts e.message
|
149
|
+
return -1
|
156
150
|
end
|
157
151
|
end
|
152
|
+
end
|
158
153
|
end
|
data/lib/wol/version.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Matias Korhonen
|
@@ -9,79 +14,60 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
25
|
-
description: Ruby Wake-On-LAN
|
26
|
-
email: korhonen.matt@gmail.com
|
17
|
+
date: 2010-05-17 00:00:00 +03:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Send Wake-On-LAN magic packets from Ruby or from CLI
|
22
|
+
email:
|
23
|
+
- me@matiaskorhonen.fi
|
27
24
|
executables:
|
28
25
|
- wol
|
29
26
|
extensions: []
|
30
27
|
|
31
|
-
extra_rdoc_files:
|
32
|
-
|
33
|
-
- README.rdoc
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
34
30
|
files:
|
35
|
-
- .document
|
36
|
-
- .gitignore
|
37
|
-
- COPYING
|
38
|
-
- LICENSE
|
39
|
-
- README.rdoc
|
40
|
-
- Rakefile
|
41
|
-
- VERSION
|
42
|
-
- bin/wol
|
43
|
-
- lib/wol.rb
|
44
31
|
- lib/wol/parsefile.rb
|
45
|
-
- lib/wol/
|
32
|
+
- lib/wol/version.rb
|
46
33
|
- lib/wol/wakeonlan.rb
|
47
|
-
-
|
48
|
-
-
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
- test/test_wol.rb
|
34
|
+
- lib/wol/runner.rb
|
35
|
+
- lib/wol.rb
|
36
|
+
- bin/wol
|
37
|
+
- LICENSE
|
38
|
+
- COPYING
|
39
|
+
- README.rdoc
|
54
40
|
has_rdoc: true
|
55
|
-
homepage: http://
|
41
|
+
homepage: http://wol.matiaskorhonen.fi
|
56
42
|
licenses: []
|
57
43
|
|
58
44
|
post_install_message:
|
59
|
-
rdoc_options:
|
60
|
-
|
45
|
+
rdoc_options: []
|
46
|
+
|
61
47
|
require_paths:
|
62
48
|
- lib
|
63
49
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
50
|
requirements:
|
65
51
|
- - ">="
|
66
52
|
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
67
55
|
version: "0"
|
68
|
-
version:
|
69
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
57
|
requirements:
|
71
58
|
- - ">="
|
72
59
|
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 3
|
63
|
+
- 6
|
64
|
+
version: 1.3.6
|
75
65
|
requirements: []
|
76
66
|
|
77
67
|
rubyforge_project: wol
|
78
|
-
rubygems_version: 1.3.
|
68
|
+
rubygems_version: 1.3.6
|
79
69
|
signing_key:
|
80
70
|
specification_version: 3
|
81
|
-
summary: Ruby
|
82
|
-
test_files:
|
83
|
-
|
84
|
-
- spec/spec_helper.rb
|
85
|
-
- spec/parsefile_spec.rb
|
86
|
-
- test/test_wol.rb
|
87
|
-
- test/helper.rb
|
71
|
+
summary: Ruby Wake-On-LAN
|
72
|
+
test_files: []
|
73
|
+
|
data/.document
DELETED
data/.gitignore
DELETED
data/Rakefile
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "wol"
|
8
|
-
gem.summary = %Q{Ruby WoL}
|
9
|
-
gem.description = %Q{Ruby Wake-On-LAN}
|
10
|
-
gem.email = "korhonen.matt@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/k33l0r/wol"
|
12
|
-
gem.authors = ["Matias Korhonen"]
|
13
|
-
gem.rubyforge_project = 'wol'
|
14
|
-
gem.add_development_dependency "rspec", ">= 0"
|
15
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
-
end
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'spec/rake/spectask'
|
22
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
-
spec.libs << 'lib' << 'spec'
|
24
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
-
end
|
26
|
-
|
27
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
-
spec.libs << 'lib' << 'spec'
|
29
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
-
spec.rcov = true
|
31
|
-
end
|
32
|
-
|
33
|
-
task :spec => :check_dependencies
|
34
|
-
|
35
|
-
task :default => :spec
|
36
|
-
|
37
|
-
require 'rake/rdoctask'
|
38
|
-
gem 'rdoc'
|
39
|
-
require 'rdoc/rdoc'
|
40
|
-
|
41
|
-
Rake::RDocTask.new do |rdoc|
|
42
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
43
|
-
|
44
|
-
rdoc.rdoc_dir = 'rdoc'
|
45
|
-
rdoc.title = "Ruby Wake-On-LAN #{version}"
|
46
|
-
rdoc.rdoc_files.include('README*')
|
47
|
-
rdoc.rdoc_files.include('COPYING')
|
48
|
-
rdoc.rdoc_files.include('LICENSE')
|
49
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
-
|
51
|
-
rdoc.options += [
|
52
|
-
'-HN',
|
53
|
-
'-f', 'darkfish',
|
54
|
-
]
|
55
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.3
|
data/spec/hosts.wol
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# File structure
|
2
|
-
# --------------
|
3
|
-
# - blank lines are ignored
|
4
|
-
# - comment lines are ignored (lines starting with a hash mark '#')
|
5
|
-
# - other lines are considered valid records and can have 3 columns:
|
6
|
-
#
|
7
|
-
# Hardware address, IP address, destination port
|
8
|
-
#
|
9
|
-
# the last two are optional, in which case the following defaults
|
10
|
-
# are used:
|
11
|
-
#
|
12
|
-
# IP address: 255.255.255.255 (the limited broadcast address)
|
13
|
-
# port: 9 (the discard port)
|
14
|
-
#
|
15
|
-
|
16
|
-
01:02:03:04:05:06 192.168.1.255 9
|
17
|
-
01:02:03:04:05:06 192.168.2.230 12
|
18
|
-
07:09:09:0A:0B:0C example.com
|
19
|
-
0D:0E:0F:00:10:11
|
20
|
-
|
21
|
-
# Invalid entries
|
22
|
-
FF:FF:aa
|
23
|
-
0D:0E:0F:00:10:11 ;
|
24
|
-
07:09:09:0A:0B:0C 192.168.1.254 a
|
data/spec/parsefile_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
EXPECTED = [{:port=>9, :mac=>"01:02:03:04:05:06", :address=>"192.168.1.255"},
|
4
|
-
{:port=>12, :mac=>"01:02:03:04:05:06", :address=>"192.168.2.230"},
|
5
|
-
{:port=>9, :mac=>"07:09:09:0A:0B:0C", :address=>"example.com"},
|
6
|
-
{:port=>9, :mac=>"07:09:09:0A:0B:0C", :address=>"192.168.1.254"}]
|
7
|
-
|
8
|
-
TEST_STRING = %{# File structure
|
9
|
-
# --------------
|
10
|
-
# - blank lines are ignored
|
11
|
-
# - comment lines are ignored (lines starting with a hash mark '#')
|
12
|
-
# - other lines are considered valid records and can have 3 columns:
|
13
|
-
#
|
14
|
-
# Hardware address, IP address, destination port
|
15
|
-
#
|
16
|
-
# the last two are optional, in which case the following defaults
|
17
|
-
# are used:
|
18
|
-
#
|
19
|
-
# IP address: 255.255.255.255 (the limited broadcast address)
|
20
|
-
# port: 9 (the discard port)
|
21
|
-
#
|
22
|
-
|
23
|
-
01:02:03:04:05:06 192.168.1.255 9
|
24
|
-
01:02:03:04:05:06 192.168.2.230 12
|
25
|
-
07:09:09:0A:0B:0C example.com
|
26
|
-
0D:0E:0F:00:10:11
|
27
|
-
|
28
|
-
# Invalid entries
|
29
|
-
FF:FF:aa
|
30
|
-
0D:0E:0F:00:10:11 ;
|
31
|
-
07:09:09:0A:0B:0C 192.168.1.254 a}
|
32
|
-
|
33
|
-
describe "ParseFile" do
|
34
|
-
it "be able to parse a test file correctly" do
|
35
|
-
|
36
|
-
Wol::ParseFile.read_and_parse_file(File.expand_path(File.dirname(__FILE__) + '/hosts.wol')).should == EXPECTED
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should be able to parse a test string correctly" do
|
40
|
-
Wol::ParseFile.parse(TEST_STRING).should == EXPECTED
|
41
|
-
end
|
42
|
-
end
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/spec/spec_helper.rb
DELETED
data/spec/wakeonlan_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Wake-On-LAN" do
|
4
|
-
it "should send a MagicPacket to the broadcast addresses" do
|
5
|
-
Wol::WakeOnLan.new.wake.should == "Sending magic packet to 255.255.255.255:9 with ff:ff:ff:ff:ff:ff"
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should send a MagicPacket to a specified mac" do
|
9
|
-
Wol::WakeOnLan.new(:mac => "ff:ff:ff:ff:ff:cc").wake.should == "Sending magic packet to 255.255.255.255:9 with ff:ff:ff:ff:ff:cc"
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should send a MagicPacket to a specified address" do
|
13
|
-
Wol::WakeOnLan.new(:address => "example.com").wake.should == "Sending magic packet to example.com:9 with ff:ff:ff:ff:ff:ff"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should send a MagicPacket to a specified port" do
|
17
|
-
Wol::WakeOnLan.new(:port => 12).wake.should == "Sending magic packet to 255.255.255.255:12 with ff:ff:ff:ff:ff:ff"
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should send a MagicPacket to a specified mac, address, and port" do
|
21
|
-
Wol::WakeOnLan.new(:mac => "00:08:a1:a9:58:f6", :address => "example.com", :port => 80).wake.should == "Sending magic packet to example.com:80 with 00:08:a1:a9:58:f6"
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should return nil if quiet is set to true" do
|
25
|
-
Wol::WakeOnLan.new(:quiet => true).wake.should == nil
|
26
|
-
end
|
27
|
-
end
|
data/test/helper.rb
DELETED