wol 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/wol +2 -3
- data/lib/wol/runner.rb +28 -23
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/bin/wol
CHANGED
data/lib/wol/runner.rb
CHANGED
@@ -43,7 +43,7 @@ module Wol
|
|
43
43
|
opts = OptionParser.new do |opts|
|
44
44
|
# Set a banner, displayed at the top
|
45
45
|
# of the help screen.
|
46
|
-
opts.banner = "#{version}\nUsage: wol -
|
46
|
+
opts.banner = "#{version}\nUsage: wol -i ADDRESS ff:ff:ff:ff:ff:ff"
|
47
47
|
|
48
48
|
opts.separator ""
|
49
49
|
opts.separator "Specific options:"
|
@@ -117,36 +117,41 @@ module Wol
|
|
117
117
|
|
118
118
|
# Send WOL MagicPackets based on the parsed options
|
119
119
|
def self.wake(options = {})
|
120
|
-
|
121
|
-
|
122
|
-
hosts = ParseFile.read_and_parse_file(options[:file])
|
120
|
+
if options[:file]
|
121
|
+
hosts = ParseFile.read_and_parse_file(options[:file])
|
123
122
|
|
124
|
-
|
125
|
-
|
123
|
+
for host in hosts
|
124
|
+
options[:address], options[:macs], options[:port] = host[:address], host[:mac], host[:port]
|
126
125
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
options[:macs].each do |mac|
|
131
|
-
options[:mac] = mac
|
132
|
-
puts WakeOnLan.new(options).wake
|
133
|
-
end
|
134
|
-
else
|
135
|
-
puts "You have to specify a file or MAC address"
|
126
|
+
message = WakeOnLan.new(options).wake.to_s
|
127
|
+
puts message unless options[:quiet]
|
128
|
+
return 0
|
136
129
|
end
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
130
|
+
elsif !options[:macs].empty?
|
131
|
+
options[:macs].each do |mac|
|
132
|
+
options[:mac] = mac
|
133
|
+
message = WakeOnLan.new(options).wake.to_s
|
134
|
+
puts message unless options[:quiet]
|
135
|
+
return 0
|
136
|
+
end
|
137
|
+
else
|
138
|
+
puts "You have to specify a file or MAC address"
|
142
139
|
end
|
143
140
|
end
|
144
141
|
|
145
142
|
# Parse the command line options, then use them to wake up any given hosts.
|
146
|
-
def self.run!
|
147
|
-
|
143
|
+
def self.run!(argv)
|
144
|
+
begin
|
145
|
+
options = parse(argv)
|
148
146
|
|
149
|
-
|
147
|
+
wake(options)
|
148
|
+
return 0
|
149
|
+
rescue Exception => e
|
150
|
+
puts "An error occured. Please check your inputs."
|
151
|
+
puts "If you used a file, please check that it is properly formatted."
|
152
|
+
STDERR.puts e.message
|
153
|
+
return -1
|
154
|
+
end
|
150
155
|
end
|
151
156
|
end
|
152
157
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matias Korhonen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-19 00:00:00 +02:00
|
13
13
|
default_executable: wol
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|