Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
d044e078
H
hub
项目概览
github
/
hub
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
d044e078
编写于
9月 09, 2014
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #605 from github/rubyless-docs
Remove Ruby-specific parts of docs in prep for move to Go
上级
78e124f0
83fcf6f2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
129 deletion
+6
-129
CONTRIBUTING.md
CONTRIBUTING.md
+5
-38
README.md
README.md
+1
-91
未找到文件。
CONTRIBUTING.md
浏览文件 @
d044e078
Contributing to hub
===================
<i>
**Warning:**
in the near future, hub might be implemented
[
entirely in Go instead of Ruby
](
https://github.com/github/hub/issues/475
)
.
Keep that in mind, and don't contribute big features/refactorings to
the Ruby codebase, as such pull requests will be unlikely to get accepted.
</i>
You will need:
1.
Ruby 1.8.7+
1.
Go 1.3
1.
Ruby 1.9+
2.
git 1.8+
3.
tmux & zsh (optional) - for running shell completion tests
## What makes a good hub feature
hub is a tool that wraps git to provide useful integration with GitHub. A new
feature is a good idea for hub
only if it relates to
*both git and GitHub*
.
feature is a good idea for hub
if it improves some workflow for a GitHub user
.
*
A feature that adds GitHub Issues management is
**not**
a good fit for hub
since it's not git-related. Please use
[
ghi
](
https://github.com/stephencelis/ghi
)
instead.
*
A feature that encapsulates a git workflow
*not specific*
to GitHub is
**not**
a good fit for hub, since something like that is best implemented as an
external script.
...
...
@@ -34,10 +27,8 @@ These instructions assume that _you already have hub installed_ and aliased as
1.
Clone hub:
`git clone github/hub && cd hub`
1.
Ensure Bundler is installed:
`which bundle || gem install bundler`
1.
Install development dependencies:
`bundle install`
1.
Install necessary development dependencies:
`script/bootstrap`
2.
Verify that existing tests pass:
`script/test`
3.
Create a topic branch:
...
...
@@ -53,32 +44,8 @@ These instructions assume that _you already have hub installed_ and aliased as
8.
Open a pull request describing your changes:
`git pull-request`
## How hub works
1.
[
Runner
](
lib/hub/runner.rb#files
)
handles the command-line invocation;
2.
[
Args
](
lib/hub/args.rb#files
)
wraps ARGV for easy access;
3.
[
Commands
](
lib/hub/commands.rb#files
)
dispatches each command to the
appropriate method, e.g.
`hub pull-request`
runs the
`pull_request`
method. Each method processes args as needed, using Context and GitHubAPI
in the process;
4.
[
Context
](
lib/hub/context.rb#files
)
handles inspecting the current
environment and git repository;
5.
[
GitHubAPI
](
lib/hub/github_api.rb#files
)
handles GitHub API authentication
and communication;
6.
And finally, Runner receives the resulting arguments to execute in the
shell by forwarding them to
`git`
.
## How to write tests
The old test suite for hub was written in test/unit and some legacy tests can
still be found in the
`test/`
directory. Unless you have a need for writing
super-isolated unit tests,
**do not add**
any more tests to this suite.
The new test suite is written in Cucumber under
`features/`
directory. Each
scenario is actually making real invocations to
`hub`
on the command-line in the
context of a real (dynamically created) git repository.
...
...
README.md
浏览文件 @
d044e078
...
...
@@ -21,7 +21,6 @@ Installation
Dependencies:
*
**git 1.7.3**
or newer
*
**Ruby 1.8.6**
or newer
### Homebrew
...
...
@@ -31,20 +30,6 @@ Installing on OS X is easiest with Homebrew:
$
brew
install
hub
~~~
### `rake install` from source
This is the preferred installation method when no package manager that
supports hub is available:
~~~
sh
# Download or clone the project from GitHub:
$
git clone git://github.com/github/hub.git
$
cd
hub
$
rake
install
~~~
On a Unix-based OS, this installs under
`PREFIX`
, which is
`/usr/local`
by default.
Now you should be ready to roll:
~~~
sh
...
...
@@ -53,77 +38,6 @@ git version 1.7.6
hub version 1.8.3
~~~
#### Windows "Git Bash" (msysGit) note
Avoid aliasing hub as
`git`
due to the fact that msysGit automatically
configures your prompt to include git information, and you want to avoid slowing
that down. See
[
Is your shell prompt slow?
](
#is-your-shell-prompt-slow
)
### RubyGems
Though not recommended, hub can also be installed as a RubyGem:
~~~
sh
$
gem
install
hub
~~~
(It's not recommended for casual use because of the RubyGems startup
time. See
[
this gist
][
speed
]
for information.)
#### Standalone via RubyGems
~~~
sh
$
gem
install
hub
$
hub hub standalone
>
~/bin/hub
&&
chmod
+x ~/bin/hub
~~~
This installs a standalone version which doesn't require RubyGems to
run, so it's faster.
### Help! It's slow!
#### Is `hub` noticeably slower than plain git?
That is inconvenient, especially if you want to alias hub as
`git`
. Few things
you can try:
*
Find out which ruby is used for the hub executable:
``` sh
head -1 `which hub`
```
*
That ruby should be speedy. Time it with:
``` sh
time /usr/bin/ruby -e0
#=> it should be below 0.01 s total
```
*
Check that Ruby isn't loading something shady:
``` sh
echo $RUBYOPT
```
*
Check your
[
GC settings
][
gc
]
General recommendation: you should change hub's shebang line to run with system
ruby (usually
`/usr/bin/ruby`
) instead of currently active ruby (
`/usr/bin/env
ruby`
). Also, Ruby 1.8 is speedier than 1.9.
#### Is your shell prompt slow?
Does your prompt show git information? Hub may be slowing down your prompt.
This can happen if you've aliased hub as
`git`
. This is fine when you use
`git`
manually, but may be unacceptable for your prompt, which doesn't need hub
features anyway!
The solution is to identify which shell functions are calling
`git`
, and replace
each occurrence of that with
`command git`
. This is a shell feature that enables
you to call a command directly and skip aliases and functions wrapping it.
Aliasing
--------
...
...
@@ -369,7 +283,6 @@ Meta
*
Home:
<https://github.com/github/hub>
*
Bugs:
<https://github.com/github/hub/issues>
*
Gem:
<https://rubygems.org/gems/hub>
*
Authors:
<https://github.com/github/hub/contributors>
### Prior art
...
...
@@ -377,9 +290,6 @@ Meta
These projects also aim to either improve git or make interacting with
GitHub simpler:
*
[
hub in Ruby
](
https://github.com/github/hub/tree/1.12-stable
)
(
previous
implementation)
*
[
eg
](
http://www.gnome.org/~newren/eg/
)
*
[
github-gem
](
https://github.com/defunkt/github-gem
)
[
speed
]:
http://gist.github.com/284823
[
gc
]:
https://twitter.com/brynary/status/49560668994674688
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录