Skip to content

Commit

Permalink
make mermerd publishable
Browse files Browse the repository at this point in the history
  • Loading branch information
KarnerTh committed Apr 15, 2022
1 parent db349dc commit 99e9a30
Show file tree
Hide file tree
Showing 29 changed files with 161 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish module
run: make publish-package
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
GIT_TAG := $(shell git describe --tags `git rev-list --tags --max-count=1`)
test_target := "./..."

.PHONY: test-coverage
Expand All @@ -19,3 +20,6 @@ test-all:
test-unit:
go test --short $(test_target) -cover -json | tparse -all

.PHONY: publish-package
publish-package:
echo GOPROXY=proxy.golang.org go list -m github.com/KarnerTh/mermerd@$(GIT_TAG)
7 changes: 4 additions & 3 deletions analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package analyzer

import (
"errors"
"mermerd/config"
"mermerd/database"
"mermerd/util"

"github.com/KarnerTh/mermerd/config"
"github.com/KarnerTh/mermerd/database"
"github.com/KarnerTh/mermerd/util"
)

type analyzer struct {
Expand Down
7 changes: 4 additions & 3 deletions analyzer/analyzer_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package analyzer

import (
"github.com/stretchr/testify/assert"
"mermerd/database"
"mermerd/mocks"
"testing"

"github.com/KarnerTh/mermerd/database"
"github.com/KarnerTh/mermerd/mocks"
"github.com/stretchr/testify/assert"
)

func getAnalyzerWithMocks() (Analyzer, *mocks.MermerdConfig, *mocks.ConnectorFactory, *mocks.Questioner) {
Expand Down
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (after version 0.0.5).

## [0.1.0] - 2022-04-15
### Added
- Mermerd is available via the go tools

### Changed
- go 1.18 is now used

### Fixed
- MySQL query fix for constraints ([Issue #7](https://github.com/KarnerTh/mermerd/issues/7))

## [0.0.5] - 2022-03-17
### Added
- New config: allow surrounding output with mermerd backticks ([PR #4](https://github.com/KarnerTh/mermerd/pull/4))
Expand Down Expand Up @@ -45,6 +55,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (after version 0.0
### Added
- Initial release of mermerd

[0.1.0]: https://github.com/KarnerTh/mermerd/releases/tag/v0.1.0

[0.0.5]: https://github.com/KarnerTh/mermerd/releases/tag/v0.0.5

[0.0.4]: https://github.com/KarnerTh/mermerd/releases/tag/v0.0.4
Expand Down
13 changes: 7 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package cmd

import (
"fmt"
"github.com/fatih/color"
"mermerd/analyzer"
"mermerd/config"
"mermerd/database"
"mermerd/diagram"
"mermerd/util"
"os"

"github.com/fatih/color"
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/KarnerTh/mermerd/analyzer"
"github.com/KarnerTh/mermerd/config"
"github.com/KarnerTh/mermerd/database"
"github.com/KarnerTh/mermerd/diagram"
"github.com/KarnerTh/mermerd/util"
)

var runConfig string
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"fmt"
"github.com/spf13/viper"

"github.com/spf13/cobra"
"github.com/spf13/viper"
)

var versionCmd = &cobra.Command{
Expand Down
4 changes: 1 addition & 3 deletions database/connector.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package database

import (
"database/sql"
)
import "database/sql"

type baseConnector struct {
dbType DbType
Expand Down
3 changes: 2 additions & 1 deletion database/connector_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package database

import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestNewConnector(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion database/database_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package database

import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestDatabaseIntegrations(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions database/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package database
import (
"database/sql"
"fmt"

_ "github.com/go-sql-driver/mysql"
)

Expand Down
1 change: 1 addition & 0 deletions database/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package database
import (
"database/sql"
"fmt"

_ "github.com/jackc/pgx/v4/stdlib"
)

Expand Down
3 changes: 2 additions & 1 deletion database/result_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package database

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestConstraintResultList_AppendIfNotExists(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion database/type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package database

import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestDbType_String(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion database/value_sanitizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package database

import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestSanitizeValue(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions diagram/diagram.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package diagram
import (
"bufio"
"fmt"
"mermerd/config"
"mermerd/database"
"os"
"strings"

"github.com/KarnerTh/mermerd/config"
"github.com/KarnerTh/mermerd/database"
)

const (
Expand Down
6 changes: 4 additions & 2 deletions diagram/diagram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package diagram

import (
"fmt"
"github.com/stretchr/testify/assert"
"mermerd/database"
"testing"

"github.com/stretchr/testify/assert"

"github.com/KarnerTh/mermerd/database"
)

func TestGetRelation(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module mermerd
module github.com/KarnerTh/mermerd

go 1.17
go 1.18

require (
github.com/AlecAivazis/survey/v2 v2.3.2
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package main

import (
"github.com/spf13/viper"
"mermerd/cmd"

"github.com/KarnerTh/mermerd/cmd"
)

// ldflags flags from goreleaser
Expand Down
93 changes: 90 additions & 3 deletions mocks/Analyzer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions mocks/Connector.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions mocks/ConnectorFactory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mocks/Diagram.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/LoadingSpinner.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/MermerdConfig.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/Questioner.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 99e9a30

Please sign in to comment.