Skip to content

Commit

Permalink
Merge pull request #26 from funbox/develop
Browse files Browse the repository at this point in the history
Version 0.13.0
  • Loading branch information
andyone authored Apr 24, 2017
2 parents 763c900 + fc619b6 commit d36e5e3
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ init-exporter-converter:

deps:
go get -d -v pkg.re/check.v1
go get -d -v pkg.re/essentialkaos/ek.v7
go get -d -v pkg.re/essentialkaos/ek.v8
go get -d -v pkg.re/essentialkaos/go-simpleyaml.v1
go get -d -v pkg.re/yaml.v2

Expand Down
20 changes: 10 additions & 10 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import (
"os"
"runtime"

"pkg.re/essentialkaos/ek.v7/arg"
"pkg.re/essentialkaos/ek.v7/env"
"pkg.re/essentialkaos/ek.v7/fmtc"
"pkg.re/essentialkaos/ek.v7/fsutil"
"pkg.re/essentialkaos/ek.v7/knf"
"pkg.re/essentialkaos/ek.v7/log"
"pkg.re/essentialkaos/ek.v7/system"
"pkg.re/essentialkaos/ek.v7/usage"
"pkg.re/essentialkaos/ek.v7/usage/update"
"pkg.re/essentialkaos/ek.v8/arg"
"pkg.re/essentialkaos/ek.v8/env"
"pkg.re/essentialkaos/ek.v8/fmtc"
"pkg.re/essentialkaos/ek.v8/fsutil"
"pkg.re/essentialkaos/ek.v8/knf"
"pkg.re/essentialkaos/ek.v8/log"
"pkg.re/essentialkaos/ek.v8/system"
"pkg.re/essentialkaos/ek.v8/usage"
"pkg.re/essentialkaos/ek.v8/usage/update"

"github.com/funbox/init-exporter/export"
"github.com/funbox/init-exporter/procfile"
Expand All @@ -30,7 +30,7 @@ import (
// App props
const (
APP = "init-exporter"
VER = "0.12.3"
VER = "0.13.0"
DESC = "Utility for exporting services described by Procfile to init system"
)

Expand Down
8 changes: 6 additions & 2 deletions common/init-exporter.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

Summary: Utility for exporting services described by Procfile to init system
Name: init-exporter
Version: 0.12.3
Version: 0.13.0
Release: 0%{?dist}
Group: Development/Tools
License: MIT
Expand All @@ -69,7 +69,7 @@ Utility for exporting services described by Procfile to init system.
%package converter

Summary: Utility for converting procfiles from v1 to v2 format
Version: 0.4.0
Version: 0.5.0
Release: 0%{?dist}

%description converter
Expand Down Expand Up @@ -132,6 +132,10 @@ rm -rf %{buildroot}
###############################################################################

%changelog
* Mon Apr 24 2017 Anton Novojilov <[email protected]> - 0.13.0-0
- ek package updated to v8
- Improved v2 format validation

* Mon Apr 17 2017 Anton Novojilov <[email protected]> - 0.12.3-0
- Fixed typo in uninstall option name

Expand Down
10 changes: 5 additions & 5 deletions converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"runtime"
"text/template"

"pkg.re/essentialkaos/ek.v7/arg"
"pkg.re/essentialkaos/ek.v7/fmtc"
"pkg.re/essentialkaos/ek.v7/knf"
"pkg.re/essentialkaos/ek.v7/usage"
"pkg.re/essentialkaos/ek.v8/arg"
"pkg.re/essentialkaos/ek.v8/fmtc"
"pkg.re/essentialkaos/ek.v8/knf"
"pkg.re/essentialkaos/ek.v8/usage"

"github.com/funbox/init-exporter/procfile"
)
Expand All @@ -26,7 +26,7 @@ import (
// App props
const (
APP = "init-exporter-converter"
VER = "0.4.0"
VER = "0.5.0"
DESC = "Utility for converting procfiles from v1 to v2 format"
)

Expand Down
4 changes: 2 additions & 2 deletions export/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (

"github.com/funbox/init-exporter/procfile"

"pkg.re/essentialkaos/ek.v7/fsutil"
"pkg.re/essentialkaos/ek.v7/log"
"pkg.re/essentialkaos/ek.v8/fsutil"
"pkg.re/essentialkaos/ek.v8/log"

. "pkg.re/check.v1"
)
Expand Down
6 changes: 3 additions & 3 deletions export/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"io/ioutil"
"os"

"pkg.re/essentialkaos/ek.v7/fsutil"
"pkg.re/essentialkaos/ek.v7/log"
"pkg.re/essentialkaos/ek.v7/path"
"pkg.re/essentialkaos/ek.v8/fsutil"
"pkg.re/essentialkaos/ek.v8/log"
"pkg.re/essentialkaos/ek.v8/path"

"github.com/funbox/init-exporter/procfile"
)
Expand Down
2 changes: 1 addition & 1 deletion export/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"fmt"
"text/template"

"pkg.re/essentialkaos/ek.v7/log"
"pkg.re/essentialkaos/ek.v8/log"

"github.com/funbox/init-exporter/procfile"
)
Expand Down
8 changes: 4 additions & 4 deletions export/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"strings"
"time"

"pkg.re/essentialkaos/ek.v7/system"
"pkg.re/essentialkaos/ek.v7/timeutil"
"pkg.re/essentialkaos/ek.v8/system/exec"
"pkg.re/essentialkaos/ek.v8/timeutil"

"github.com/funbox/init-exporter/procfile"
)
Expand Down Expand Up @@ -123,12 +123,12 @@ func (sp *SystemdProvider) UnitName(name string) string {

// EnableService enable service with given name
func (sp *SystemdProvider) EnableService(appName string) error {
return system.Exec("systemctl", "enable", sp.UnitName(appName))
return exec.Run("systemctl", "enable", sp.UnitName(appName))
}

// DisableService disable service with given name
func (sp *SystemdProvider) DisableService(appName string) error {
return system.Exec("systemctl", "disable", sp.UnitName(appName))
return exec.Run("systemctl", "disable", sp.UnitName(appName))
}

// RenderAppTemplate render unit template data with given app data and return
Expand Down
2 changes: 1 addition & 1 deletion export/upstart.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"fmt"
"time"

"pkg.re/essentialkaos/ek.v7/timeutil"
"pkg.re/essentialkaos/ek.v8/timeutil"

"github.com/funbox/init-exporter/procfile"
)
Expand Down
16 changes: 9 additions & 7 deletions procfile/procfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"sort"
"strings"

"pkg.re/essentialkaos/ek.v7/errutil"
"pkg.re/essentialkaos/ek.v7/fsutil"
"pkg.re/essentialkaos/ek.v7/log"
"pkg.re/essentialkaos/ek.v7/path"
"pkg.re/essentialkaos/ek.v8/errutil"
"pkg.re/essentialkaos/ek.v8/fsutil"
"pkg.re/essentialkaos/ek.v8/log"
"pkg.re/essentialkaos/ek.v8/path"
)

// ////////////////////////////////////////////////////////////////////////////////// //
Expand All @@ -25,7 +25,7 @@ const (
REGEXP_V1_LINE = `^([A-z\d_]+):\s*(.+)`
REGEXP_V2_VERSION = `(?m)^\s*version:\s*2\s*$`
REGEXP_PATH_CHECK = `\A[A-Za-z0-9_\-./]+\z`
REGEXP_VALUE_CHECK = `\A[A-Za-z0-9_\-.,+/:;${}" =]+\z`
REGEXP_VALUE_CHECK = `\A[A-Za-z0-9_\-.,+/:;${}"' =]+\z`
)

// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down Expand Up @@ -455,8 +455,10 @@ func checkEnv(name, value string) error {
return fmt.Errorf("Environment variable %s has empty value", name)
}

if strings.Contains(value, " ") && !strings.Contains(value, "\"") {
return fmt.Errorf("Environment variable %s has unquoted value with spaces", name)
if strings.Contains(value, " ") {
if !strings.Contains(value, "\"") && !strings.Contains(value, "'") {
return fmt.Errorf("Environment variable %s has unquoted value with spaces", name)
}
}

if !regexp.MustCompile(REGEXP_VALUE_CHECK).MatchString(name) {
Expand Down
3 changes: 2 additions & 1 deletion procfile/procfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ func (s *ProcfileSuite) TestProcV2Parsing(c *C) {
c.Assert(service.Options.Env["RAILS_ENV"], Equals, "staging")
c.Assert(service.Options.Env["TEST"], Equals, "true")
c.Assert(service.Options.Env["JAVA_OPTS"], Equals, "\"${JAVA_OPTS} -Xms512m -Xmx1g -XX:+HeapDumpOnIutOfMemoryError -Djava.net.preferIPv4Stack=true\"")
c.Assert(service.Options.Env["AUX_OPTS"], Equals, "'--debug --native'")
c.Assert(service.Options.Env["QUEUE"], Equals, "log_syncronizer,file_downloader,log_searcher")
c.Assert(service.Options.Env["LC_ALL"], Equals, "en_US.UTF-8")
c.Assert(service.Options.EnvString(), Equals, "HEX_HOME=/srv/projects/ploy/shared/tmp JAVA_OPTS=\"${JAVA_OPTS} -Xms512m -Xmx1g -XX:+HeapDumpOnIutOfMemoryError -Djava.net.preferIPv4Stack=true\" LC_ALL=en_US.UTF-8 QUEUE=log_syncronizer,file_downloader,log_searcher RAILS_ENV=staging TEST=true")
c.Assert(service.Options.EnvString(), Equals, "AUX_OPTS='--debug --native' HEX_HOME=/srv/projects/ploy/shared/tmp JAVA_OPTS=\"${JAVA_OPTS} -Xms512m -Xmx1g -XX:+HeapDumpOnIutOfMemoryError -Djava.net.preferIPv4Stack=true\" LC_ALL=en_US.UTF-8 QUEUE=log_syncronizer,file_downloader,log_searcher RAILS_ENV=staging TEST=true")
c.Assert(service.Options.LimitFile, Equals, 4096)
c.Assert(service.Options.LimitProc, Equals, 4096)
c.Assert(service.Application, NotNil)
Expand Down
2 changes: 1 addition & 1 deletion procfile/procfile_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"regexp"
"strings"

"pkg.re/essentialkaos/ek.v7/log"
"pkg.re/essentialkaos/ek.v8/log"
)

// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion procfile/procfile_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package procfile
import (
"fmt"

"pkg.re/essentialkaos/ek.v7/log"
"pkg.re/essentialkaos/ek.v8/log"

"pkg.re/essentialkaos/go-simpleyaml.v1"
)
Expand Down
1 change: 1 addition & 0 deletions testdata/procfile_v2
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ commands:
env:
RAILS_ENV: staging # if needs to be redefined or extended
JAVA_OPTS: '"${JAVA_OPTS} -Xms512m -Xmx1g -XX:+HeapDumpOnIutOfMemoryError -Djava.net.preferIPv4Stack=true"'
AUX_OPTS: "'--debug --native'"
QUEUE: log_syncronizer,file_downloader,log_searcher
HEX_HOME: /srv/projects/ploy/shared/tmp
LC_ALL: "en_US.UTF-8"
Expand Down

0 comments on commit d36e5e3

Please sign in to comment.