git-hub 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.md +4 -0
- data/README.md +7 -13
- data/lib/hub/args.rb +20 -2
- data/lib/hub/commands.rb +6 -3
- data/lib/hub/runner.rb +1 -1
- data/lib/hub/version.rb +1 -1
- data/test/helper.rb +1 -1
- data/test/hub_test.rb +17 -1
- metadata +2 -2
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -8,22 +8,16 @@ It can used on its own or as a `git` wrapper.
|
|
8
8
|
Normal:
|
9
9
|
|
10
10
|
$ hub clone rtomayko/tilt
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
remote: Total 307 (delta 175), reused 85 (delta 45)
|
15
|
-
Receiving objects: 100% (307/307), 48.91 KiB, done.
|
16
|
-
Resolving deltas: 100% (175/175), done.
|
11
|
+
|
12
|
+
Expands to:
|
13
|
+
$ git clone git://github.com/rtomayko/tilt.git
|
17
14
|
|
18
15
|
Wrapping `git`:
|
19
16
|
|
20
17
|
$ git clone rack/rack
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
remote: Total 4005 (delta 2505), reused 3620 (delta 2208)
|
25
|
-
Receiving objects: 100% (4005/4005), 785.82 KiB | 129 KiB/s, done.
|
26
|
-
Resolving deltas: 100% (2505/2505), done.
|
18
|
+
|
19
|
+
Expands to:
|
20
|
+
$ git clone git://github.com/rack/rack.git
|
27
21
|
|
28
22
|
hub requires you have `git` installed and in your `$PATH`. It also
|
29
23
|
requires Ruby 1.8.6+ or Ruby 1.9.1+. No other libraries necessary.
|
@@ -43,7 +37,7 @@ Assuming `~/bin/` is in your `$PATH`, you're ready to roll:
|
|
43
37
|
|
44
38
|
$ hub version
|
45
39
|
git version 1.6.4.2
|
46
|
-
hub version 0.2
|
40
|
+
hub version 0.3.2
|
47
41
|
|
48
42
|
### Homebrew
|
49
43
|
|
data/lib/hub/args.rb
CHANGED
@@ -7,7 +7,7 @@ module Hub
|
|
7
7
|
# instance when instantiated.
|
8
8
|
class Args < Array
|
9
9
|
attr_accessor :executable
|
10
|
-
|
10
|
+
|
11
11
|
def initialize(*args)
|
12
12
|
super
|
13
13
|
@executable = ENV["GIT"] || "git"
|
@@ -39,11 +39,29 @@ module Hub
|
|
39
39
|
def after?
|
40
40
|
!!@after
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
# Array of `executable` followed by all args suitable as arguments
|
44
44
|
# for `exec` or `system` calls.
|
45
45
|
def to_exec
|
46
46
|
[executable].concat self
|
47
47
|
end
|
48
|
+
|
49
|
+
# All the words (as opposed to flags) contained in this argument
|
50
|
+
# list.
|
51
|
+
#
|
52
|
+
# args = Args.new([ 'remote', 'add', '-f', 'tekkub' ])
|
53
|
+
# args.words == [ 'remote', 'add', 'tekkub' ]
|
54
|
+
def words
|
55
|
+
reject { |arg| arg =~ /^-/ }
|
56
|
+
end
|
57
|
+
|
58
|
+
# All the flags (as opposed to words) contained in this argument
|
59
|
+
# list.
|
60
|
+
#
|
61
|
+
# args = Args.new([ 'remote', 'add', '-f', 'tekkub' ])
|
62
|
+
# args.flags == [ '-f' ]
|
63
|
+
def flags
|
64
|
+
self - words
|
65
|
+
end
|
48
66
|
end
|
49
67
|
end
|
data/lib/hub/commands.rb
CHANGED
@@ -117,7 +117,7 @@ module Hub
|
|
117
117
|
# user/repo
|
118
118
|
user, repo = $1, $2
|
119
119
|
|
120
|
-
if args[-2] == args[1]
|
120
|
+
if args.words[-2] == args.words[1]
|
121
121
|
# rtomayko/tilt => rtomayko
|
122
122
|
args[-1] = user
|
123
123
|
else
|
@@ -290,10 +290,13 @@ module Hub
|
|
290
290
|
# $ hub help
|
291
291
|
# (print improved help text)
|
292
292
|
def help(args)
|
293
|
-
|
293
|
+
command = args.grep(/^[^-]/)[1]
|
294
|
+
|
295
|
+
if command == 'hub'
|
294
296
|
puts hub_manpage
|
295
297
|
exit
|
296
|
-
elsif
|
298
|
+
elsif command.nil?
|
299
|
+
ENV['GIT_PAGER'] = '' if args.grep(/^-{1,2}p/).empty? # Use `cat`.
|
297
300
|
puts improved_help_text
|
298
301
|
exit
|
299
302
|
end
|
data/lib/hub/runner.rb
CHANGED
data/lib/hub/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -48,7 +48,7 @@ class Test::Unit::TestCase
|
|
48
48
|
# Should in turn execute this:
|
49
49
|
# $ git clone git://github.com/git/hub.git
|
50
50
|
def assert_command(input, expected)
|
51
|
-
assert_equal expected, Hub(input).command
|
51
|
+
assert_equal expected, Hub(input).command, "$ git #{input}"
|
52
52
|
end
|
53
53
|
|
54
54
|
# Asserts that `hub` will show a specific alias command for a
|
data/test/hub_test.rb
CHANGED
@@ -123,6 +123,12 @@ class HubTest < Test::Unit::TestCase
|
|
123
123
|
assert_command input, command
|
124
124
|
end
|
125
125
|
|
126
|
+
def test_named_public_remote_f
|
127
|
+
input = "remote add -f origin rtomayko"
|
128
|
+
command = "git remote add -f origin git://github.com/rtomayko/hub.git"
|
129
|
+
assert_command input, command
|
130
|
+
end
|
131
|
+
|
126
132
|
def test_private_remote_with_repo
|
127
133
|
input = "remote add -p rtomayko/tilt"
|
128
134
|
command = "git remote add rtomayko git@github.com:rtomayko/tilt.git"
|
@@ -135,6 +141,12 @@ class HubTest < Test::Unit::TestCase
|
|
135
141
|
assert_command input, command
|
136
142
|
end
|
137
143
|
|
144
|
+
def test_public_remote_f_with_repo
|
145
|
+
input = "remote add -f rtomayko/tilt"
|
146
|
+
command = "git remote add -f rtomayko git://github.com/rtomayko/tilt.git"
|
147
|
+
assert_command input, command
|
148
|
+
end
|
149
|
+
|
138
150
|
def test_named_private_remote_with_repo
|
139
151
|
input = "remote add -p origin rtomayko/tilt"
|
140
152
|
command = "git remote add origin git@github.com:rtomayko/tilt.git"
|
@@ -169,7 +181,7 @@ class HubTest < Test::Unit::TestCase
|
|
169
181
|
|
170
182
|
def test_version
|
171
183
|
out = hub('--version')
|
172
|
-
assert_includes "git version
|
184
|
+
assert_includes "git version", out
|
173
185
|
assert_includes "hub version #{Hub::Version}", out
|
174
186
|
end
|
175
187
|
|
@@ -181,6 +193,10 @@ class HubTest < Test::Unit::TestCase
|
|
181
193
|
assert_equal Hub::Commands.improved_help_text, hub("")
|
182
194
|
end
|
183
195
|
|
196
|
+
def test_help_with_pager
|
197
|
+
assert_equal Hub::Commands.improved_help_text, hub("-p")
|
198
|
+
end
|
199
|
+
|
184
200
|
def test_help_hub
|
185
201
|
help_manpage = hub("help hub")
|
186
202
|
assert_includes "git + hub = github", help_manpage
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-05 00:00:00 -08:00
|
13
13
|
default_executable: hub
|
14
14
|
dependencies: []
|
15
15
|
|