mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-07 13:33:32 +02:00
update gitter room
This commit is contained in:
+2
-1
@@ -6,4 +6,5 @@ src/github.com/mgutz/
|
|||||||
src/github.com/op/
|
src/github.com/op/
|
||||||
src/gopkg.in/
|
src/gopkg.in/
|
||||||
jira
|
jira
|
||||||
jira.exe
|
jira.exe
|
||||||
|
schemas/*.json
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[](https://gitter.im/go-jira-cli/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)
|
[](https://gitter.im/go-jira-cli/help?utm_source=badge&utm_medium=badge&utm_content=badge)
|
||||||
|
|
||||||
# go-jira
|
# go-jira
|
||||||
simple command line client for Atlassian's Jira service written in Go
|
simple command line client for Atlassian's Jira service written in Go
|
||||||
|
|||||||
+25
-1
@@ -2,9 +2,12 @@ package jira
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/howeyc/gopass"
|
"github.com/howeyc/gopass"
|
||||||
|
"github.com/Netflix-Skunkworks/go-jira/data"
|
||||||
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@@ -261,8 +264,29 @@ func (c *Cli) CmdComponents(project string) error {
|
|||||||
return runTemplate(c.getTemplate("components"), data, nil)
|
return runTemplate(c.getTemplate("components"), data, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Cli) ValidTransitions(issue string) (jiradata.Transitions,error) {
|
||||||
|
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/transitions?expand=transitions.fields", c.endpoint, issue)
|
||||||
|
resp, err := c.get(uri)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
transMeta := &jiradata.TransitionsMeta{}
|
||||||
|
content, err := ioutil.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = json.Unmarshal(content, transMeta)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return transMeta.Transitions, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Cli) CmdTransitions(issue string) error {
|
func (c *Cli) CmdTransitions(issue string) error {
|
||||||
log.Debugf("Transitions called")
|
log.Debugf("Transitions called")
|
||||||
|
// FIXME this should just call ValidTransitions then pass that data to templates
|
||||||
c.Browse(issue)
|
c.Browse(issue)
|
||||||
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/transitions", c.endpoint, issue)
|
uri := fmt.Sprintf("%s/rest/api/2/issue/%s/transitions", c.endpoint, issue)
|
||||||
data, err := responseToJson(c.get(uri))
|
data, err := responseToJson(c.get(uri))
|
||||||
@@ -565,7 +589,7 @@ func (c *Cli) CmdTransition(issue string, trans string) error {
|
|||||||
}
|
}
|
||||||
if transId == "" {
|
if transId == "" {
|
||||||
err := fmt.Errorf("Invalid Transition '%s', Available: %s", trans, strings.Join(found, ", "))
|
err := fmt.Errorf("Invalid Transition '%s', Available: %s", trans, strings.Join(found, ", "))
|
||||||
log.Errorf("%s", err)
|
log.Debugf("%s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-1
@@ -371,7 +371,18 @@ Command Options:
|
|||||||
requireArgs(2)
|
requireArgs(2)
|
||||||
if err = c.CmdDups(args[0], args[1]); err == nil {
|
if err = c.CmdDups(args[0], args[1]); err == nil {
|
||||||
opts["resolution"] = "Duplicate"
|
opts["resolution"] = "Duplicate"
|
||||||
err = c.CmdTransition(args[0], "close")
|
trans, err := c.ValidTransitions(args[0])
|
||||||
|
if err == nil {
|
||||||
|
close := trans.Find("close")
|
||||||
|
if close != nil {
|
||||||
|
err = c.CmdTransition(args[0], "close")
|
||||||
|
} else {
|
||||||
|
// for now just assume if there is no "close", then
|
||||||
|
// there is a "done" state
|
||||||
|
err = c.CmdTransition(args[0], "done")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
case "watch":
|
case "watch":
|
||||||
requireArgs(1)
|
requireArgs(1)
|
||||||
|
|||||||
Executable
+21
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
from lxml import html
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
|
||||||
|
page = requests.get('https://docs.atlassian.com/jira/REST/cloud')
|
||||||
|
tree = html.fromstring(page.content)
|
||||||
|
|
||||||
|
schemas = tree.xpath("//div[@class='representation-doc-block']//code/text()")
|
||||||
|
|
||||||
|
for schema in schemas:
|
||||||
|
try:
|
||||||
|
data = json.loads(schema)
|
||||||
|
if "title" in data:
|
||||||
|
title = data["title"].replace(" ", "")
|
||||||
|
print "Writing {}.json".format(title)
|
||||||
|
with open("{}.json".format(title), 'w') as f:
|
||||||
|
f.write(schema)
|
||||||
|
except:
|
||||||
|
True
|
||||||
|
|
||||||
+5
-1
@@ -3,7 +3,7 @@ eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)"
|
|||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
jira="../jira --user admin"
|
jira="../jira --user admin"
|
||||||
|
|
||||||
PLAN 13
|
PLAN 14
|
||||||
|
|
||||||
# clean out any old containers
|
# clean out any old containers
|
||||||
RUNS sh -c "docker rm -f go-jira-test || true"
|
RUNS sh -c "docker rm -f go-jira-test || true"
|
||||||
@@ -42,3 +42,7 @@ RUNS $jira req -M POST /rest/api/2/project '{"key":"PROCESS","name":"Process","p
|
|||||||
RUNS $jira req -M POST /rest/api/2/project '{"key":"TASK","name":"Task","projectTypeKey":"business","projectTemplateKey":"com.atlassian.jira-core-project-templates:jira-core-task-management","lead":"gojira"}'
|
RUNS $jira req -M POST /rest/api/2/project '{"key":"TASK","name":"Task","projectTypeKey":"business","projectTemplateKey":"com.atlassian.jira-core-project-templates:jira-core-task-management","lead":"gojira"}'
|
||||||
|
|
||||||
RUNS $jira logout
|
RUNS $jira logout
|
||||||
|
|
||||||
|
# export new templates so we are always using whatever is latest
|
||||||
|
# and not whatever is in the test-runners homedir
|
||||||
|
RUNS $jira export-templates -d .jira.d/templates
|
||||||
|
|||||||
Reference in New Issue
Block a user