wol 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +29 -0
- data/.travis.yml +6 -0
- data/Gemfile +3 -0
- data/README.rdoc +1 -1
- data/Rakefile +5 -0
- data/lib/wol/version.rb +1 -1
- data/spec/hosts.wol +24 -0
- data/spec/parsefile_spec.rb +42 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/wakeonlan_spec.rb +31 -0
- data/wol.gemspec +22 -0
- metadata +100 -50
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## Other editors
|
17
|
+
.idea
|
18
|
+
tags
|
19
|
+
|
20
|
+
## PROJECT::GENERAL
|
21
|
+
coverage
|
22
|
+
rdoc
|
23
|
+
pkg
|
24
|
+
.bundle
|
25
|
+
*.gem
|
26
|
+
Gemfile.lock
|
27
|
+
|
28
|
+
## PROJECT::SPECIFIC
|
29
|
+
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.rdoc
CHANGED
data/Rakefile
ADDED
data/lib/wol/version.rb
CHANGED
data/spec/hosts.wol
ADDED
@@ -0,0 +1,24 @@
|
|
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
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "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_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "wol"
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# Require this file using `require "spec_helper.rb"` to ensure that it is only
|
6
|
+
# loaded once.
|
7
|
+
#
|
8
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
|
+
config.run_all_when_everything_filtered = true
|
12
|
+
config.filter_run :focus
|
13
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "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
|
+
|
28
|
+
it "should return the version number as a string" do
|
29
|
+
Wol::VERSION.class.should == String
|
30
|
+
end
|
31
|
+
end
|
data/wol.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
require "wol/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.authors = ["Matias Korhonen"]
|
7
|
+
gem.email = ["me@matiaskorhonen.fi"]
|
8
|
+
gem.homepage = "http://github.com/k33l0r/wol"
|
9
|
+
gem.summary = "Ruby Wake-On-LAN"
|
10
|
+
gem.description = "Send Wake-On-LAN magic packets from Ruby or from CLI"
|
11
|
+
|
12
|
+
gem.name = "wol"
|
13
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
gem.version = Wol::VERSION
|
18
|
+
|
19
|
+
gem.add_development_dependency "rake"
|
20
|
+
gem.add_development_dependency "bundler"
|
21
|
+
gem.add_development_dependency "rspec", "~> 2.9.0"
|
22
|
+
end
|
metadata
CHANGED
@@ -1,73 +1,123 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: wol
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
- 0
|
9
|
-
version: 0.4.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Matias Korhonen
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.9.0
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.9.0
|
21
62
|
description: Send Wake-On-LAN magic packets from Ruby or from CLI
|
22
|
-
email:
|
63
|
+
email:
|
23
64
|
- me@matiaskorhonen.fi
|
24
|
-
executables:
|
65
|
+
executables:
|
25
66
|
- wol
|
26
67
|
extensions: []
|
27
|
-
|
28
68
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
|
69
|
+
files:
|
70
|
+
- .document
|
71
|
+
- .gitignore
|
72
|
+
- .travis.yml
|
73
|
+
- COPYING
|
74
|
+
- Gemfile
|
75
|
+
- LICENSE
|
76
|
+
- README.rdoc
|
77
|
+
- Rakefile
|
78
|
+
- bin/wol
|
79
|
+
- lib/wol.rb
|
31
80
|
- lib/wol/parsefile.rb
|
81
|
+
- lib/wol/runner.rb
|
32
82
|
- lib/wol/version.rb
|
33
83
|
- lib/wol/wakeonlan.rb
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
|
40
|
-
has_rdoc: true
|
41
|
-
homepage: http://wol.matiaskorhonen.fi
|
84
|
+
- spec/hosts.wol
|
85
|
+
- spec/parsefile_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
- spec/wakeonlan_spec.rb
|
88
|
+
- wol.gemspec
|
89
|
+
homepage: http://github.com/k33l0r/wol
|
42
90
|
licenses: []
|
43
|
-
|
44
91
|
post_install_message:
|
45
92
|
rdoc_options: []
|
46
|
-
|
47
|
-
require_paths:
|
93
|
+
require_paths:
|
48
94
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
hash: 1812496455705727705
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
segments:
|
54
111
|
- 0
|
55
|
-
|
56
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
segments:
|
61
|
-
- 1
|
62
|
-
- 3
|
63
|
-
- 6
|
64
|
-
version: 1.3.6
|
112
|
+
hash: 1812496455705727705
|
65
113
|
requirements: []
|
66
|
-
|
67
|
-
|
68
|
-
rubygems_version: 1.3.6
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 1.8.25
|
69
116
|
signing_key:
|
70
117
|
specification_version: 3
|
71
118
|
summary: Ruby Wake-On-LAN
|
72
|
-
test_files:
|
73
|
-
|
119
|
+
test_files:
|
120
|
+
- spec/hosts.wol
|
121
|
+
- spec/parsefile_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
- spec/wakeonlan_spec.rb
|