jqr-easyjour 0.0.2 → 0.0.4
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/CHANGELOG +4 -0
- data/Manifest +1 -3
- data/README.rdoc +38 -0
- data/Rakefile +7 -8
- data/easyjour.gemspec +8 -5
- data/examples/httpjour.rb +1 -1
- data/lib/easyjour.rb +12 -5
- metadata +14 -7
- data/README +0 -34
- data/lib/easyjour/version.rb +0 -3
data/CHANGELOG
CHANGED
data/Manifest
CHANGED
data/README.rdoc
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
= Easyjour
|
2
|
+
|
3
|
+
|
4
|
+
Super simple access to service announcing and discovery using Bonjour aka DNSSD.
|
5
|
+
|
6
|
+
|
7
|
+
== Examples
|
8
|
+
|
9
|
+
Announce an HTTP server called garbage_files that's available on port 3000.
|
10
|
+
|
11
|
+
service = Easyjour.serve("garbage_files", 'http', 3000)
|
12
|
+
|
13
|
+
Search for HTTP servers and print them out as they reply.
|
14
|
+
|
15
|
+
search = Easyjour::Search.new('http') do |result|
|
16
|
+
puts "http://#{result.target}:#{result.port}/"
|
17
|
+
end
|
18
|
+
|
19
|
+
print "Press enter to cancel the search: "
|
20
|
+
gets
|
21
|
+
search.stop
|
22
|
+
|
23
|
+
Do a blocking search for 5 seconds looking for git services.
|
24
|
+
|
25
|
+
results = Easyjour.synchronous_search(5, 'git')
|
26
|
+
results.each do |result|
|
27
|
+
puts "git://#{result.target}:#{result.port}"
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
== Install
|
32
|
+
|
33
|
+
gem install easyjour
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
Homepage:: http://github.com/jqr/easyjour/tree/master
|
38
|
+
License:: Copyright (c) 2008 Elijah Miller <mailto:elijah.miller@gmail.com>, released under the MIT license.
|
data/Rakefile
CHANGED
@@ -1,23 +1,22 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/rdoctask'
|
4
1
|
require 'spec/rake/spectask'
|
5
|
-
require "lib/easyjour/version"
|
6
2
|
|
7
3
|
require 'echoe'
|
8
|
-
Echoe.new 'easyjour'
|
4
|
+
Echoe.new 'easyjour' do |p|
|
9
5
|
p.description = "Super simple access to service announcing and discovery using Bonjour aka DNSSD."
|
10
6
|
p.url = "http://easyjour.rubyforge.org"
|
11
7
|
p.author = "Elijah Miller"
|
12
8
|
p.email = "elijah.miller@gmail.com"
|
13
|
-
|
9
|
+
p.retain_gemspec = true
|
14
10
|
p.need_tar_gz = false
|
11
|
+
p.extra_deps = [
|
12
|
+
['dnssd', '>= 0.7.0']
|
13
|
+
]
|
15
14
|
end
|
16
15
|
|
17
|
-
|
18
|
-
Rake::Task[:default].prerequisites.clear
|
19
16
|
desc 'Default: run specs'
|
20
17
|
task :default => :spec
|
21
18
|
Spec::Rake::SpecTask.new do |t|
|
22
19
|
t.spec_files = FileList["spec/**/*_spec.rb"]
|
23
20
|
end
|
21
|
+
|
22
|
+
task :test => :spec
|
data/easyjour.gemspec
CHANGED
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{easyjour}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Elijah Miller"]
|
9
|
-
s.date = %q{2008-12-
|
9
|
+
s.date = %q{2008-12-07}
|
10
10
|
s.description = %q{Super simple access to service announcing and discovery using Bonjour aka DNSSD.}
|
11
11
|
s.email = %q{elijah.miller@gmail.com}
|
12
|
-
s.extra_rdoc_files = ["CHANGELOG", "lib/easyjour
|
13
|
-
s.files = ["CHANGELOG", "examples/httpjour.rb", "lib/easyjour
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/easyjour.rb", "LICENSE", "README.rdoc"]
|
13
|
+
s.files = ["CHANGELOG", "examples/httpjour.rb", "lib/easyjour.rb", "LICENSE", "Manifest", "Rakefile", "README.rdoc", "spec/spec_helper.rb", "easyjour.gemspec"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://easyjour.rubyforge.org}
|
16
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Easyjour", "--main", "README"]
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Easyjour", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{easyjour}
|
19
19
|
s.rubygems_version = %q{1.3.1}
|
@@ -24,11 +24,14 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.specification_version = 2
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
s.add_runtime_dependency(%q<dnssd>, [">= 0.7.0"])
|
27
28
|
s.add_development_dependency(%q<echoe>, [">= 0"])
|
28
29
|
else
|
30
|
+
s.add_dependency(%q<dnssd>, [">= 0.7.0"])
|
29
31
|
s.add_dependency(%q<echoe>, [">= 0"])
|
30
32
|
end
|
31
33
|
else
|
34
|
+
s.add_dependency(%q<dnssd>, [">= 0.7.0"])
|
32
35
|
s.add_dependency(%q<echoe>, [">= 0"])
|
33
36
|
end
|
34
37
|
end
|
data/examples/httpjour.rb
CHANGED
data/lib/easyjour.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems'
|
2
|
+
require 'dnssd'
|
2
3
|
|
3
4
|
module Easyjour
|
4
5
|
# Turns a service and protocol into _service._protocol format, automatically
|
@@ -21,8 +22,14 @@ module Easyjour
|
|
21
22
|
end
|
22
23
|
|
23
24
|
class Service
|
24
|
-
def initialize(name, service, port,
|
25
|
-
|
25
|
+
def initialize(name, service, port, text_record_hash = {}, protocol = :tcp)
|
26
|
+
text_record = DNSSD::TextRecord.new
|
27
|
+
text_record_hash.each do |key, value|
|
28
|
+
text_record[key] = value
|
29
|
+
end
|
30
|
+
|
31
|
+
@service = DNSSD.register(name, Easyjour.type_from_parts(service, protocol), 'local', port, text_record.encode, DNSSD::Flags::Add) do |reply|
|
32
|
+
end
|
26
33
|
end
|
27
34
|
|
28
35
|
# Stops a service from being discoverable.
|
@@ -72,8 +79,8 @@ module Easyjour
|
|
72
79
|
@results = []
|
73
80
|
@results_mutex = Mutex.new
|
74
81
|
|
75
|
-
@query =
|
76
|
-
|
82
|
+
@query = DNSSD.browse(Easyjour.type_from_parts(service, protocol)) do |reply|
|
83
|
+
DNSSD.resolve(reply.name, reply.type, reply.domain) do |reply|
|
77
84
|
yield(reply) if block_given?
|
78
85
|
|
79
86
|
@results_mutex.synchronize do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jqr-easyjour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elijah Miller
|
@@ -9,9 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-07 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: dnssd
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.7.0
|
23
|
+
version:
|
15
24
|
- !ruby/object:Gem::Dependency
|
16
25
|
name: echoe
|
17
26
|
version_requirement:
|
@@ -29,19 +38,17 @@ extensions: []
|
|
29
38
|
|
30
39
|
extra_rdoc_files:
|
31
40
|
- CHANGELOG
|
32
|
-
- lib/easyjour/version.rb
|
33
41
|
- lib/easyjour.rb
|
34
42
|
- LICENSE
|
35
|
-
- README
|
43
|
+
- README.rdoc
|
36
44
|
files:
|
37
45
|
- CHANGELOG
|
38
46
|
- examples/httpjour.rb
|
39
|
-
- lib/easyjour/version.rb
|
40
47
|
- lib/easyjour.rb
|
41
48
|
- LICENSE
|
42
49
|
- Manifest
|
43
50
|
- Rakefile
|
44
|
-
- README
|
51
|
+
- README.rdoc
|
45
52
|
- spec/spec_helper.rb
|
46
53
|
- easyjour.gemspec
|
47
54
|
has_rdoc: true
|
@@ -53,7 +60,7 @@ rdoc_options:
|
|
53
60
|
- --title
|
54
61
|
- Easyjour
|
55
62
|
- --main
|
56
|
-
- README
|
63
|
+
- README.rdoc
|
57
64
|
require_paths:
|
58
65
|
- lib
|
59
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/README
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
Easyjour
|
2
|
-
========
|
3
|
-
|
4
|
-
Super simple access to service announcing and discovery using Bonjour aka DNSSD.
|
5
|
-
|
6
|
-
|
7
|
-
Examples
|
8
|
-
========
|
9
|
-
|
10
|
-
# garbage_files is an HTTP server available on port 3000
|
11
|
-
Easyjour.serve("garbage_files", 'http', 3000)
|
12
|
-
|
13
|
-
|
14
|
-
# Continously find HTTP servers and print the url
|
15
|
-
search = Easyjour::Search.new('http') do |result|
|
16
|
-
puts "http://#{result.target}:#{result.port}/"
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
# Find the Git servers that respond in 5 seconds or less
|
21
|
-
results = Easyjour.synchronous_search(5, 'git')
|
22
|
-
results.each do |result|
|
23
|
-
puts "git://#{result.target}:#{result.port}"
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
Install
|
28
|
-
=======
|
29
|
-
|
30
|
-
gem sources -a http://gems.github.com
|
31
|
-
sudo gem install jqr-easyjour
|
32
|
-
|
33
|
-
Homepage: http://github.com/jqr/easyjour/tree/master
|
34
|
-
Copyright (c) 2008 Elijah Miller <elijah.miller@gmail.com>, released under the MIT license.
|
data/lib/easyjour/version.rb
DELETED