easyjour 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.0.4. Switched to more compatible DNSSD gem.
2
+
1
3
  v0.0.3. Documentation improvements and other minor changes.
2
4
 
3
5
  v0.0.2. First gem release.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rake'
2
2
  require 'rake/testtask'
3
3
  require 'rake/rdoctask'
4
4
  require 'spec/rake/spectask'
5
- require "lib/easyjour/version"
5
+ require 'lib/easyjour/version'
6
6
 
7
7
  require 'echoe'
8
8
  Echoe.new 'easyjour', Easyjour::Version do |p|
@@ -10,7 +10,7 @@ Echoe.new 'easyjour', Easyjour::Version do |p|
10
10
  p.url = "http://easyjour.rubyforge.org"
11
11
  p.author = "Elijah Miller"
12
12
  p.email = "elijah.miller@gmail.com"
13
- # p.extra_deps = [['net-mdns', '>= 0.4']]
13
+ # p.extra_deps = [['dnssd', '>= 0.7.0']]
14
14
  p.need_tar_gz = false
15
15
  end
16
16
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{easyjour}
5
- s.version = "0.0.3"
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-06}
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
12
  s.extra_rdoc_files = ["CHANGELOG", "lib/easyjour/version.rb", "lib/easyjour.rb", "LICENSE", "README"]
@@ -1,4 +1,5 @@
1
- require 'net/dns/mdns-sd'
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, text_record = {}, protocol = :tcp)
25
- @service = Net::DNS::MDNSSD.register(name, Easyjour.type_from_parts(service, protocol), 'local', port, text_record)
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 = Net::DNS::MDNSSD.browse(Easyjour.type_from_parts(service, protocol), 'local') do |reply|
76
- Net::DNS::MDNSSD.resolve(reply.name, reply.type, reply.domain) do |reply|
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
@@ -1,3 +1,3 @@
1
1
  module Easyjour
2
- Version = '0.0.3'
2
+ Version = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easyjour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elijah Miller
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-06 00:00:00 -05:00
12
+ date: 2008-12-07 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency