Skip to content

Commit

Permalink
Move packages to internal
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammedikinci committed Feb 10, 2024
1 parent 4495655 commit 854e39c
Show file tree
Hide file tree
Showing 21 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cmd/cli/cmd/apply.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
pin "github.com/muhammedikinci/pin/pkg"
"github.com/muhammedikinci/pin/internal/runner"
"github.com/spf13/cobra"
)

Expand All @@ -19,7 +19,7 @@ Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
pin.Apply(pipelineName, pipelineFilePath)
runner.Apply(pipelineFilePath)
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/go-connections/nat"
"github.com/fatih/color"
"github.com/muhammedikinci/pin/pkg/interfaces"
"github.com/muhammedikinci/pin/internal/interfaces"
)

type containerManager struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/docker/docker/api/types/container"
"github.com/golang/mock/gomock"
"github.com/muhammedikinci/pin/pkg/mocks"
"github.com/muhammedikinci/pin/internal/mocks"
"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/docker/docker/api/types"
"github.com/fatih/color"
"github.com/muhammedikinci/pin/pkg/interfaces"
"github.com/muhammedikinci/pin/internal/interfaces"
)

func NewImageManager(cli interfaces.Client, log interfaces.Log) imageManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/docker/docker/api/types"
"github.com/golang/mock/gomock"
"github.com/muhammedikinci/pin/pkg/mocks"
"github.com/muhammedikinci/pin/internal/mocks"
"github.com/stretchr/testify/assert"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions pkg/apply.go → internal/runner/apply.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pin
package runner

import (
"bytes"
Expand All @@ -10,7 +10,7 @@ import (
"github.com/spf13/viper"
)

func Apply(name string, filepath string) error {
func Apply(filepath string) error {
if err := checkFileExists(filepath); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/job.go → internal/runner/job.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package pin
package runner

import (
"log"

"github.com/docker/docker/api/types/container"
"github.com/muhammedikinci/pin/pkg/interfaces"
"github.com/muhammedikinci/pin/internal/interfaces"
)

type Job struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/parser.go → internal/runner/parser.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pin
package runner

import (
"errors"
Expand Down
15 changes: 7 additions & 8 deletions pkg/runner.go → internal/runner/runner.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package pin
package runner

import (
"archive/tar"
"context"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/signal"
Expand All @@ -17,10 +16,10 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/fatih/color"
"github.com/muhammedikinci/pin/pkg/container_manager"
"github.com/muhammedikinci/pin/pkg/image_manager"
"github.com/muhammedikinci/pin/pkg/interfaces"
"github.com/muhammedikinci/pin/pkg/shell_commander"
"github.com/muhammedikinci/pin/internal/container_manager"
"github.com/muhammedikinci/pin/internal/image_manager"
"github.com/muhammedikinci/pin/internal/interfaces"
"github.com/muhammedikinci/pin/internal/shell_commander"
)

type Runner struct {
Expand Down Expand Up @@ -212,7 +211,7 @@ func (r Runner) commandRunner(command string, name string, currentJob Job) error
if reader, _, err := r.cli.CopyFromContainer(r.ctx, currentJob.Container.ID, "/shell_command_output.log"); err == nil {
tr := tar.NewReader(reader)
tr.Next()
b, _ := ioutil.ReadAll(tr)
b, _ := io.ReadAll(tr)
fmt.Println("\n" + string(b))
}
color.Unset()
Expand All @@ -235,7 +234,7 @@ func (r Runner) commandRunner(command string, name string, currentJob Job) error
if reader, _, err := r.cli.CopyFromContainer(r.ctx, currentJob.Container.ID, "/shell_command_output.log"); err == nil {
tr := tar.NewReader(reader)
tr.Next()
b, _ := ioutil.ReadAll(tr)
b, _ := io.ReadAll(tr)

if len(b) != 0 {
color.Set(color.FgGreen)
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 854e39c

Please sign in to comment.