hubflow 1.7.0
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/LICENSE +20 -0
- data/README.md +385 -0
- data/Rakefile +140 -0
- data/bin/hubflow +7 -0
- data/lib/hub.rb +5 -0
- data/lib/hub/args.rb +117 -0
- data/lib/hub/commands.rb +977 -0
- data/lib/hub/context.rb +367 -0
- data/lib/hub/runner.rb +73 -0
- data/lib/hub/standalone.rb +58 -0
- data/lib/hub/version.rb +3 -0
- data/man/hub.1 +438 -0
- data/man/hub.1.html +437 -0
- data/man/hub.1.ronn +192 -0
- data/test/alias_test.rb +40 -0
- data/test/deps.rip +1 -0
- data/test/fakebin/git +11 -0
- data/test/fakebin/open +3 -0
- data/test/helper.rb +111 -0
- data/test/hub_test.rb +1224 -0
- data/test/standalone_test.rb +48 -0
- metadata +106 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Chris Wanstrath
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,385 @@
|
|
1
|
+
hub: git + hub = github
|
2
|
+
=======================
|
3
|
+
|
4
|
+
`hub` is a command line utility which adds GitHub knowledge to `git`.
|
5
|
+
|
6
|
+
It can be used on its own or as a `git` wrapper.
|
7
|
+
|
8
|
+
Normal:
|
9
|
+
|
10
|
+
$ hub clone rtomayko/tilt
|
11
|
+
|
12
|
+
Expands to:
|
13
|
+
$ git clone git://github.com/rtomayko/tilt.git
|
14
|
+
|
15
|
+
Wrapping `git`:
|
16
|
+
|
17
|
+
$ git clone rack/rack
|
18
|
+
|
19
|
+
Expands to:
|
20
|
+
$ git clone git://github.com/rack/rack.git
|
21
|
+
|
22
|
+
hub requires you have `git` installed and in your `$PATH`. It also
|
23
|
+
requires Ruby 1.8.6+ or Ruby 1.9.1+. No other libraries necessary.
|
24
|
+
|
25
|
+
|
26
|
+
Install
|
27
|
+
-------
|
28
|
+
|
29
|
+
### Standalone
|
30
|
+
|
31
|
+
`hub` is most easily installed as a standalone script:
|
32
|
+
|
33
|
+
curl http://defunkt.io/hub/standalone -sLo ~/bin/hub &&
|
34
|
+
chmod 755 ~/bin/hub
|
35
|
+
|
36
|
+
Assuming `~/bin/` is in your `$PATH`, you're ready to roll:
|
37
|
+
|
38
|
+
$ hub version
|
39
|
+
git version 1.7.0.4
|
40
|
+
hub version 1.1.0
|
41
|
+
|
42
|
+
### Homebrew
|
43
|
+
|
44
|
+
$ brew install hub
|
45
|
+
$ which hub
|
46
|
+
/usr/local/bin/hub
|
47
|
+
$ hub version
|
48
|
+
...
|
49
|
+
|
50
|
+
### RubyGems
|
51
|
+
|
52
|
+
Though not recommended, `hub` can also be installed as a RubyGem:
|
53
|
+
|
54
|
+
$ gem install hub
|
55
|
+
|
56
|
+
(It's not recommended for casual use because of the RubyGems startup
|
57
|
+
time. See [this gist][speed] for information.)
|
58
|
+
|
59
|
+
### Standalone via RubyGems
|
60
|
+
|
61
|
+
$ gem install hub
|
62
|
+
$ hub hub standalone > ~/bin/hub && chmod 755 ~/bin/hub
|
63
|
+
|
64
|
+
This installs a standalone version which doesn't require RubyGems to
|
65
|
+
run.
|
66
|
+
|
67
|
+
### Source
|
68
|
+
|
69
|
+
You can also install from source:
|
70
|
+
|
71
|
+
$ git clone git://github.com/defunkt/hub.git
|
72
|
+
$ cd hub
|
73
|
+
$ rake install prefix=/usr/local
|
74
|
+
|
75
|
+
### Help! It's Slow!
|
76
|
+
|
77
|
+
Is your prompt slow? It may be hub.
|
78
|
+
|
79
|
+
1. Check that it's **not** installed using RubyGems.
|
80
|
+
2. Check that RUBYOPT isn't loading anything shady:
|
81
|
+
|
82
|
+
$ echo $RUBYOPT
|
83
|
+
|
84
|
+
3. Check that your system Ruby is speedy:
|
85
|
+
|
86
|
+
$ time /usr/bin/env ruby -e0
|
87
|
+
|
88
|
+
If #3 is slow, it may be your [GC settings][gc].
|
89
|
+
|
90
|
+
|
91
|
+
Aliasing
|
92
|
+
--------
|
93
|
+
|
94
|
+
`hub` works best when it wraps `git`. This is not dangerous - your
|
95
|
+
normal git commands should all work. hub merely adds some sugar.
|
96
|
+
|
97
|
+
Typing `hub alias <shell>` will display alias instructions for
|
98
|
+
your shell. `hub alias` alone will show the known shells.
|
99
|
+
|
100
|
+
For example:
|
101
|
+
|
102
|
+
$ hub alias bash
|
103
|
+
Run this in your shell to start using `hub` as `git`:
|
104
|
+
alias git=hub
|
105
|
+
|
106
|
+
You should place this command in your `.bash_profile` or other startup
|
107
|
+
script to ensure runs on login.
|
108
|
+
|
109
|
+
The alias command can also be eval'd directly using the `-s` flag:
|
110
|
+
|
111
|
+
$ eval `hub alias -s bash`
|
112
|
+
|
113
|
+
|
114
|
+
Commands
|
115
|
+
--------
|
116
|
+
|
117
|
+
Assuming you've aliased `hub` to `git`, the following commands now have
|
118
|
+
superpowers:
|
119
|
+
|
120
|
+
### git clone
|
121
|
+
|
122
|
+
$ git clone schacon/ticgit
|
123
|
+
> git clone git://github.com/schacon/ticgit.git
|
124
|
+
|
125
|
+
$ git clone -p schacon/ticgit
|
126
|
+
> git clone git@github.com:schacon/ticgit.git
|
127
|
+
|
128
|
+
$ git clone resque
|
129
|
+
> git clone git@github.com/YOUR_USER/resque.git
|
130
|
+
|
131
|
+
### git remote add
|
132
|
+
|
133
|
+
$ git remote add rtomayko
|
134
|
+
> git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git
|
135
|
+
|
136
|
+
$ git remote add -p rtomayko
|
137
|
+
> git remote add rtomayko git@github.com:rtomayko/CURRENT_REPO.git
|
138
|
+
|
139
|
+
$ git remote add origin
|
140
|
+
> git remote add origin git://github.com/YOUR_USER/CURRENT_REPO.git
|
141
|
+
|
142
|
+
### git fetch
|
143
|
+
|
144
|
+
$ git fetch mislav
|
145
|
+
> git remote add mislav git://github.com/mislav/REPO.git
|
146
|
+
> git fetch mislav
|
147
|
+
|
148
|
+
$ git fetch mislav,xoebus
|
149
|
+
> git remote add mislav ...
|
150
|
+
> git remote add xoebus ...
|
151
|
+
> git fetch --multiple mislav xoebus
|
152
|
+
|
153
|
+
### git cherry-pick
|
154
|
+
|
155
|
+
$ git cherry-pick http://github.com/mislav/REPO/commit/SHA
|
156
|
+
> git remote add -f mislav git://github.com/mislav/REPO.git
|
157
|
+
> git cherry-pick SHA
|
158
|
+
|
159
|
+
$ git cherry-pick mislav@SHA
|
160
|
+
> git remote add -f mislav git://github.com/mislav/CURRENT_REPO.git
|
161
|
+
> git cherry-pick SHA
|
162
|
+
|
163
|
+
$ git cherry-pick mislav@SHA
|
164
|
+
> git fetch mislav
|
165
|
+
> git cherry-pick SHA
|
166
|
+
|
167
|
+
### git am, git apply
|
168
|
+
|
169
|
+
$ git am https://github.com/defunkt/hub/pull/55
|
170
|
+
> curl https://github.com/defunkt/hub/pull/55.patch -o /tmp/55.patch
|
171
|
+
> git am /tmp/55.patch
|
172
|
+
|
173
|
+
$ git am --ignore-whitespace https://github.com/davidbalbert/hub/commit/fdb9921
|
174
|
+
> curl https://github.com/davidbalbert/hub/commit/fdb9921.patch -o /tmp/fdb9921.patch
|
175
|
+
> git am --ignore-whitespace /tmp/fdb9921.patch
|
176
|
+
|
177
|
+
$ git apply https://gist.github.com/8da7fb575debd88c54cf
|
178
|
+
> curl https://gist.github.com/8da7fb575debd88c54cf.txt -o /tmp/gist-8da7fb575debd88c54cf.txt
|
179
|
+
> git apply /tmp/gist-8da7fb575debd88c54cf.txt
|
180
|
+
|
181
|
+
### git fork
|
182
|
+
|
183
|
+
$ git fork
|
184
|
+
[ repo forked on GitHub ]
|
185
|
+
> git remote add -f YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git
|
186
|
+
|
187
|
+
### git pull-request
|
188
|
+
|
189
|
+
# while on a topic branch called "feature":
|
190
|
+
$ git pull-request
|
191
|
+
[ opens text editor to edit title & body for the request ]
|
192
|
+
[ opened pull request on GitHub for "YOUR_USER:feature" ]
|
193
|
+
|
194
|
+
# explicit title, pull base & head:
|
195
|
+
$ git pull-request "I've implemented feature X" -b defunkt:master -h mislav:feature
|
196
|
+
|
197
|
+
$ git pull-request -i 123
|
198
|
+
[ attached pull request to issue #123 ]
|
199
|
+
|
200
|
+
### git checkout
|
201
|
+
|
202
|
+
# $ git checkout https://github.com/defunkt/hub/pull/73
|
203
|
+
# > git remote add -f -t feature git://github:com/mislav/hub.git
|
204
|
+
# > git checkout -b mislav-feature mislav/feature
|
205
|
+
|
206
|
+
# $ git checkout https://github.com/defunkt/hub/pull/73 custom-branch-name
|
207
|
+
|
208
|
+
### git create
|
209
|
+
|
210
|
+
$ git create
|
211
|
+
[ repo created on GitHub ]
|
212
|
+
> git remote add origin git@github.com:YOUR_USER/CURRENT_REPO.git
|
213
|
+
|
214
|
+
# with description:
|
215
|
+
$ git create -d 'It shall be mine, all mine!'
|
216
|
+
|
217
|
+
$ git create recipes
|
218
|
+
[ repo created on GitHub ]
|
219
|
+
> git remote add origin git@github.com:YOUR_USER/recipes.git
|
220
|
+
|
221
|
+
$ git create sinatra/recipes
|
222
|
+
[ repo created in GitHub organization ]
|
223
|
+
> git remote add origin git@github.com:sinatra/recipes.git
|
224
|
+
|
225
|
+
### git init
|
226
|
+
|
227
|
+
$ git init -g
|
228
|
+
> git init
|
229
|
+
> git remote add origin git@github.com:YOUR_USER/REPO.git
|
230
|
+
|
231
|
+
### git push
|
232
|
+
|
233
|
+
$ git push origin,staging,qa bert_timeout
|
234
|
+
> git push origin bert_timeout
|
235
|
+
> git push staging bert_timeout
|
236
|
+
> git push qa bert_timeout
|
237
|
+
|
238
|
+
### git browse
|
239
|
+
|
240
|
+
$ git browse
|
241
|
+
> open https://github.com/YOUR_USER/CURRENT_REPO
|
242
|
+
|
243
|
+
$ git browse -- commit/SHA
|
244
|
+
> open https://github.com/YOUR_USER/CURRENT_REPO/commit/SHA
|
245
|
+
|
246
|
+
$ git browse -- issues
|
247
|
+
> open https://github.com/YOUR_USER/CURRENT_REPO/issues
|
248
|
+
|
249
|
+
$ git browse schacon/ticgit
|
250
|
+
> open https://github.com/schacon/ticgit
|
251
|
+
|
252
|
+
$ git browse schacon/ticgit commit/SHA
|
253
|
+
> open https://github.com/schacon/ticgit/commit/SHA
|
254
|
+
|
255
|
+
$ git browse resque
|
256
|
+
> open https://github.com/YOUR_USER/resque
|
257
|
+
|
258
|
+
$ git browse resque network
|
259
|
+
> open https://github.com/YOUR_USER/resque/network
|
260
|
+
|
261
|
+
### git compare
|
262
|
+
|
263
|
+
$ git compare refactor
|
264
|
+
> open https://github.com/CURRENT_REPO/compare/refactor
|
265
|
+
|
266
|
+
$ git compare 1.0..1.1
|
267
|
+
> open https://github.com/CURRENT_REPO/compare/1.0...1.1
|
268
|
+
|
269
|
+
$ git compare -u fix
|
270
|
+
> (https://github.com/CURRENT_REPO/compare/fix)
|
271
|
+
|
272
|
+
$ git compare other-user patch
|
273
|
+
> open https://github.com/other-user/REPO/compare/patch
|
274
|
+
|
275
|
+
### git submodule
|
276
|
+
|
277
|
+
$ hub submodule add wycats/bundler vendor/bundler
|
278
|
+
> git submodule add git://github.com/wycats/bundler.git vendor/bundler
|
279
|
+
|
280
|
+
$ hub submodule add -p wycats/bundler vendor/bundler
|
281
|
+
> git submodule add git@github.com:wycats/bundler.git vendor/bundler
|
282
|
+
|
283
|
+
$ hub submodule add -b ryppl ryppl/pip vendor/pip
|
284
|
+
> git submodule add -b ryppl git://github.com/ryppl/pip.git vendor/pip
|
285
|
+
|
286
|
+
|
287
|
+
### git help
|
288
|
+
|
289
|
+
$ git help
|
290
|
+
> (improved git help)
|
291
|
+
$ git help hub
|
292
|
+
> (hub man page)
|
293
|
+
|
294
|
+
|
295
|
+
GitHub Login
|
296
|
+
------------
|
297
|
+
|
298
|
+
To get the most out of `hub`, you'll want to ensure your GitHub login
|
299
|
+
is stored locally in your Git config or environment variables.
|
300
|
+
|
301
|
+
To test it run this:
|
302
|
+
|
303
|
+
$ git config --global github.user
|
304
|
+
|
305
|
+
If you see nothing, you need to set the config setting:
|
306
|
+
|
307
|
+
$ git config --global github.user YOUR_USER
|
308
|
+
|
309
|
+
For commands that require write access to GitHub (such as `fork`), you'll want to
|
310
|
+
setup "github.token" as well. See [GitHub config guide][2] for more information.
|
311
|
+
|
312
|
+
If present, environment variables `GITHUB_USER` and `GITHUB_TOKEN` override the
|
313
|
+
values of "github.user" and "github.token".
|
314
|
+
|
315
|
+
Configuration
|
316
|
+
-------------
|
317
|
+
|
318
|
+
If you prefer using the HTTPS protocol for GitHub repositories instead of the git
|
319
|
+
protocol for read and ssh for write, you can set "hub.protocol" to "https".
|
320
|
+
|
321
|
+
For example:
|
322
|
+
|
323
|
+
$ git clone defunkt/repl
|
324
|
+
< git clone >
|
325
|
+
|
326
|
+
$ git config --global hub.protocol https
|
327
|
+
$ git clone defunkt/repl
|
328
|
+
< https clone >
|
329
|
+
|
330
|
+
Prior Art
|
331
|
+
---------
|
332
|
+
|
333
|
+
These projects also aim to either improve git or make interacting with
|
334
|
+
GitHub simpler:
|
335
|
+
|
336
|
+
* [eg](http://www.gnome.org/~newren/eg/)
|
337
|
+
* [github-gem](https://github.com/defunkt/github-gem)
|
338
|
+
|
339
|
+
|
340
|
+
Contributing
|
341
|
+
------------
|
342
|
+
|
343
|
+
These instructions assume that you already have `hub` installed and that
|
344
|
+
you've set it up so it wraps `git` (see "Aliasing").
|
345
|
+
|
346
|
+
1. Clone hub:
|
347
|
+
`git clone defunkt/hub`
|
348
|
+
2. Verify that existing tests pass (see "Development dependencies"):
|
349
|
+
`rake test`
|
350
|
+
3. Create a topic branch:
|
351
|
+
`git checkout -b my_branch`
|
352
|
+
4. Make your changes – it helps a lot if you write tests first
|
353
|
+
5. Verify that tests still pass:
|
354
|
+
`rake test`
|
355
|
+
6. Fork hub on GitHub (adds a remote named "YOUR_USER"):
|
356
|
+
`git fork`
|
357
|
+
7. Push to your fork:
|
358
|
+
`git push -u YOUR_USER my_branch`
|
359
|
+
8. Open a pull request describing your changes:
|
360
|
+
`git pull-request`
|
361
|
+
|
362
|
+
### Development dependencies
|
363
|
+
|
364
|
+
You will need the following libraries for development:
|
365
|
+
|
366
|
+
* [ronn](https://github.com/rtomayko/ronn) (building man pages)
|
367
|
+
* [webmock](https://github.com/bblimke/webmock)
|
368
|
+
* [json](http://flori.github.com/json/) (ruby 1.8 only)
|
369
|
+
|
370
|
+
Meta
|
371
|
+
----
|
372
|
+
|
373
|
+
* Home: <https://github.com/defunkt/hub>
|
374
|
+
* Bugs: <https://github.com/defunkt/hub/issues>
|
375
|
+
* Gem: <https://rubygems.org/gems/hub>
|
376
|
+
|
377
|
+
|
378
|
+
Authors
|
379
|
+
-------
|
380
|
+
|
381
|
+
<https://github.com/defunkt/hub/contributors>
|
382
|
+
|
383
|
+
[speed]: http://gist.github.com/284823
|
384
|
+
[2]: http://help.github.com/set-your-user-name-email-and-github-token/
|
385
|
+
[gc]: https://twitter.com/brynary/status/49560668994674688
|
data/Rakefile
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'rake/testtask'
|
2
|
+
|
3
|
+
#
|
4
|
+
# Helpers
|
5
|
+
#
|
6
|
+
|
7
|
+
def command?(util)
|
8
|
+
Rake::Task[:load_path].invoke
|
9
|
+
context = Object.new
|
10
|
+
require 'hub/context'
|
11
|
+
context.extend Hub::Context
|
12
|
+
context.send(:command?, util)
|
13
|
+
end
|
14
|
+
|
15
|
+
task :load_path do
|
16
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
17
|
+
end
|
18
|
+
|
19
|
+
task :check_dirty do
|
20
|
+
unless system 'git', 'diff', '--quiet', 'HEAD'
|
21
|
+
abort "Aborted: you have uncommitted changes"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
#
|
27
|
+
# Tests
|
28
|
+
#
|
29
|
+
|
30
|
+
task :default => :test
|
31
|
+
|
32
|
+
Rake::TestTask.new do |t|
|
33
|
+
t.libs << 'test'
|
34
|
+
t.ruby_opts << '-rubygems'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
if command? :kicker
|
40
|
+
desc "Launch Kicker (like autotest)"
|
41
|
+
task :kicker do
|
42
|
+
puts "Kicking... (ctrl+c to cancel)"
|
43
|
+
exec "kicker -e rake test lib"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
#
|
49
|
+
# Manual
|
50
|
+
#
|
51
|
+
|
52
|
+
if command? :ronn
|
53
|
+
desc "Show man page"
|
54
|
+
task :man => "man:build" do
|
55
|
+
exec "man man/hub.1"
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Build man pages"
|
59
|
+
task "man:build" => ["man/hub.1", "man/hub.1.html"]
|
60
|
+
|
61
|
+
extract_examples = lambda { |readme_file|
|
62
|
+
# split readme in sections
|
63
|
+
examples = File.read(readme_file).split(/^-{4,}$/)[3].strip
|
64
|
+
examples.sub!(/^.+?(###)/m, '\1') # strip intro paragraph
|
65
|
+
examples.sub!(/\n+.+\Z/, '') # remove last line
|
66
|
+
examples
|
67
|
+
}
|
68
|
+
|
69
|
+
# inject examples from README file to .ronn source
|
70
|
+
source_with_examples = lambda { |source, readme|
|
71
|
+
examples = extract_examples.call(readme)
|
72
|
+
compiled = File.read(source)
|
73
|
+
compiled.sub!('{{README}}', examples)
|
74
|
+
compiled
|
75
|
+
}
|
76
|
+
|
77
|
+
# generate man page with ronn
|
78
|
+
compile_ronn = lambda { |destination, type, contents|
|
79
|
+
File.popen("ronn --pipe --#{type} --organization=DEFUNKT --manual='Git Manual'", 'w+') { |io|
|
80
|
+
io.write contents
|
81
|
+
io.close_write
|
82
|
+
File.open(destination, 'w') { |f| f << io.read }
|
83
|
+
}
|
84
|
+
abort "ronn --#{type} conversion failed" unless $?.success?
|
85
|
+
}
|
86
|
+
|
87
|
+
file "man/hub.1" => ["man/hub.1.ronn", "README.md"] do |task|
|
88
|
+
contents = source_with_examples.call(*task.prerequisites)
|
89
|
+
compile_ronn.call(task.name, 'roff', contents)
|
90
|
+
compile_ronn.call("#{task.name}.html", 'html', contents)
|
91
|
+
end
|
92
|
+
|
93
|
+
file "man/hub.1.html" => ["man/hub.1.ronn", "README.md"] do |task|
|
94
|
+
Rake::Task["man/hub.1"].invoke
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
#
|
100
|
+
# Build
|
101
|
+
#
|
102
|
+
|
103
|
+
file "hub" => FileList.new("lib/hub/*.rb", "man/hub.1") do |task|
|
104
|
+
Rake::Task[:load_path].invoke
|
105
|
+
require 'hub/standalone'
|
106
|
+
Hub::Standalone.save(task.name)
|
107
|
+
end
|
108
|
+
|
109
|
+
desc "Build standalone script"
|
110
|
+
task :standalone => "hub"
|
111
|
+
|
112
|
+
desc "Install standalone script and man pages"
|
113
|
+
task :install => "hub" do
|
114
|
+
prefix = ENV['PREFIX'] || ENV['prefix'] || '/usr/local'
|
115
|
+
|
116
|
+
FileUtils.mkdir_p "#{prefix}/bin"
|
117
|
+
FileUtils.cp "hub", "#{prefix}/bin", :preserve => true
|
118
|
+
|
119
|
+
FileUtils.mkdir_p "#{prefix}/share/man/man1"
|
120
|
+
FileUtils.cp "man/hub.1", "#{prefix}/share/man/man1"
|
121
|
+
end
|
122
|
+
|
123
|
+
desc "Copy files to gh-pages branch, but don't publish"
|
124
|
+
task :gh_pages => [:check_dirty, "hub", "man/hub.1.html"] do
|
125
|
+
cp "man/hub.1.html", "html"
|
126
|
+
sh "git checkout gh-pages"
|
127
|
+
# replace the specific shebang with a generic ruby one
|
128
|
+
sh "echo '#!/usr/bin/env' ruby > standalone"
|
129
|
+
sh "sed 1d hub >> standalone"
|
130
|
+
mv "html", "hub.1.html"
|
131
|
+
sh "git add standalone hub.1.html"
|
132
|
+
sh "git commit -m 'update standalone'"
|
133
|
+
end
|
134
|
+
|
135
|
+
desc "Publish to GitHub Pages"
|
136
|
+
task :pages => :gh_pages do
|
137
|
+
sh "git push origin gh-pages"
|
138
|
+
sh "git checkout master"
|
139
|
+
puts "Done."
|
140
|
+
end
|