Skip to content

Commit

Permalink
Merge pull request #5 from tadashi-aikawa/0.5.1
Browse files Browse the repository at this point in the history
0.5.1
  • Loading branch information
tadashi-aikawa committed Nov 27, 2018
2 parents 1243d24 + c5914cf commit e7e5a5f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ release: clean-package ## Build and upload packages, regarding branch name as ve
git add args.go
git commit -m ':package: Version $(version)'

@echo '4. Tags'
git tag v$(version) -m v$(version)

@echo '5. Push'
@echo '4. Push'
git push

@echo '6. Deploy package'
@echo '5. Deploy package'
ghr v$(version) dist/

@echo 'Success All!!'
Expand Down
2 changes: 1 addition & 1 deletion args.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/pkg/errors"
)

const version = "0.5.0"
const version = "0.5.1"
const usage = `Gowl.
Usage:
Expand Down
17 changes: 14 additions & 3 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
survey "gopkg.in/AlecAivazis/survey.v1"
)

const gowlSite = "gowl.site"

func toSelection(r Repository) string {
return fmt.Sprintf("*%-5v %-45v %-10v %v", r.Star, r.FullName, r.Language, r.License)
}
Expand Down Expand Up @@ -163,6 +165,9 @@ func CmdGet(handler IHandler, root string, force bool, shallow bool, recursive b
dst := filepath.Join(root, handler.GetPrefix(), repo.FullName)
if _, err := os.Stat(dst); os.IsNotExist(err) {
clone(cloneURL, dst, shallow, recursive)
if err := execCommand(&dst, "git", "config", gowlSite, repo.SiteURL); err != nil {
return errors.Wrap(err, "Fail to config gowl.site "+repo.SiteURL)
}
if handler.GetOverrideUser() {
if err := configureUser(dst, handler.GetUserName(), handler.GetMailAddress()); err != nil {
return errors.Wrap(err, "Fail to configure "+dst)
Expand All @@ -175,6 +180,9 @@ func CmdGet(handler IHandler, root string, force bool, shallow bool, recursive b
return errors.Wrap(err, "Fail to remove "+dst)
}
clone(cloneURL, dst, shallow, recursive)
if err := execCommand(&dst, "git", "config", gowlSite, repo.SiteURL); err != nil {
return errors.Wrap(err, "Fail to config gowl.site "+repo.SiteURL)
}
if handler.GetOverrideUser() {
if err := configureUser(dst, handler.GetUserName(), handler.GetMailAddress()); err != nil {
return errors.Wrap(err, "Fail to configure "+dst)
Expand Down Expand Up @@ -233,12 +241,15 @@ func CmdWeb(handler IHandler, root string, browser string) error {
return errors.Wrap(err, "Fail to select a repository.")
}

remoteURL, err := getCommandStdout(&selection, "git", "config", "--get", "remote.origin.url")
siteURL, err := getCommandStdout(&selection, "git", "config", "--get", "gowl.site")
if siteURL == "" {
return errors.Wrap(err, "Site URL is not set. [gowl.site in .git/config]")
}
if err != nil {
return errors.Wrap(err, "Fail to get remote origin URL")
return errors.Wrap(err, "Fail to get site URL")
}

if err := execCommand(nil, browser, remoteURL); err != nil {
if err := execCommand(nil, browser, siteURL); err != nil {
return errors.Wrap(err, fmt.Sprintf("Fail to open repository %v", selection))
}

Expand Down
3 changes: 3 additions & 0 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Repository struct {
FullName string
SSHCloneURL string
HTTPCloneURL string
SiteURL string
Language string
License string
Star int
Expand All @@ -25,6 +26,7 @@ func (r *Repository) fromGithub(gr *github.Repository) *Repository {
FullName: gr.GetFullName(),
SSHCloneURL: gr.GetSSHURL(),
HTTPCloneURL: gr.GetCloneURL(),
SiteURL: gr.GetHTMLURL(),
Language: gr.GetLanguage(),
License: gr.GetLicense().GetName(),
Star: gr.GetStargazersCount(),
Expand All @@ -48,6 +50,7 @@ func (r *Repository) fromBitbucketServer(bsr *BitbucketRepository) *Repository {
FullName: bsr.GetFullName(),
SSHCloneURL: sshURL,
HTTPCloneURL: httpURL,
SiteURL: bsr.Links.Self[0].Href,
Language: "UNKNOWN",
License: "No License",
Star: 0,
Expand Down

0 comments on commit e7e5a5f

Please sign in to comment.