Updated dependencies and code for new Crystal version.

master
Luka Vandervelden 2019-10-19 18:08:34 +02:00
parent 1c87371196
commit 3c20783f91
4 changed files with 11 additions and 11 deletions

View File

@ -11,7 +11,7 @@ require "./service/*"
args = [] of String
parser = OptionParser.parse! do |parser|
parser = OptionParser.parse do |parser|
parser.banner = "usage: service <command> [options]\n" +
"\n" +
"commands:\n" +
@ -132,7 +132,7 @@ begin
child = Process.run "#{OWN_LIBEXEC_DIR}/status", [args[1]],
output: Process::Redirect::Inherit,
error: Process::Redirect::Inherit
return_value = child.exit_status / 256
return_value = (child.exit_status / 256).to_i
# Errors not registered here should probably be verbose in `status`.
if return_value == 1

View File

@ -1,4 +1,4 @@
require "specfileparser"
require "specparser"
class Environment
enum Type
@ -21,7 +21,7 @@ class Environment
directory: "/srv/${ENVIRONMENT}"
end
def initialize(specs : SpecFileParser)
def initialize(specs : SpecParser)
assignments = specs.assignments
@name = assignments["name"].as_s
@ -46,7 +46,7 @@ class Environment
file_path = "#{path}/#{child}"
begin
environment = Environment.new SpecFileParser.parse(file_path).not_nil!
environment = Environment.new SpecParser.parse(file_path).not_nil!
rescue e
STDERR << "error loading #{file_path}: " << e << "\n"
# FIXME: Print stacktrace? Debug mode?

View File

@ -43,7 +43,7 @@ class Service
end
end
def initialize(specs : SpecFileParser)
def initialize(specs : SpecParser)
assignments = specs.assignments
@reference = ServiceDefinition.get assignments["name"].as_s
@ -302,7 +302,7 @@ class Service
end
begin
specs = SpecFileParser.parse("#{path}/#{child}").not_nil!
specs = SpecParser.parse("#{path}/#{child}").not_nil!
rescue
next
end

View File

@ -1,5 +1,5 @@
require "yaml"
require "specfileparser"
require "specparser"
class ServiceDefinition
struct Consumes
@ -26,7 +26,7 @@ class ServiceDefinition
def initialize(@name, @command, @file = nil, @directory = nil)
end
def initialize(section : SpecFileParser::Section)
def initialize(section : SpecParser::Section)
@name = section.content["name"].as_s
@file = section.content["file"]?.try &.as_s
@directory = section.content["directory"]?.try &.as_s
@ -47,7 +47,7 @@ class ServiceDefinition
getter checks : Array(Checks)
getter provides : Array(Provides)
def initialize(specs : SpecFileParser)
def initialize(specs : SpecParser)
sections = specs.sections
specs = specs.assignments
@name = specs["name"].as_s
@ -64,7 +64,7 @@ class ServiceDefinition
def self.load(path)
Dir.each_child path do |child|
if child.match /\.spec$/
@@all << ServiceDefinition.new SpecFileParser.parse("#{path}/#{child}").not_nil!
@@all << ServiceDefinition.new SpecParser.parse("#{path}/#{child}").not_nil!
else
next
end