Skip to content

Commit 467fa8d

Browse files
committed
close #185 auth for jira
1 parent 0eafe5b commit 467fa8d

File tree

11 files changed

+60
-174
lines changed

11 files changed

+60
-174
lines changed

ci/CHANGELOG.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
## Changelog
2-
The new release of git-phlow adds support for windows in _beta_. Overall improvements have been made to increase stability and remove
3-
various bugs and odd behaviours.
2+
git phlow have had a _huge_ makeover in this release. Configuration have been introduced, and git phlow now works by reading
3+
configuration from a .phlow file, instead of guessing your remote and integration branch. This also brings support for new services like Jira and bitbucket.
4+
The underlying git implementation have been stabilized and is now up and running on windows, so do not feel cheated anymore.
45

56
#### Features
6-
- Windows is now support in a pre-release version
7-
- Add Less and More browsing #150 @groenborg
8-
- Add no-color option for windows #148 @kryptag
7+
- Auth for jira #185 @groenborg
8+
git phlow can now authorize against Jira using the right configuration. See [docs](docs/README.md)
9+
10+
- phlow as configuration #192 @groenborg
11+
git phlow now works based on a .phlow config file
912

1013
#### Improvements
11-
- Use Scanner in stead of buffered Reader #149 @groenborg
12-
- Add windows binary to GitHub release #151 @groenborg
13-
- Added windows worker to concourse ci #144
14+
- git for windows is stabilized
1415

1516
#### Bug fixes
16-
- Colors are buggy when terminal width is changed #131 @groenborg
17-
- username and password are no longer printed #158 @groenborg
18-
- version was stuck at 1.0.0 #167 @groenborg
19-
- Windows release is now zip and not tar.gz #169 @groenborg
17+
- pull when setting up workspace #193 @lakruzz
18+

ci/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
- get: tollgate
77
trigger: true
88
- get: gp-version
9-
params: {bump: patch}
9+
params: {bump: major}
1010
- put: gp-version
1111
params: {file: gp-version/version}
1212
- task: integration

ci/test/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ go install github.com/onsi/ginkgo/ginkgo
1414

1515

1616
# run tests
17-
go test -v ./...
17+
ginkgo -v -r -trace -cover
1818

1919

2020

ci/windows/go-test-windows.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ cd $env:GOPATH/src/github.com/praqma/git-phlow
1212
go get -d -t -v ./...
1313

1414
#RUN TESTS
15-
cd executor
16-
go test -p 1 -v
15+
go test -v ./...
1716

1817
# USES THE LATEST EXITCODE, WHICH IS FROM GO TEST, AND EXITS WITH THAT. THIS FIXIS
1918
# ISSUE #152

githandler/git.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (os *Git) Config(argv ...string) (string, error) {
8484
return strings.Replace(stdOut, "\n", "", -1), nil
8585
}
8686

87-
//DEPRECATESD SECTION ---------------------------------------------------------------
87+
//Deprecated
8888
//FormatPatch ...
8989
//dry runs patch to see if we can auto merge
9090
func FormatPatch(buf *bytes.Buffer, remoteBranch string) (err error) {
@@ -95,6 +95,7 @@ func FormatPatch(buf *bytes.Buffer, remoteBranch string) (err error) {
9595
return
9696
}
9797

98+
//Deprecated
9899
//StatusPorcelain ...
99100
//generates behind and ahead status
100101
func StatusPorcelain() (string, error) {
@@ -105,6 +106,7 @@ func StatusPorcelain() (string, error) {
105106
return strings.TrimSpace(out), nil
106107
}
107108

109+
//Deprecated
108110
//PushRename ...
109111
func PushRename(branch, defaultBranch string) (string, error) {
110112
remote := ConfigBranchRemote(defaultBranch)

phlow/issues_test.go

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,26 @@ var _ = Describe("Issue", func() {
1313
Describe("GetPager on windows", func() {
1414
Context("with pager set", func() {
1515
It("should return testpager", func() {
16-
EXPECTED := "testpager"
16+
if runtime.GOOS == "windows" {
17+
EXPECTED := "testpager"
1718

18-
err := os.Setenv("PAGER", "testpager")
19-
ACTUAL := phlow.GetPager()
19+
err := os.Setenv("PAGER", "testpager")
20+
ACTUAL := phlow.GetPager()
2021

21-
Ω(ACTUAL).Should(Equal(EXPECTED))
22-
Ω(err).Should(BeNil())
22+
Ω(ACTUAL).Should(Equal(EXPECTED))
23+
Ω(err).Should(BeNil())
24+
}
2325
})
2426
})
2527

2628
Context("with pager unset", func() {
2729
It("should return more", func() {
28-
err := os.Unsetenv("PAGER")
30+
if runtime.GOOS == "windows" {
31+
err := os.Unsetenv("PAGER")
2932

30-
ACTUAL := phlow.GetPager()
31-
EXPECTED := "more"
33+
ACTUAL := phlow.GetPager()
34+
EXPECTED := "more"
3235

33-
if runtime.GOOS == "windows" {
3436
Ω(ACTUAL).Should(Equal(EXPECTED))
3537
Ω(err).Should(BeNil())
3638
}
@@ -44,26 +46,29 @@ var _ = Describe("Issue", func() {
4446
Describe("GetPager on Unix", func() {
4547
Context("with pager set", func() {
4648
It("Should return less", func() {
47-
EXPECTED := "less"
49+
if runtime.GOOS != "windows" {
50+
EXPECTED := "less"
4851

49-
err := os.Setenv("PAGER", "less")
50-
ACTUAL := phlow.GetPager()
52+
err := os.Setenv("PAGER", "less")
53+
ACTUAL := phlow.GetPager()
5154

52-
Ω(ACTUAL).Should(Equal(EXPECTED))
53-
Ω(err).Should(BeNil())
55+
Ω(ACTUAL).Should(Equal(EXPECTED))
56+
Ω(err).Should(BeNil())
57+
}
5458
})
5559
})
5660

5761
Context("with pager unset", func() {
5862
It("Should return nothing", func() {
59-
err := os.Unsetenv("PAGER")
60-
61-
ACTUAL := phlow.GetPager()
62-
EXPECTED := ""
63+
if runtime.GOOS != "windows" {
64+
err := os.Unsetenv("PAGER")
6365

64-
Ω(ACTUAL).Should(Equal(EXPECTED))
65-
Ω(err).Should(BeNil())
66+
ACTUAL := phlow.GetPager()
67+
EXPECTED := ""
6668

69+
Ω(ACTUAL).Should(Equal(EXPECTED))
70+
Ω(err).Should(BeNil())
71+
}
6772
})
6873
})
6974

phlow/mkalias.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ package phlow
33
import (
44
"fmt"
55
"github.com/praqma/git-phlow/ui"
6-
"github.com/praqma/git-phlow/setting"
6+
"github.com/praqma/git-phlow/githandler"
7+
"github.com/praqma/git-phlow/executor"
78
)
89

910
//MakeAliasCaller ...
1011
func MakeAliasCaller() {
11-
MakeAlias(setting.GitConfig{})
12+
MakeAlias()
1213
}
1314

1415
//MakeAlias ...
15-
func MakeAlias(conf setting.Configurator) {
16+
func MakeAlias() {
17+
git := githandler.Git{Run: executor.RunGit}
1618
aliases := make(map[string]string)
1719
aliases["alias.wrapup"] = "phlow wrapup"
1820
aliases["alias.workon"] = "phlow workon"
@@ -23,10 +25,10 @@ func MakeAlias(conf setting.Configurator) {
2325

2426
for group, value := range aliases {
2527

26-
str := conf.Get(group)
28+
str, _ := git.Config("--global", "--get", group)
2729
if str == "" {
2830
fmt.Printf("Creating alias %s \n", ui.Format.Alias(group))
29-
conf.Set(group, value)
31+
git.Config("--global", group, value)
3032
} else {
3133
fmt.Printf("Alias %s already exists \n", ui.Format.Alias(group))
3234
}

plugins/gh.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"github.com/praqma/git-phlow/githandler"
1414
"github.com/praqma/git-phlow/options"
15-
"github.com/praqma/git-phlow/setting"
15+
"github.com/praqma/git-phlow/executor"
1616
)
1717

1818
var GitHub *GitHubImpl
@@ -27,6 +27,7 @@ type GitHubImpl struct {
2727
token string
2828
}
2929

30+
//Deprecated - This need to be redone to fit configuration - refer to: AuthorizeGitHub and AuthenticateGitHub they are changed to work the new way
3031
//init ...
3132
//creates a new GitHub request object with all the gh api urls
3233
func init() {
@@ -40,12 +41,12 @@ func init() {
4041
userRepo: "/user/repos",
4142
}
4243

43-
stg := setting.NewToolStg()
44-
44+
git := githandler.Git{Run: executor.RunGit}
45+
t, _ := git.Config("--get", "phlow.token")
4546
info, _ := githandler.Remote()
4647
org := info.Organisation
4748
repo := info.Repository
48-
token := stg.Token
49+
token := t
4950

5051
GitHub = &GitHubImpl{
5152
urls,
@@ -110,9 +111,6 @@ func AuthenticateGitHub(githubBaseURL string, user, token string) (bool, error)
110111
return true, nil
111112
}
112113

113-
114-
// ------------------------------------------ DEPRECATE SECTION
115-
116114
//GetIssues ...
117115
func (g *GitHubImpl) GetIssues() (issues []Issue, err error) {
118116
URL := fmt.Sprintf(g.URLNoEsc(urls.issueURL), g.org, g.repo)
@@ -156,7 +154,6 @@ func (g *GitHubImpl) SetLabel(label string, issue int) (labels []Label, err erro
156154
return re, nil
157155
}
158156

159-
160157
//Default ...
161158
//Get default branch of a GitHub issue
162159
func (g *GitHubImpl) Default() (defaultBranch string, err error) {
@@ -228,6 +225,7 @@ func createGHPermissions() (string, error) {
228225
return string(b2b), nil
229226
}
230227

228+
//Deprecated
231229
//Auth ...
232230
//Auth request to gh
233231
func (g *GitHubImpl) Auth(user, pass string) (token string, err error) {
@@ -253,6 +251,7 @@ func (g *GitHubImpl) Auth(user, pass string) (token string, err error) {
253251
return re.Token, nil
254252
}
255253

254+
//Deprecated
256255
//CheckAuth ...
257256
//Checks personal access token validity by requesting private repositories and checking status code
258257
func (g *GitHubImpl) CheckAuth() (bool, error) {

setting/config.go

Lines changed: 0 additions & 57 deletions
This file was deleted.

setting/config_test.go

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)