Skip to content
This repository was archived by the owner on Jan 4, 2025. It is now read-only.

Commit e7e5a5f

Browse files
Merge pull request #5 from tadashi-aikawa/0.5.1
0.5.1
2 parents 1243d24 + c5914cf commit e7e5a5f

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

Makefile

+2-5
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,10 @@ release: clean-package ## Build and upload packages, regarding branch name as ve
4444
git add args.go
4545
git commit -m ':package: Version $(version)'
4646

47-
@echo '4. Tags'
48-
git tag v$(version) -m v$(version)
49-
50-
@echo '5. Push'
47+
@echo '4. Push'
5148
git push
5249

53-
@echo '6. Deploy package'
50+
@echo '5. Deploy package'
5451
ghr v$(version) dist/
5552

5653
@echo 'Success All!!'

args.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/pkg/errors"
66
)
77

8-
const version = "0.5.0"
8+
const version = "0.5.1"
99
const usage = `Gowl.
1010
1111
Usage:

command.go

+14-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
survey "gopkg.in/AlecAivazis/survey.v1"
1414
)
1515

16+
const gowlSite = "gowl.site"
17+
1618
func toSelection(r Repository) string {
1719
return fmt.Sprintf("*%-5v %-45v %-10v %v", r.Star, r.FullName, r.Language, r.License)
1820
}
@@ -163,6 +165,9 @@ func CmdGet(handler IHandler, root string, force bool, shallow bool, recursive b
163165
dst := filepath.Join(root, handler.GetPrefix(), repo.FullName)
164166
if _, err := os.Stat(dst); os.IsNotExist(err) {
165167
clone(cloneURL, dst, shallow, recursive)
168+
if err := execCommand(&dst, "git", "config", gowlSite, repo.SiteURL); err != nil {
169+
return errors.Wrap(err, "Fail to config gowl.site "+repo.SiteURL)
170+
}
166171
if handler.GetOverrideUser() {
167172
if err := configureUser(dst, handler.GetUserName(), handler.GetMailAddress()); err != nil {
168173
return errors.Wrap(err, "Fail to configure "+dst)
@@ -175,6 +180,9 @@ func CmdGet(handler IHandler, root string, force bool, shallow bool, recursive b
175180
return errors.Wrap(err, "Fail to remove "+dst)
176181
}
177182
clone(cloneURL, dst, shallow, recursive)
183+
if err := execCommand(&dst, "git", "config", gowlSite, repo.SiteURL); err != nil {
184+
return errors.Wrap(err, "Fail to config gowl.site "+repo.SiteURL)
185+
}
178186
if handler.GetOverrideUser() {
179187
if err := configureUser(dst, handler.GetUserName(), handler.GetMailAddress()); err != nil {
180188
return errors.Wrap(err, "Fail to configure "+dst)
@@ -233,12 +241,15 @@ func CmdWeb(handler IHandler, root string, browser string) error {
233241
return errors.Wrap(err, "Fail to select a repository.")
234242
}
235243

236-
remoteURL, err := getCommandStdout(&selection, "git", "config", "--get", "remote.origin.url")
244+
siteURL, err := getCommandStdout(&selection, "git", "config", "--get", "gowl.site")
245+
if siteURL == "" {
246+
return errors.Wrap(err, "Site URL is not set. [gowl.site in .git/config]")
247+
}
237248
if err != nil {
238-
return errors.Wrap(err, "Fail to get remote origin URL")
249+
return errors.Wrap(err, "Fail to get site URL")
239250
}
240251

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

handler.go

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Repository struct {
1515
FullName string
1616
SSHCloneURL string
1717
HTTPCloneURL string
18+
SiteURL string
1819
Language string
1920
License string
2021
Star int
@@ -25,6 +26,7 @@ func (r *Repository) fromGithub(gr *github.Repository) *Repository {
2526
FullName: gr.GetFullName(),
2627
SSHCloneURL: gr.GetSSHURL(),
2728
HTTPCloneURL: gr.GetCloneURL(),
29+
SiteURL: gr.GetHTMLURL(),
2830
Language: gr.GetLanguage(),
2931
License: gr.GetLicense().GetName(),
3032
Star: gr.GetStargazersCount(),
@@ -48,6 +50,7 @@ func (r *Repository) fromBitbucketServer(bsr *BitbucketRepository) *Repository {
4850
FullName: bsr.GetFullName(),
4951
SSHCloneURL: sshURL,
5052
HTTPCloneURL: httpURL,
53+
SiteURL: bsr.Links.Self[0].Href,
5154
Language: "UNKNOWN",
5255
License: "No License",
5356
Star: 0,

0 commit comments

Comments
 (0)