Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
54262e66
H
hub
项目概览
github
/
hub
8 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
54262e66
编写于
1月 25, 2016
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Makefile galore!
上级
fc9fbd4c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
134 addition
and
23 deletion
+134
-23
.gitignore
.gitignore
+1
-0
.travis.yml
.travis.yml
+1
-1
CONTRIBUTING.md
CONTRIBUTING.md
+6
-12
Makefile
Makefile
+61
-0
script/build
script/build
+3
-10
script/format-ronn
script/format-ronn
+62
-0
未找到文件。
.gitignore
浏览文件 @
54262e66
...
...
@@ -5,6 +5,7 @@
vendor/bundle/
man/hub.1
man/hub.1.html
man/hub.1.txt
man/hub-*
tmp/
*.test
...
...
.travis.yml
浏览文件 @
54262e66
...
...
@@ -10,7 +10,7 @@ before_install:
language
:
go
go
:
-
1.5.1
script
:
script/test
script
:
make test-all
install
:
script/cached-bundle install --without development --deployment --jobs=3 --retry=3
after_success
:
script/publish-release
notifications
:
...
...
CONTRIBUTING.md
浏览文件 @
54262e66
...
...
@@ -29,27 +29,21 @@ feature is a good idea for hub if it improves some workflow for a GitHub user.
## How to install dependencies and run tests
These instructions assume that _you already have hub installed_ and aliased as
`git`
(see "Aliasing").
1.
Clone hub:
`git clone github/hub && cd hub`
1.
Install necessary development dependencies:
`script/bootstrap`
`git clone https://github.com/github/hub.git && cd hub`
2.
Verify that existing tests pass:
`
script/test
`
`
make test-all
`
3.
Create a topic branch:
`git checkout -b feature`
4.
**Make your changes.**
(It helps a lot if you write tests first.)
5.
Verify that tests still pass:
`script/test`
5.
Verify that the tests still pass.
6.
Fork hub on GitHub (adds a remote named "YOUR-USER"):
`
git
fork`
`
make && bin/hub
fork`
7.
Push to your fork:
`git push <YOUR-USER> HEAD`
`git push
-u
<YOUR-USER> HEAD`
8.
Open a pull request describing your changes:
`
git
pull-request`
`
bin/hub
pull-request`
## How to write tests
...
...
Makefile
0 → 100644
浏览文件 @
54262e66
SOURCES
=
$(
shell
script/build files
)
HELP_CMD
=
\
man/hub-alias.1
\
man/hub-browse.1
\
man/hub-ci-status.1
\
man/hub-compare.1
\
man/hub-create.1
\
man/hub-fork.1
\
man/hub-pull-request.1
\
HELP_EXT
=
\
man/hub-am.1
\
man/hub-apply.1
\
man/hub-checkout.1
\
man/hub-cherry-pick.1
\
man/hub-clone.1
\
man/hub-fetch.1
\
man/hub-init.1
\
man/hub-merge.1
\
man/hub-push.1
\
man/hub-remote.1
\
man/hub-submodule.1
\
HELP_ALL
=
man/hub.1
$(HELP_CMD)
$(HELP_EXT)
TEXT_WIDTH
=
87
.PHONY
:
clean test test-all man-pages
all
:
bin/hub
bin/hub
:
$(SOURCES)
script/build
-o
$@
test
:
script/build
test
test-all
:
bin/cucumber
script/test
bin/ronn bin/cucumber
:
script/bootstrap
man-pages
:
$(HELP_ALL:=.ronn) $(HELP_ALL) $(HELP_ALL:=.txt)
%.txt
:
%.ronn
groff
-Wall
-mtty-char
-mandoc
-Tutf8
-rLL
=
$(TEXT_WIDTH)
n
$<
| col
-b
>
$@
%.1
:
%.1.ronn bin/ronn
bin/ronn
--organization
=
GITHUB
--manual
=
"Hub Manual"
man/
*
.ronn
%.1.ronn
:
bin/hub
bin/hub
help
$
(
*
F
)
--plain-text
| script/format-ronn
$
(
*
F
)
$@
man/hub.1.ronn
:
true
clean
:
rm
-rf
bin/hub
git clean
-fdx
man/
script/build
浏览文件 @
54262e66
#!/usr/bin/env bash
# vi:ft=sh:
# Usage: script/build [-o <EXE>]
# script/build test
#
...
...
@@ -40,18 +41,10 @@ find_packages() {
find_source_files
|
cut
-
d
/
-
f2
|
sort
-
u
|
grep
-
v
'.go$'
|
sed
's!^!github.com/github/hub/!'
}
count_changed_files
()
{
printf
%
d
$
(
find_source_files
-
newer
"$1"
|
wc
-
l
)
}
up_to_date
()
{
[
-
e
"$1"
]
&&
[
"$(count_changed_files "
$
1
")"
-
eq
0
]
}
build_hub
()
{
setup_gopath
mkdir
-
p
"$(dirname "
$
1
")"
up_to_date
"$1"
||
go
build
-
ldflags
"-X github.com/github/hub/version.Version=`./script/version`"
-
o
"$1"
go
build
-
ldflags
"-X github.com/github/hub/version.Version=`./script/version`"
-
o
"$1"
}
test_hub
()
{
...
...
@@ -77,7 +70,7 @@ files )
find_source_files
;;
-
h
|
--
help
)
sed
-
ne
'/^#/!q;s/.\{1,2\}//;1d;p'
<
"$0"
sed
-
ne
'/^#/!q;s/.\{1,2\}//;1
,2
d;p'
<
"$0"
exit
;;
*
)
...
...
script/
ma
n
→
script/
format-ron
n
浏览文件 @
54262e66
#!/bin/bash
# Usage: script/
man [<COMMAND
>]
# Usage: script/
format-ronn <COMMAND> [<FILE
>]
#
#
Generate individual man pages from inline help text of hub commands
.
#
Transform inline text of hub commands to ronn-format(7)
.
set
-e
extensions
=
"
am
apply
checkout
cherry-pick
clone
fetch
init
merge
push
remote
submodule
"
commands
=
"
alias
browse
ci-status
compare
create
fork
pull-request
"
AWK
=
"
$(
type
-p
gawk
awk
|
head
-1
)
"
hub_help
()
{
bin/hub
help
"hub-
$1
"
--plain-text
|
sed
$'s/
\t
/ /g'
}
para
()
{
"
$AWK
"
-v
wants
=
$2
"
BEGIN { para=1 }
...
...
@@ -74,41 +46,17 @@ format_rest() {
'
}
generate
()
{
local
cmd
=
"
$1
"
local
text
=
"
$(
hub_help
"
$cmd
"
)
"
[
-n
"
$text
"
]
||
continue
{
echo
"hub-
${
cmd
}
(1) --
$(
para
==
2
<<<
"
$text
"
| format_shortdesc
)
"
echo
"==="
echo
echo
"## SYNOPSIS"
echo
para
==
1
<<<
"
$text
"
| format_synopsis
echo
para
'>='
3
<<<
"
$text
"
| format_rest
}
>
"man/hub-
${
cmd
}
.1.ronn"
}
man_desc
()
{
echo
" * hub-
${
1
}
(1):"
echo
"
$(
hub_help
"
$1
"
| para
==
2 | format_shortdesc
)
"
}
script/build
case
"
$1
"
in
--desc
)
for
cmd
in
$extensions
$commands
;
do
man_desc
"
$cmd
"
echo
done
;;
*
)
for
cmd
in
${
1
:-
$commands
$extensions
}
;
do
generate
"
$cmd
"
done
bin/ronn
--organization
=
GITHUB
--manual
=
"Hub Manual"
man/
*
.ronn
;;
esac
cmd
=
"
${
1
?
}
"
file
=
"
$2
"
text
=
"
$(
cat
- |
sed
$'s/
\t
/ /g'
)
"
[
-n
"
$text
"
]
||
exit
1
[
-z
"
$file
"
]
||
exec
1<
>
"
$file
"
echo
"
${
cmd
}
(1) --
$(
para
==
2
<<<
"
$text
"
| format_shortdesc
)
"
echo
"==="
echo
echo
"## SYNOPSIS"
echo
para
==
1
<<<
"
$text
"
| format_synopsis
echo
para
'>='
3
<<<
"
$text
"
| format_rest
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录