Skip to content

Commit

Permalink
feat(deps): add config (5.0.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfalkowski committed Nov 18, 2023
1 parent 9810746 commit 7a45a9c
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 78 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ gemspec
gem 'bundler'
gem 'coveralls_reborn'
gem 'rubocop'
gem 'solargraph'
87 changes: 49 additions & 38 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
PATH
remote: .
specs:
nonnative (1.74.1)
nonnative (1.75.0)
concurrent-ruby (~> 1.0, >= 1.0.5)
config (~> 5.0)
cucumber (>= 7, < 10)
get_process_mem (~> 0.2.1)
grpc (>= 1, < 2)
Expand All @@ -16,13 +17,14 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
backport (1.2.0)
benchmark (0.3.0)
benchmark-malloc (0.2.0)
benchmark-perf (0.6.0)
benchmark-trend (0.4.0)
builder (3.2.4)
concurrent-ruby (1.2.2)
config (5.0.0)
deep_merge (~> 1.2, >= 1.2.1)
dry-validation (~> 1.0, >= 1.0.0)
coveralls_reborn (0.28.0)
simplecov (~> 0.22.0)
term-ansicolor (~> 1.7)
Expand Down Expand Up @@ -52,28 +54,63 @@ GEM
cucumber-messages (>= 18.0, < 22.1)
cucumber-messages (22.0.0)
cucumber-tag-expressions (5.0.6)
deep_merge (1.2.2)
diff-lcs (1.5.0)
docile (1.4.0)
domain_name (0.6.20231109)
e2mmap (0.1.0)
dry-configurable (1.1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-inflector (1.0.0)
dry-initializer (3.1.1)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-schema (1.13.3)
concurrent-ruby (~> 1.0)
dry-configurable (~> 1.0, >= 1.0.1)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-logic (>= 1.4, < 2)
dry-types (>= 1.7, < 2)
zeitwerk (~> 2.6)
dry-types (1.7.1)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
dry-validation (1.10.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-schema (>= 1.12, < 2)
zeitwerk (~> 2.6)
ffi (1.16.3)
get_process_mem (0.2.7)
ffi (~> 1.0)
google-protobuf (3.25.0-x86_64-darwin)
google-protobuf (3.25.1-arm64-darwin)
google-protobuf (3.25.1-x86_64-darwin)
google-protobuf (3.25.1-x86_64-linux)
googleapis-common-protos-types (1.10.0)
google-protobuf (~> 3.18)
grpc (1.59.2)
google-protobuf (~> 3.24)
googleapis-common-protos-types (~> 1.0)
grpc (1.59.2-x86_64-darwin)
google-protobuf (~> 3.24)
googleapis-common-protos-types (~> 1.0)
grpc (1.59.2-x86_64-linux)
google-protobuf (~> 3.24)
googleapis-common-protos-types (~> 1.0)
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
jaro_winkler (1.5.6)
json (2.6.3)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
mime-types (3.5.1)
mime-types-data (~> 3.2015)
Expand All @@ -83,13 +120,7 @@ GEM
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
netrc (0.11.0)
nio4r (2.5.9)
nokogiri (1.15.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
nio4r (2.6.0)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
Expand All @@ -101,15 +132,12 @@ GEM
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rainbow (3.1.1)
rbs (2.8.4)
regexp_parser (2.8.2)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
reverse_markdown (2.1.1)
nokogiri
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand Down Expand Up @@ -155,22 +183,6 @@ GEM
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.1.0)
tilt (~> 2.0)
solargraph (0.49.0)
backport (~> 1.2)
benchmark
bundler (~> 2.0)
diff-lcs (~> 1.4)
e2mmap
jaro_winkler (~> 1.5)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
parser (~> 3.0)
rbs (~> 2.0)
reverse_markdown (~> 2.0)
rubocop (~> 1.38)
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
sync (0.5.0)
sys-uname (1.2.3)
ffi (~> 1.1)
Expand All @@ -181,7 +193,7 @@ GEM
tins (1.32.1)
sync
unicode-display_width (2.5.0)
yard (0.9.34)
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin-22
Expand All @@ -193,7 +205,6 @@ DEPENDENCIES
coveralls_reborn
nonnative!
rubocop
solargraph

BUNDLED WITH
2.3.9
5 changes: 5 additions & 0 deletions lib/nonnative.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
require 'puma'
require 'puma/server'
require 'concurrent'
require 'config'
require 'cucumber'
require 'get_process_mem'
require 'rspec-benchmark'
Expand Down Expand Up @@ -54,6 +55,10 @@ module Nonnative
class << self
attr_reader :pool

def configurations(*files)
Nonnative::Configuration.load_files(files)
end

def log_lines(path, predicate)
File.readlines(path).select { |l| predicate.call(l) }
end
Expand Down
80 changes: 43 additions & 37 deletions lib/nonnative/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

module Nonnative
class Configuration
class << self
def load_files(*files)
Config.load_files(files)
end
end

def initialize
@processes = []
@servers = []
Expand All @@ -11,11 +17,11 @@ def initialize
attr_accessor :processes, :servers, :services

def load_file(path)
file = YAML.load_file(path)
cfg = self.class.load_files(path)

add_processes(file)
add_servers(file)
add_services(file)
add_processes(cfg)
add_servers(cfg)
add_services(cfg)
end

def process
Expand Down Expand Up @@ -48,59 +54,59 @@ def process_by_name(name)

private

def add_processes(file)
processes = file['processes'] || []
def add_processes(cfg)
processes = cfg.processes || []
processes.each do |fd|
process do |d|
d.name = fd['name']
d.name = fd.name
d.command = command(fd)
d.timeout = fd['timeout']
d.port = fd['port']
d.log = fd['log']
d.signal = fd['signal']
d.environment = fd['environment']
d.timeout = fd.timeout
d.port = fd.port
d.log = fd.log
d.signal = fd.signal
d.environment = fd.environment

proxy d, fd['proxy']
proxy d, fd.proxy
end
end
end

def command(process)
go = process['go']
go = process.go
if go
params = go['parameters'] || []
tools = go['tools'] || []
params = go.parameters || []
tools = go.tools || []

-> { Nonnative.go_executable(tools, go['output'], go['executable'], go['command'], *params) }
-> { Nonnative.go_executable(tools, go.output, go.executable, go.command, *params) }
else
-> { process['command'] }
-> { process.command }
end
end

def add_servers(file)
servers = file['servers'] || []
def add_servers(cfg)
servers = cfg.servers || []
servers.each do |fd|
server do |s|
s.name = fd['name']
s.klass = Object.const_get(fd['class'])
s.timeout = fd['timeout']
s.port = fd['port']
s.log = fd['log']
s.name = fd.name
s.klass = Object.const_get(fd.class)
s.timeout = fd.timeout
s.port = fd.port
s.log = fd.log

proxy s, fd['proxy']
proxy s, fd.proxy
end
end
end

def add_services(file)
services = file['services'] || []
def add_services(cfg)
services = cfg.services || []
services.each do |fd|
service do |s|
s.name = fd['name']
s.host = fd['host'] if fd['host']
s.port = fd['port']
s.name = fd.name
s.host = fd.host if fd.host
s.port = fd.port

proxy s, fd['proxy']
proxy s, fd.proxy
end
end
end
Expand All @@ -109,13 +115,13 @@ def proxy(runner, proxy)
return unless proxy

p = {
kind: proxy['kind'],
port: proxy['port'],
log: proxy['log'],
options: proxy['options']
kind: proxy.kind,
port: proxy.port,
log: proxy.log,
options: proxy.options
}

p[:host] = proxy['host'] if proxy['host']
p[:host] = proxy.host if proxy.host

runner.proxy = p
end
Expand Down
2 changes: 1 addition & 1 deletion lib/nonnative/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def process_kill
end

def process_spawn
environment = service.environment || {}
environment = service.environment.to_h
environment = environment.transform_keys(&:to_s).transform_values(&:to_s)

environment.each_key do |k|
Expand Down
2 changes: 1 addition & 1 deletion lib/nonnative/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Nonnative
VERSION = '1.74.1'
VERSION = '1.75.0'
end
1 change: 1 addition & 0 deletions nonnative.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
spec.metadata['rubygems_mfa_required'] = 'true'

spec.add_dependency 'concurrent-ruby', '~> 1.0', '>= 1.0.5'
spec.add_dependency 'config', '~> 5.0'
spec.add_dependency 'cucumber', '>= 7', '< 10'
spec.add_dependency 'get_process_mem', '~> 0.2.1'
spec.add_dependency 'grpc', ['>= 1', '< 2']
Expand Down

0 comments on commit 7a45a9c

Please sign in to comment.