Skip to content

Commit

Permalink
Release 0.1.0 (#2)
Browse files Browse the repository at this point in the history
* Replace dep with go mod
* Move project to github
  • Loading branch information
noandrea committed Feb 8, 2019
1 parent 65e2a67 commit 133565a
Show file tree
Hide file tree
Showing 32 changed files with 280 additions and 386 deletions.
165 changes: 0 additions & 165 deletions Gopkg.lock

This file was deleted.

58 changes: 0 additions & 58 deletions Gopkg.toml

This file was deleted.

4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -4,7 +4,7 @@ GIT_DESCR = $(shell git describe --always)
# build output folder
OUTPUTFOLDER = dist
# docker image
DOCKER_IMAGE = registry.gitlab.com/welance/oss/distill
DOCKER_IMAGE = noandrea/distill
DOCKER_TAG = $(shell git describe --always)
# build paramters
OS = linux
Expand Down Expand Up @@ -67,4 +67,4 @@ docker-run:
@docker run -p 1804:1804 $(DOCKER_IMAGE)

debug-start:
@go run main.go -c configs/settings.sample.yaml --debug start
@go run main.go -c examples/settings.yaml --debug start
7 changes: 3 additions & 4 deletions README.md
@@ -1,10 +1,8 @@
# Distill
# Distill

Another url shortener

[![pipeline status](https://gitlab.com/welance/oss/distill/badges/develop/pipeline.svg)](https://gitlab.com/welance/oss/distill/commits/develop)

[![coverage report](https://gitlab.com/welance/oss/distill/badges/develop/coverage.svg)](https://gitlab.com/welance/oss/distill/commits/develop)
[![pipeline status](https://github.com/noandrea/distill/badges/develop/pipeline.svg)](https://github.com/noandrea/distill/commits/develop) [![coverage report](https://github.com/noandrea/distill/badges/develop/coverage.svg)](https://github.com/noandrea/distill/commits/develop) [![GoDoc](https://godoc.org/github.com/noandrea/distill?status.svg)](https://godoc.org/github.com/noandrea/distill) [![Go Report Card](https://goreportcard.com/badge/github.com/noandrea/distill)](https://goreportcard.com/report/github.com/noandrea/distill)

## Motivations

Expand All @@ -14,6 +12,7 @@ Existing url shorteners are not suitable for a private deploy use or are too com
that can be used for specific events.



## Features

- Choose the alphabet set for the generate short id
Expand Down
2 changes: 1 addition & 1 deletion api/model.colf
@@ -1,5 +1,5 @@
// Package demo offers a demonstration.
package distill
package urlstore

// URLInfo contains the data associated to an id
type URLInfo struct {
Expand Down
10 changes: 5 additions & 5 deletions build/ci/.gitlab-ci.yml
@@ -1,4 +1,4 @@
image: welance/build-golang:1.10
image: welance/build-golang:1.11

stages:
- test
Expand All @@ -9,13 +9,13 @@ variables:
DOCKER_HOST: docker

before_script:
- cd $GOPATH/src
- mkdir -p gitlab.com/$CI_PROJECT_NAMESPACE
- cd gitlab.com/$CI_PROJECT_NAMESPACE
# - cd $GOPATH/src
- mkdir -p /src/gitlab.com/$CI_PROJECT_NAMESPACE
- cd /src/gitlab.com/$CI_PROJECT_NAMESPACE
- ln -s $CI_PROJECT_DIR
- cd $CI_PROJECT_NAME
- echo -e "machine gitlab.com\nlogin gitlab-ci-token\npassword ${CI_JOB_TOKEN}" > ~/.netrc
- dep ensure -vendor-only
- go mod download

lint_code:
stage: test
Expand Down
9 changes: 5 additions & 4 deletions cmd/backup.go
Expand Up @@ -18,8 +18,9 @@ import (
"os"
"path/filepath"

"github.com/noandrea/distill/urlstore"

"github.com/jbrodriguez/mlog"
"gitlab.com/welance/oss/distill/internal/distill"

"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -55,8 +56,8 @@ func init() {
}

func backup(cmd *cobra.Command, args []string) {
distill.NewSession()
defer distill.CloseSession()
urlstore.NewSession()
defer urlstore.CloseSession()
abp, err := filepath.Abs(backupFile)
if err != nil {
mlog.Fatalf("Invalid path %s: %v", backupFile, err)
Expand All @@ -65,7 +66,7 @@ func backup(cmd *cobra.Command, args []string) {
if err != nil {
mlog.Fatalf("Error create backup path to %s: %v", backupFile, err)
}
if err = distill.Backup(abp); err != nil {
if err = urlstore.Backup(abp); err != nil {
mlog.Fatalf("Error create backup at %s: %v", backupFile, err)
}
}
9 changes: 5 additions & 4 deletions cmd/import.go
Expand Up @@ -18,9 +18,10 @@ import (
"os"
"path/filepath"

"github.com/noandrea/distill/urlstore"

"github.com/jbrodriguez/mlog"
"github.com/spf13/cobra"
"gitlab.com/welance/oss/distill/internal/distill"
)

// importCmd represents the import command
Expand Down Expand Up @@ -49,16 +50,16 @@ func init() {
}

func importCsv(cmd *cobra.Command, args []string) {
distill.NewSession()
defer distill.CloseSession()
urlstore.NewSession()
defer urlstore.CloseSession()
abp, err := filepath.Abs(csvFile)
if err != nil {
mlog.Fatalf("Invalid path %s: %v", csvFile, err)
}
if _, err = os.Stat(abp); os.IsNotExist(err) {
mlog.Fatalf("Invalid path %s: %v", csvFile, err)
}
if rows, err := distill.ImportCSV(abp); err != nil {
if rows, err := urlstore.ImportCSV(abp); err != nil {
mlog.Fatalf("Error create backup at %s: %v", csvFile, err)
} else {
mlog.Info("Import complete, %d url record loaded", rows)
Expand Down
9 changes: 5 additions & 4 deletions cmd/restore.go
Expand Up @@ -18,9 +18,10 @@ import (
"os"
"path/filepath"

"github.com/noandrea/distill/urlstore"

"github.com/jbrodriguez/mlog"
"github.com/spf13/cobra"
"gitlab.com/welance/oss/distill/internal/distill"
)

// restoreCmd represents the restore command
Expand All @@ -37,16 +38,16 @@ func init() {
}

func restore(cmd *cobra.Command, args []string) {
distill.NewSession()
defer distill.CloseSession()
urlstore.NewSession()
defer urlstore.CloseSession()
abp, err := filepath.Abs(backupFile)
if err != nil {
mlog.Fatalf("Invalid path %s: %v", backupFile, err)
}
if _, err := os.Stat(abp); os.IsNotExist(err) {
mlog.Fatalf("Invalid path %s: %v", csvFile, err)
}
if count, err := distill.Restore(abp); err != nil {
if count, err := urlstore.Restore(abp); err != nil {
mlog.Fatalf("Error restoring backup from %s: %v", backupFile, err)
} else {
mlog.Info("Restored %d URLs from %s ", count, backupFile)
Expand Down

0 comments on commit 133565a

Please sign in to comment.