From 69fa1bd559c299e067c6b02b5ff35234cd4e6e52 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 3 Apr 2017 08:56:16 -0400 Subject: [PATCH] Minor fixes in converter --- common/init-exporter.spec | 24 +++++++++++++++++++++--- converter/converter.go | 23 +++++++++++++---------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/common/init-exporter.spec b/common/init-exporter.spec index f8b45f7..753b7d6 100644 --- a/common/init-exporter.spec +++ b/common/init-exporter.spec @@ -43,7 +43,7 @@ Summary: Utility for exporting services described by Procfile to init system Name: init-exporter Version: 0.9.0 -Release: 0%{?dist} +Release: 1%{?dist} Group: Development/Tools License: MIT URL: https://github.com/funbox/init-exporter @@ -52,7 +52,7 @@ Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: golang >= 1.7 +BuildRequires: golang >= 1.8 Provides: upstart-exporter = %{version}-%{release} Provides: systemd-exporter = %{version}-%{release} @@ -66,6 +66,17 @@ Utility for exporting services described by Procfile to init system. ############################################################################### +%package converter + +Summary: Utility for converting procfiles from v1 to v2 format +Version: 0.1.1 +Release: 0%{?dist} + +%description converter +Utility for converting procfiles from v1 to v2 format. + +############################################################################### + %prep %setup -q @@ -111,13 +122,20 @@ rm -rf %{buildroot} %dir %{_logdir}/%{name} %dir %{_localstatedir}/local/%{name}/helpers %{_bindir}/init-exporter -%{_bindir}/init-exporter-converter %{_bindir}/upstart-export %{_bindir}/systemd-export +%files converter +%defattr(-,root,root,-) +%{_bindir}/init-exporter-converter + ############################################################################### %changelog +* Mon Apr 03 2017 Anton Novojilov - 0.9.0-1 +- Format converter moved to separate package +- Minor fixes in format converter + * Fri Mar 31 2017 Anton Novojilov - 0.9.0-0 - Format support configuration feature - Pre and post commands support diff --git a/converter/converter.go b/converter/converter.go index f018127..2a18ead 100644 --- a/converter/converter.go +++ b/converter/converter.go @@ -26,7 +26,7 @@ import ( // App props const ( APP = "init-exporter-converter" - VER = "0.1.0" + VER = "0.2.0" DESC = "Utility for converting procfiles from v1 to v2 format" ) @@ -35,7 +35,6 @@ const ( // Supported arguments const ( ARG_CONFIG = "c:config" - ARG_APP_NAME = "n:appname" ARG_IN_PLACE = "i:in-place" ARG_NO_COLORS = "nc:no-colors" ARG_HELP = "h:help" @@ -102,7 +101,6 @@ type templateData struct { var argMap = arg.Map{ ARG_CONFIG: {}, - ARG_APP_NAME: {}, ARG_IN_PLACE: {Type: arg.BOOL}, ARG_NO_COLORS: {Type: arg.BOOL}, ARG_HELP: {Type: arg.BOOL}, @@ -147,10 +145,6 @@ func Init() { func process(file string) { var err error - if !arg.Has(ARG_APP_NAME) { - printErrorAndExit("Application name must be defined through -n/--appname argument") - } - if arg.Has(ARG_CONFIG) { err = knf.Global(arg.GetS(ARG_CONFIG)) @@ -168,10 +162,8 @@ func process(file string) { // convert read procfile in v1 format and print v2 data or save it to file func convert(file string) error { - fullAppName := knf.GetS(MAIN_PREFIX, "") + arg.GetS(ARG_APP_NAME) - config := &procfile.Config{ - Name: fullAppName, + Name: "", WorkingDir: knf.GetS(PATHS_WORKING_DIR, "/tmp"), IsRespawnEnabled: knf.GetB(DEFAULTS_RESPAWN, true), RespawnInterval: knf.GetI(DEFAULTS_RESPAWN_INTERVAL, 15), @@ -251,11 +243,22 @@ func printErrorAndExit(f string, a ...interface{}) { func showUsage() { info := usage.NewInfo("", "procfile") + info.AddOption(ARG_CONFIG, "Path to init-exporter config", "file") info.AddOption(ARG_IN_PLACE, "Edit procfile in place") info.AddOption(ARG_NO_COLORS, "Disable colors in output") info.AddOption(ARG_HELP, "Show this help message") info.AddOption(ARG_VERSION, "Show version") + info.AddExample( + "-i config/Procfile.production", + "Convert Procfile.production to version 2 in-place", + ) + + info.AddExample( + "config/Procfile.production -c /etc/init-exporter.conf Procfile.production", + "Convert Procfile.production to version 2 with defaults from init-exporter config and print result to console", + ) + info.Render() }