提交 498789a9 编写于 作者: J Jingwen Owen Ou

Change namespace to github/hub

上级 b9703e61
{
"ImportPath": "github.com/jingweno/gh",
"ImportPath": "github.com/github/hub",
"GoVersion": "go1.2",
"Packages": [
"./..."
......@@ -35,8 +35,8 @@
},
{
"ImportPath": "github.com/jingweno/go-octokit/octokit",
"Comment": "v0.4.0-46-g30737cb",
"Rev": "30737cb1e9207e1a7633e3d7539951c5c3d93058"
"Comment": "v0.4.0-49-gc08264b",
"Rev": "c08264b452c4a2960650be6bf0e33408c62c9bf1"
},
{
"ImportPath": "github.com/jtacoma/uritemplates",
......@@ -61,7 +61,7 @@
"Rev": "cb3f837f5ac26e080a9002dcb4d2e8472e623916"
},
{
"ImportPath": "https://github.com/ogier/pflag",
"ImportPath": "github.com/ogier/pflag",
"Rev": "fc2d9a0ef658fa4e4c319939fd6f4b6becfccb48"
}
]
......
......@@ -3,9 +3,9 @@ package octokit
import (
"github.com/lostisland/go-sawyer"
"github.com/lostisland/go-sawyer/hypermedia"
"io"
"net/http"
"net/url"
"os"
)
func NewClient(authMethod AuthMethod) *Client {
......@@ -70,21 +70,15 @@ func (c *Client) patch(url *url.URL, input interface{}, output interface{}) (res
})
}
func (c *Client) upload(uploadUrl *url.URL, asset *os.File, contentType string) (result *Result) {
func (c *Client) upload(uploadUrl *url.URL, asset io.ReadCloser, contentType string, contentLength int64) (result *Result) {
req, err := c.newSawyerRequest(uploadUrl.String())
if err != nil {
result = newResult(nil, err)
return
}
fi, err := asset.Stat()
if err != nil {
result = newResult(nil, err)
return
}
req.Header.Add("Content-Type", contentType)
req.ContentLength = fi.Size()
req.ContentLength = contentLength
req.Body = asset
sawyerResp := req.Post()
......
package octokit
import (
"io"
"net/url"
"os"
)
// Create an UploadsService with the base url.URL
......@@ -15,6 +15,6 @@ type UploadsService struct {
URL *url.URL
}
func (u *UploadsService) UploadAsset(asset *os.File, contentType string) (result *Result) {
return u.client.upload(u.URL, asset, contentType)
func (u *UploadsService) UploadAsset(asset io.ReadCloser, contentType string, contentLength int64) (result *Result) {
return u.client.upload(u.URL, asset, contentType, contentLength)
}
......@@ -33,7 +33,7 @@ func TestUploadsService_UploadAsset(t *testing.T) {
assert.Equal(t, nil, err)
open, _ := os.Open(file.Name())
result := client.Uploads(url).UploadAsset(open, "text/plain")
result := client.Uploads(url).UploadAsset(open, "text/plain", fi.Size())
fmt.Println(result)
assert.T(t, !result.HasError())
......
......@@ -2,7 +2,7 @@ package cmd
import (
"fmt"
"github.com/jingweno/gh/utils"
"github.com/github/hub/utils"
"github.com/kballard/go-shellquote"
"os"
"os/exec"
......
......@@ -2,7 +2,7 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/utils"
"github.com/github/hub/utils"
"os"
"path/filepath"
"strings"
......
......@@ -2,7 +2,7 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/cmd"
"github.com/github/hub/cmd"
"strings"
)
......
......@@ -2,8 +2,8 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"net/url"
"reflect"
"strings"
......
......@@ -2,8 +2,8 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"regexp"
)
......
package commands
import (
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"regexp"
)
......
......@@ -2,9 +2,9 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/git"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/git"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"os"
)
......
package commands
import (
"github.com/jingweno/gh/github"
"github.com/github/hub/github"
"regexp"
"strings"
)
......
......@@ -2,7 +2,7 @@ package commands
import (
"github.com/bmizerany/assert"
"github.com/jingweno/gh/github"
"github.com/github/hub/github"
"os"
"testing"
)
......
......@@ -5,8 +5,8 @@ import (
"regexp"
"strings"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
)
var cmdCompare = &Command{
......
......@@ -2,9 +2,9 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/git"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/git"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"regexp"
"strings"
)
......
package commands
import (
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"regexp"
"strings"
)
......
......@@ -2,8 +2,8 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"os"
"reflect"
)
......
package commands
import (
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
)
var cmdInit = &Command{
......
......@@ -2,7 +2,7 @@ package commands
import (
"github.com/bmizerany/assert"
"github.com/jingweno/gh/github"
"github.com/github/hub/github"
"os"
"regexp"
"testing"
......
......@@ -2,8 +2,9 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
)
var (
......
......@@ -2,8 +2,8 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"regexp"
)
......
......@@ -2,9 +2,9 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/git"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/git"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"reflect"
"regexp"
"strings"
......
......@@ -2,7 +2,7 @@ package commands
import (
"github.com/bmizerany/assert"
"github.com/jingweno/gh/github"
"github.com/github/hub/github"
"testing"
)
......
package commands
import (
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"strings"
)
......
......@@ -3,8 +3,8 @@ package commands
import (
"bytes"
"fmt"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"github.com/jingweno/go-octokit/octokit"
"io"
"net/http"
......
......@@ -2,8 +2,8 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"regexp"
)
......
......@@ -2,7 +2,7 @@ package commands
import (
"github.com/bmizerany/assert"
"github.com/jingweno/gh/github"
"github.com/github/hub/github"
"os"
"regexp"
"testing"
......
......@@ -2,9 +2,9 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/cmd"
"github.com/jingweno/gh/git"
"github.com/jingweno/gh/utils"
"github.com/github/hub/cmd"
"github.com/github/hub/git"
"github.com/github/hub/utils"
"github.com/kballard/go-shellquote"
flag "github.com/ogier/pflag"
"os"
......
......@@ -2,7 +2,7 @@ package commands
import (
"github.com/bmizerany/assert"
"github.com/jingweno/gh/github"
"github.com/github/hub/github"
"testing"
)
......
package commands
import (
"github.com/jingweno/gh/utils"
"github.com/github/hub/utils"
"os"
)
......
......@@ -3,10 +3,10 @@ package commands
import (
"archive/zip"
"fmt"
"github.com/github/hub/git"
"github.com/github/hub/github"
"github.com/github/hub/utils"
goupdate "github.com/inconshreveable/go-update"
"github.com/jingweno/gh/git"
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"io"
"io/ioutil"
"math/rand"
......
......@@ -3,7 +3,7 @@ package commands
import (
"fmt"
"github.com/bmizerany/assert"
"github.com/jingweno/gh/git"
"github.com/github/hub/git"
"io"
"io/ioutil"
"net/http"
......
package commands
import (
"github.com/jingweno/gh/github"
"github.com/jingweno/gh/utils"
"github.com/github/hub/github"
"github.com/github/hub/utils"
"github.com/jingweno/go-octokit/octokit"
"io/ioutil"
"os"
......
......@@ -2,8 +2,8 @@ package commands
import (
"fmt"
"github.com/jingweno/gh/git"
"github.com/jingweno/gh/utils"
"github.com/github/hub/git"
"github.com/github/hub/utils"
"os"
)
......
......@@ -2,11 +2,12 @@ package git
import (
"fmt"
"github.com/jingweno/gh/cmd"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/github/hub/cmd"
)
func Version() (string, error) {
......
......@@ -2,7 +2,7 @@ package github
import (
"fmt"
"github.com/jingweno/gh/git"
"github.com/github/hub/git"
"regexp"
"strings"
)
......
......@@ -2,11 +2,12 @@ package github
import (
"fmt"
"github.com/jingweno/go-octokit/octokit"
"net/http"
"net/url"
"os"
"strings"
"github.com/jingweno/go-octokit/octokit"
)
const (
......@@ -157,7 +158,12 @@ func (client *Client) CreateRelease(project *Project, params octokit.ReleasePara
func (client *Client) UploadReleaseAsset(uploadUrl *url.URL, asset *os.File, contentType string) (err error) {
c := client.octokit()
result := c.Uploads(uploadUrl).UploadAsset(asset, contentType)
fileInfo, err := asset.Stat()
if err != nil {
return
}
result := c.Uploads(uploadUrl).UploadAsset(asset, contentType, fileInfo.Size())
if result.HasError() {
err = fmt.Errorf("Error uploading asset: %s", result.Err)
}
......
......@@ -3,8 +3,8 @@ package github
import (
"encoding/json"
"fmt"
"github.com/github/hub/utils"
"github.com/howeyc/gopass"
"github.com/jingweno/gh/utils"
"io"
"io/ioutil"
"os"
......
......@@ -4,8 +4,8 @@ import (
"bytes"
"errors"
"fmt"
"github.com/jingweno/gh/git"
"github.com/jingweno/gh/utils"
"github.com/github/hub/git"
"github.com/github/hub/utils"
"os"
"reflect"
"runtime"
......
......@@ -2,7 +2,7 @@ package github
import (
"github.com/bmizerany/assert"
"github.com/jingweno/gh/git"
"github.com/github/hub/git"
"testing"
)
......
......@@ -11,8 +11,8 @@ import (
"regexp"
"strings"
"github.com/jingweno/gh/cmd"
"github.com/jingweno/gh/git"
"github.com/github/hub/cmd"
"github.com/github/hub/git"
)
func NewEditor(topic, message string) (editor *Editor, err error) {
......
......@@ -2,7 +2,7 @@ package github
import (
"fmt"
"github.com/jingweno/gh/git"
"github.com/github/hub/git"
"os"
"strings"
)
......
......@@ -2,7 +2,7 @@ package github
import (
"fmt"
"github.com/jingweno/gh/git"
"github.com/github/hub/git"
)
func LocalRepo() *GitHubRepo {
......
......@@ -3,8 +3,8 @@ package github
import (
"errors"
"fmt"
"github.com/jingweno/gh/git"
"github.com/jingweno/gh/utils"
"github.com/github/hub/git"
"github.com/github/hub/utils"
"net/url"
"os"
"regexp"
......
......@@ -2,7 +2,7 @@ package github
import (
"fmt"
"github.com/jingweno/gh/git"
"github.com/github/hub/git"
"net/url"
"regexp"
"strings"
......
package main
import (
"github.com/jingweno/gh/commands"
"github.com/jingweno/gh/github"
"github.com/github/hub/commands"
"github.com/github/hub/github"
"os"
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册