Skip to content

Commit

Permalink
refactor: move to correct place
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfalkowski committed May 14, 2021
1 parent a1ce724 commit 175833c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
2 changes: 0 additions & 2 deletions lib/nonnative/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ def add_services(file)
services.each do |fd|
service do |s|
s.name = fd['name']
s.timeout = fd['timeout']
s.port = fd['port']
s.log = fd['log']

proxy s, fd['proxy']
end
Expand Down
2 changes: 1 addition & 1 deletion lib/nonnative/configuration_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Nonnative
class ConfigurationProcess < ConfigurationRunner
attr_accessor :command, :signal
attr_accessor :command, :signal, :timeout, :log
end
end
2 changes: 1 addition & 1 deletion lib/nonnative/configuration_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Nonnative
class ConfigurationRunner
attr_accessor :name, :timeout, :port, :log
attr_accessor :name, :port
attr_reader :proxy

def initialize
Expand Down
2 changes: 1 addition & 1 deletion lib/nonnative/configuration_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Nonnative
class ConfigurationServer < ConfigurationRunner
attr_accessor :klass
attr_accessor :klass, :timeout, :log
end
end
8 changes: 7 additions & 1 deletion lib/nonnative/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

module Nonnative
class Process < Runner
def initialize(service)
super service

@timeout = Nonnative::Timeout.new(service.timeout)
end

def start
unless process_exists?
proxy.start
Expand Down Expand Up @@ -32,7 +38,7 @@ def wait_stop

private

attr_reader :pid
attr_reader :pid, :timeout

def process_kill
signal = Signal.list[service.signal || 'INT'] || Signal.list['INT']
Expand Down
3 changes: 1 addition & 2 deletions lib/nonnative/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Runner

def initialize(service)
@service = service
@timeout = Nonnative::Timeout.new(service.timeout)
@proxy = Nonnative::ProxyFactory.create(service)
end

Expand All @@ -16,7 +15,7 @@ def name

protected

attr_reader :service, :timeout
attr_reader :service

def wait_start
sleep 0.1
Expand Down
8 changes: 7 additions & 1 deletion lib/nonnative/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

module Nonnative
class Server < Runner
def initialize(service)
super service

@timeout = Nonnative::Timeout.new(service.timeout)
end

def start
unless thread
proxy.start
Expand All @@ -28,6 +34,6 @@ def stop

private

attr_reader :thread
attr_reader :thread, :timeout
end
end

0 comments on commit 175833c

Please sign in to comment.