specjour 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.15
1
+ 0.1.16
@@ -6,6 +6,7 @@ module Specjour
6
6
  def scrub
7
7
  connect_to_database
8
8
  if pending_migrations?
9
+ Rake::Task['db:test:purge'].invoke
9
10
  Rake::Task['db:schema:load'].invoke
10
11
  else
11
12
  purge_tables
@@ -2,6 +2,7 @@ module Specjour
2
2
  class Dispatcher
3
3
  require 'dnssd'
4
4
  Thread.abort_on_exception = true
5
+ include SocketHelpers
5
6
 
6
7
  attr_reader :project_path, :managers, :manager_threads, :hosts
7
8
  attr_accessor :worker_size
@@ -73,10 +74,6 @@ module Specjour
73
74
  printer.worker_size = worker_size
74
75
  end
75
76
 
76
- def hostname
77
- @hostname ||= Socket.gethostname
78
- end
79
-
80
77
  def printer
81
78
  @printer ||= begin
82
79
  p = Printer.new
@@ -95,7 +92,7 @@ module Specjour
95
92
 
96
93
  def resolve_reply(reply)
97
94
  DNSSD.resolve!(reply) do |resolved|
98
- resolved_ip = Specjour.ip_from_hostname(resolved.target)
95
+ resolved_ip = ip_from_hostname(resolved.target)
99
96
  uri = URI::Generic.build :scheme => reply.service_name, :host => resolved_ip, :port => resolved.port
100
97
  fetch_manager(uri)
101
98
  resolved.service.stop if resolved.service.started?
@@ -2,6 +2,7 @@ module Specjour
2
2
  class Manager
3
3
  require 'dnssd'
4
4
  include DRbUndumped
5
+ include SocketHelpers
5
6
 
6
7
  attr_accessor :project_name, :specs_to_run
7
8
  attr_reader :worker_size, :batch_size, :dispatcher_uri, :registered_projects, :bonjour_service, :worker_pids
@@ -26,7 +27,7 @@ module Specjour
26
27
  end
27
28
 
28
29
  def dispatcher_uri=(uri)
29
- uri.host = Specjour.ip_from_hostname(uri.host)
30
+ uri.host = ip_from_hostname(uri.host)
30
31
  @dispatcher_uri = uri
31
32
  end
32
33
 
@@ -0,0 +1,11 @@
1
+ module Specjour
2
+ module SocketHelpers
3
+ def ip_from_hostname(hostname)
4
+ Socket.getaddrinfo(hostname, nil, Socket::AF_INET, Socket::SOCK_STREAM).first.fetch(3)
5
+ end
6
+
7
+ def hostname
8
+ @hostname ||= Socket.gethostname
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,7 @@
1
1
  module Specjour
2
2
  class Worker
3
3
  include Protocol
4
+ include SocketHelpers
4
5
  attr_accessor :printer_uri
5
6
  attr_reader :project_path, :specs_to_run, :number, :batch_size
6
7
 
data/lib/specjour.rb CHANGED
@@ -21,9 +21,10 @@ module Specjour
21
21
  autoload :MarshalableFailureFormatter, 'specjour/marshalable_failure_formatter'
22
22
  autoload :Printer, 'specjour/printer'
23
23
  autoload :RsyncDaemon, 'specjour/rsync_daemon'
24
+ autoload :SocketHelpers, 'specjour/socket_helpers'
24
25
  autoload :Worker, 'specjour/worker'
25
26
 
26
- VERSION = "0.1.15".freeze
27
+ VERSION = "0.1.16".freeze
27
28
 
28
29
  class Error < StandardError; end
29
30
 
@@ -40,8 +41,4 @@ module Specjour
40
41
  def self.log?
41
42
  logger.level != Logger::UNKNOWN
42
43
  end
43
-
44
- def self.ip_from_hostname(hostname)
45
- Socket.getaddrinfo(hostname, nil, Socket::AF_INET, Socket::SOCK_STREAM).first.fetch(3)
46
- end
47
44
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 15
9
- version: 0.1.15
8
+ - 16
9
+ version: 0.1.16
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sandro Turriate
@@ -100,6 +100,7 @@ files:
100
100
  - lib/specjour/printer.rb
101
101
  - lib/specjour/protocol.rb
102
102
  - lib/specjour/rsync_daemon.rb
103
+ - lib/specjour/socket_helpers.rb
103
104
  - lib/specjour/tasks/dispatch.rake
104
105
  - lib/specjour/tasks/specjour.rb
105
106
  - lib/specjour/worker.rb