Skip to content

Commit

Permalink
Rename project from httpway to pipehub
Browse files Browse the repository at this point in the history
  • Loading branch information
diegobernardes committed Mar 8, 2019
1 parent bd6affb commit 7f68cae
Show file tree
Hide file tree
Showing 23 changed files with 73 additions and 73 deletions.
6 changes: 3 additions & 3 deletions .gitignore
@@ -1,11 +1,11 @@
# bin
/cmd/httpway/main
/cmd/httpway/httpway
/cmd/pipehub/main
/cmd/pipehub/pipehub

# temporary files
/bin
/test.cover
/cmd/httpway/httpway.hcl
/cmd/pipehub/pipehub.hcl

# generated files
/go.mod.backup
Expand Down
10 changes: 5 additions & 5 deletions Makefile
@@ -1,7 +1,7 @@
PROJECT_PATH = /opt/httpway
DOCKER_CI_IMAGE = registry.gitlab.com/httpway/httpway/ci
PROJECT_PATH = /opt/pipehub
DOCKER_CI_IMAGE = registry.gitlab.com/pipehub/pipehub/ci
DOCKER_CI_VERSION = 1
CONFIG_PATH ?= $(CURDIR)/cmd/httpway/httpway.hcl
CONFIG_PATH ?= $(CURDIR)/cmd/pipehub/pipehub.hcl
WORKSPACE_PATH = $(CURDIR)

configure:
Expand All @@ -10,12 +10,12 @@ configure:
@git config branch.master.mergeoptions "--ff-only"

build:
@go build -tags "$(TAGS)" -o cmd/httpway/httpway cmd/httpway/*.go
@go build -tags "$(TAGS)" -o cmd/pipehub/pipehub cmd/pipehub/*.go

generate:
@rm -f handler_dynamic.go
@make build
@./cmd/httpway/httpway generate -c $(CONFIG_PATH) -w $(WORKSPACE_PATH)
@./cmd/pipehub/pipehub generate -c $(CONFIG_PATH) -w $(WORKSPACE_PATH)
@TAGS=handler make build

pre-pr: go-test go-linter go-linter-vendor docker-linter
Expand Down
10 changes: 5 additions & 5 deletions client.go
@@ -1,4 +1,4 @@
package httpway
package pipehub

import (
"context"
Expand Down Expand Up @@ -54,22 +54,22 @@ type ClientConfigHost struct {
Handler string
}

// Client is httpway entrypoint.
// Client is pipehub entrypoint.
type Client struct {
cfg ClientConfig
server *server
handlerManager *handlerManager
}

// Start httpway.
// Start pipehub.
func (c *Client) Start() error {
if err := c.server.start(); err != nil {
return errors.Wrap(err, "server start error")
}
return nil
}

// Stop the httpway.
// Stop the pipehub.
func (c *Client) Stop(ctx context.Context) error {
if err := c.server.stop(ctx); err != nil {
return errors.Wrap(err, "server stop error")
Expand Down Expand Up @@ -97,7 +97,7 @@ func (c *Client) init(cfg ClientConfig) error {
return nil
}

// NewClient return a configured httpway client.
// NewClient return a configured pipehub client.
func NewClient(cfg ClientConfig) (Client, error) {
var c Client
if err := c.init(cfg); err != nil {
Expand Down
28 changes: 14 additions & 14 deletions cmd/httpway/main.go → cmd/pipehub/main.go
Expand Up @@ -8,16 +8,16 @@ import (
"github.com/spf13/afero"
"github.com/spf13/cobra"

"github.com/httpway/httpway"
"github.com/pipehub/pipehub"
)

var done = make(chan os.Signal, 1)

func main() {
var rootCmd = &cobra.Command{Use: "httpway"}
var rootCmd = &cobra.Command{Use: "pipehub"}
rootCmd.AddCommand(cmdStart(), cmdGenerate())
if err := rootCmd.Execute(); err != nil {
err = errors.Wrap(err, "httpway cli initialization error")
err = errors.Wrap(err, "pipehub cli initialization error")
fatal(err)
}
}
Expand All @@ -30,7 +30,7 @@ func cmdStart() *cobra.Command {
Long: `Start the application server.`,
Run: cmdStartRun(&configPath),
}
cmd.Flags().StringVarP(&configPath, "config", "c", "./httpway.hcl", "config file path")
cmd.Flags().StringVarP(&configPath, "config", "c", "./pipehub.hcl", "config file path")
return &cmd
}

Expand All @@ -51,30 +51,30 @@ func cmdStartRun(configPath *string) func(*cobra.Command, []string) {
ctxShutdown, ctxShutdownCancel := rawCfg.ctxShutdown()
defer ctxShutdownCancel()

c, err := httpway.NewClient(cfg)
c, err := pipehub.NewClient(cfg)
if err != nil {
err = errors.Wrap(err, "httpway new client error")
err = errors.Wrap(err, "pipehub new client error")
fatal(err)
}

if err := c.Start(); err != nil {
err = errors.Wrap(err, "httpway start error")
err = errors.Wrap(err, "pipehub start error")
fatal(err)
}

wait()

go func() {
<-ctxShutdown.Done()
fmt.Println("httpway did not gracefuly stopped")
fmt.Println("pipehub did not gracefuly stopped")
os.Exit(1)
}()

if err := c.Stop(ctxShutdown); err != nil {
err = errors.Wrap(err, "httpway stop error")
err = errors.Wrap(err, "pipehub stop error")
fatal(err)
}
fmt.Println("httpway stopped")
fmt.Println("pipehub stopped")
}
}

Expand All @@ -87,7 +87,7 @@ func cmdGenerate() *cobra.Command {
handlers defined at the configuration file.`,
Run: cmdGenerateRun(&configPath, &workspacePath),
}
cmd.Flags().StringVarP(&configPath, "config", "c", "./httpway.hcl", "config file path")
cmd.Flags().StringVarP(&configPath, "config", "c", "./pipehub.hcl", "config file path")
cmd.Flags().StringVarP(&workspacePath, "workspace", "w", "", "workspace path")
return &cmd
}
Expand All @@ -104,14 +104,14 @@ func cmdGenerateRun(configPath, workspacePath *string) func(*cobra.Command, []st
fs := afero.NewBasePathFs(afero.NewOsFs(), *workspacePath)
cfg.Filesystem = fs

g, err := httpway.NewGenerate(cfg)
g, err := pipehub.NewGenerate(cfg)
if err != nil {
err = errors.Wrap(err, "httpway generate initialization error")
err = errors.Wrap(err, "pipehub generate initialization error")
fatal(err)
}

if err = g.Do(); err != nil {
err = errors.Wrap(err, "httpway generate execute error")
err = errors.Wrap(err, "pipehub generate execute error")
fatal(err)
}
}
Expand Down
18 changes: 9 additions & 9 deletions cmd/httpway/httpway.go → cmd/pipehub/pipehub.go
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"

"github.com/httpway/httpway"
"github.com/pipehub/pipehub"
)

type config struct {
Expand All @@ -35,10 +35,10 @@ func (c config) valid() error {
return nil
}

func (c config) toGenerateConfig() httpway.GenerateConfig {
var cfg httpway.GenerateConfig
func (c config) toGenerateConfig() pipehub.GenerateConfig {
var cfg pipehub.GenerateConfig
for _, handler := range c.Handler {
cfg.Handler = append(cfg.Handler, httpway.GenerateConfigHandler{
cfg.Handler = append(cfg.Handler, pipehub.GenerateConfigHandler{
Alias: handler.Alias,
Path: handler.Path,
Version: handler.Version,
Expand All @@ -47,14 +47,14 @@ func (c config) toGenerateConfig() httpway.GenerateConfig {
return cfg
}

func (c config) toClientConfig() httpway.ClientConfig {
cfg := httpway.ClientConfig{
func (c config) toClientConfig() pipehub.ClientConfig {
cfg := pipehub.ClientConfig{
AsyncErrHandler: asyncErrHandler,
Host: make([]httpway.ClientConfigHost, 0, len(c.Host)),
Host: make([]pipehub.ClientConfigHost, 0, len(c.Host)),
}

for _, host := range c.Host {
cfg.Host = append(cfg.Host, httpway.ClientConfigHost{
cfg.Host = append(cfg.Host, pipehub.ClientConfigHost{
Endpoint: host.Endpoint,
Origin: host.Origin,
Handler: host.Handler,
Expand All @@ -68,7 +68,7 @@ func (c config) toClientConfig() httpway.ClientConfig {
}

if len(c.Server[0].HTTP) > 0 {
cfg.Server.HTTP = httpway.ClientConfigServerHTTP{
cfg.Server.HTTP = pipehub.ClientConfigServerHTTP{
Port: c.Server[0].HTTP[0].Port,
}
}
Expand Down
Expand Up @@ -18,7 +18,7 @@ host {
}

handler {
path = "github.com/httpway/handler"
path = "github.com/pipehub/handler"
version = "v0.5.1"
alias = "base"
}
28 changes: 14 additions & 14 deletions cmd/httpway/httpway_test.go → cmd/pipehub/pipehub_test.go
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/httpway/httpway"
"github.com/pipehub/pipehub"
)

func TestConfigValid(t *testing.T) {
Expand Down Expand Up @@ -83,12 +83,12 @@ func TestConfigToGenerateConfig(t *testing.T) {
tests := []struct {
name string
config config
expected []httpway.GenerateConfigHandler
expected []pipehub.GenerateConfigHandler
}{
{
"success #1",
config{},
[]httpway.GenerateConfigHandler{},
[]pipehub.GenerateConfigHandler{},
},
{
"success #2",
Expand All @@ -106,7 +106,7 @@ func TestConfigToGenerateConfig(t *testing.T) {
},
},
},
[]httpway.GenerateConfigHandler{
[]pipehub.GenerateConfigHandler{
{
Path: "path1",
Version: "version1",
Expand All @@ -133,17 +133,17 @@ func TestConfigToClientConfig(t *testing.T) {
tests := []struct {
name string
config config
expected httpway.ClientConfig
expected pipehub.ClientConfig
}{
{
"success #1",
config{
Host: []configHost{},
Server: []configServer{},
},
httpway.ClientConfig{
Host: []httpway.ClientConfigHost{},
Server: httpway.ClientConfigServer{},
pipehub.ClientConfig{
Host: []pipehub.ClientConfigHost{},
Server: pipehub.ClientConfigServer{},
},
},
{
Expand Down Expand Up @@ -177,8 +177,8 @@ func TestConfigToClientConfig(t *testing.T) {
},
},
},
httpway.ClientConfig{
Host: []httpway.ClientConfigHost{
pipehub.ClientConfig{
Host: []pipehub.ClientConfigHost{
{
Endpoint: "endpoint1",
Handler: "handler1",
Expand All @@ -190,11 +190,11 @@ func TestConfigToClientConfig(t *testing.T) {
Origin: "origin2",
},
},
Server: httpway.ClientConfigServer{
HTTP: httpway.ClientConfigServerHTTP{
Server: pipehub.ClientConfigServer{
HTTP: pipehub.ClientConfigServerHTTP{
Port: 80,
},
Action: httpway.ClientConfigServerAction{
Action: pipehub.ClientConfigServerAction{
NotFound: "notFound",
Panic: "panic",
},
Expand Down Expand Up @@ -282,7 +282,7 @@ func TestLoadConfig(t *testing.T) {
},
Handler: []configHandler{
{
Path: "github.com/httpway/handler",
Path: "github.com/pipehub/handler",
Version: "v0.5.1",
Alias: "base",
},
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -18,7 +18,7 @@ host {
}

handler {
path = "github.com/httpway/handler"
path = "github.com/pipehub/handler"
version = "v0.5.1"
alias = "base"
}
4 changes: 2 additions & 2 deletions generate.go
@@ -1,4 +1,4 @@
package httpway
package pipehub

import (
"io/ioutil"
Expand Down Expand Up @@ -171,7 +171,7 @@ func (g *Generate) doHandlerDynamic(content generateTemplateContent) error {
}

func (Generate) templateModCleanup(payload string) string {
i := strings.Index(payload, "// Code generated by httpway; DO NOT EDIT.")
i := strings.Index(payload, "// Code generated by pipehub; DO NOT EDIT.")
if i == -1 {
return payload
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
@@ -1,4 +1,4 @@
module github.com/httpway/httpway
module github.com/pipehub/pipehub

require (
github.com/go-chi/chi v4.0.2+incompatible
Expand Down
2 changes: 1 addition & 1 deletion handler.go
@@ -1,6 +1,6 @@
// +build !handler

package httpway
package pipehub

func fetchHandlers() ([]handler, error) {
return nil, nil
Expand Down
2 changes: 1 addition & 1 deletion handler_manager.go
@@ -1,4 +1,4 @@
package httpway
package pipehub

import (
"context"
Expand Down
4 changes: 2 additions & 2 deletions misc/gitlab/build.yml
@@ -1,4 +1,4 @@
build:httpway:
build:pipehub:
stage: build
script:
- go build -mod readonly -o bin/httpway/httpway cmd/httpway/*.go
- go build -mod readonly -o bin/pipehub/pipehub cmd/pipehub/*.go
2 changes: 1 addition & 1 deletion misc/gitlab/main.yml
@@ -1,4 +1,4 @@
image: registry.gitlab.com/httpway/httpway/ci:1
image: registry.gitlab.com/pipehub/pipehub/ci:1

stages:
- quality
Expand Down
2 changes: 1 addition & 1 deletion misc/golangci/golangci.toml
Expand Up @@ -31,7 +31,7 @@ enable = [
check-blank = true

[linters-settings.goimports]
local-prefixes = "github.com/httpway/httpway"
local-prefixes = "github.com/pipehub/pipehub"

[linters-settings.gocritic]
enabled-tags = [
Expand Down
2 changes: 1 addition & 1 deletion httpway.go → pipehub.go
@@ -1,4 +1,4 @@
package httpway
package pipehub

import (
"context"
Expand Down

0 comments on commit 7f68cae

Please sign in to comment.