Skip to content

Commit

Permalink
Move pkg top-level
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Luzzardi <[email protected]>
  • Loading branch information
aluzzardi committed Nov 30, 2018
1 parent 550e24c commit c339ab5
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 25 deletions.
4 changes: 2 additions & 2 deletions pkg/builder/builder.go → builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"io/ioutil"
"os/exec"

"github.com/blocklayerhq/chainkit/pkg/project"
"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/project"
"github.com/blocklayerhq/chainkit/ui"
)

// Builder is a wrapper around `docker build` which provides a better UX.
Expand Down
2 changes: 1 addition & 1 deletion pkg/builder/parser.go → builder/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"

"github.com/acarl005/stripansi"
"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/ui"
"github.com/schollz/progressbar"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package cmd
import (
"context"

"github.com/blocklayerhq/chainkit/pkg/builder"
"github.com/blocklayerhq/chainkit/pkg/project"
"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/builder"
"github.com/blocklayerhq/chainkit/project"
"github.com/blocklayerhq/chainkit/ui"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cmd
import (
"context"

"github.com/blocklayerhq/chainkit/pkg/project"
"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/project"
"github.com/blocklayerhq/chainkit/ui"
"github.com/spf13/cobra"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"strings"
"text/template"

"github.com/blocklayerhq/chainkit/pkg/builder"
"github.com/blocklayerhq/chainkit/pkg/httpfs"
"github.com/blocklayerhq/chainkit/pkg/project"
"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/builder"
"github.com/blocklayerhq/chainkit/httpfs"
"github.com/blocklayerhq/chainkit/project"
"github.com/blocklayerhq/chainkit/templates"
"github.com/blocklayerhq/chainkit/ui"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path"
"path/filepath"

"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/ui"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"path"

"github.com/blocklayerhq/chainkit/pkg/project"
"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/project"
"github.com/blocklayerhq/chainkit/ui"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/ui"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
)
Expand Down
22 changes: 15 additions & 7 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cmd
import (
"context"
"fmt"
"io/ioutil"
"path"

"github.com/blocklayerhq/chainkit/pkg/discovery"
"github.com/blocklayerhq/chainkit/pkg/project"
"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/discovery"
"github.com/blocklayerhq/chainkit/project"
"github.com/blocklayerhq/chainkit/ui"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -70,21 +71,28 @@ func start(p *project.Project, join string) {
ui.Verbose("IPFS Swarm announcing %s", addr)
}

genesisPath := path.Join(p.RootDir, "data", fmt.Sprintf("%sd", p.Name), "config", "genesis.json")

// Start a network.
if join == "" {
genesis := path.Join(p.RootDir, "data", fmt.Sprintf("%sd", p.Name), "config", "genesis.json")
chainID, err := s.Announce(ctx, genesis)
chainID, err := s.Announce(ctx, genesisPath)
if err != nil {
ui.Fatal("%v", err)
}
ui.Success("Network is live at: %v", chainID)
} else {
ui.Info("Joining network %s", join)
genesis, peerCh, err := s.Join(ctx, join)
genesisData, peerCh, err := s.Join(ctx, join)
if err != nil {
ui.Fatal("%v", err)
}
ui.Info("Genesis: %s", genesis)

ui.Success("Retrieved genesis data")

if err := ioutil.WriteFile(genesisPath, genesisData, 0644); err != nil {
ui.Fatal("Unable to write genesis file: %v", err)
}

peer := <-peerCh
ui.Info("Peer: %v", peer.Addrs)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path/filepath"
"strings"

"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/ui"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/discovery/discovery.go → discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sort"
"time"

"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/blocklayerhq/chainkit/ui"
"github.com/ipsn/go-ipfs/core"
"github.com/ipsn/go-ipfs/core/coreapi"
iface "github.com/ipsn/go-ipfs/core/coreapi/interface"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c339ab5

Please sign in to comment.