github 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -12,12 +12,37 @@ Getting started
12
12
  $ gem install github
13
13
 
14
14
  Run it:
15
+
15
16
  $ github <command> <args>
16
17
 
17
18
 
18
- ===========
19
+ =============
20
+ Pulling Changes
21
+ =============
22
+
23
+ Let's say you just forked `github-gem` on GitHub from defunkt.
24
+
25
+ $ git clone git://github.com/YOU/github-gem.git
26
+ $ cd github-gem
27
+ $ github pull defunkt
28
+
29
+ This will setup a remote and branch for defunkt's repository at master.
30
+ In this case, a 'defunkt/master' branch.
31
+
32
+ If defunkt makes some changes you want, simply `github pull defunkt`. This will
33
+ leave you in the 'defunkt/master' branch after pulling changes from defunkt's
34
+ remote. After confirming that defunkt's changes were what you wanted, run `git
35
+ checkout master` and then `git merge defunkt/master` to merge defunkt's changes
36
+ into your own master branch. In summary:
37
+
38
+ $ github pull defunkt
39
+ $ git checkout master
40
+ $ git merge defunkt/master
41
+
42
+
43
+ ==========
19
44
  Contributors
20
- ===========
45
+ ==========
21
46
 
22
47
  - defunkt
23
48
  - maddox
@@ -35,7 +35,7 @@ GitHub.register :track do |user|
35
35
  git "remote add #{user} #{helper.public_url_for(user)}"
36
36
  end
37
37
 
38
- GitHub.describe :pull => 'Pull from a remote.'
38
+ GitHub.describe :pull => "Pull from a remote. Pass --merge to automatically merge remote's changes into your master."
39
39
  GitHub.register :pull do |user, branch|
40
40
  die "Specify a user to pull from" if user.nil?
41
41
  GitHub.invoke(:track, user) unless helper.tracking?(user)
@@ -43,5 +43,12 @@ GitHub.register :pull do |user, branch|
43
43
 
44
44
  puts "Switching to #{user}/#{branch}"
45
45
  git "checkout #{user}/#{branch}" if git("checkout -b #{user}/#{branch}").error?
46
- git_exec "pull #{user} #{branch}"
46
+
47
+ if options[:merge]
48
+ git "pull #{user} #{branch}"
49
+ git "checkout master"
50
+ git_exec "merge #{user}/#{branch}"
51
+ else
52
+ git_exec "pull #{user} #{branch}"
53
+ end
47
54
  end
@@ -1,11 +1,11 @@
1
1
 
2
- # Gem::Specification for Github-0.1.0
2
+ # Gem::Specification for Github-0.1.1
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{github}
7
- s.version = "0.1.0"
8
- s.date = %q{2008-03-03}
7
+ s.version = "0.1.1"
8
+ s.date = %q{2008-03-26}
9
9
  s.summary = %q{The official `github` command line helper for simplifying your GitHub experience.}
10
10
  s.email = %q{chris@ozmm.org}
11
11
  s.homepage = %q{http://github.com/}
@@ -27,7 +27,7 @@ end
27
27
  # begin
28
28
  # require 'echoe'
29
29
  #
30
- # Echoe.new('github', '0.1.0') do |p|
30
+ # Echoe.new('github', '0.1.1') do |p|
31
31
  # p.rubyforge_name = 'github'
32
32
  # p.summary = "The official `github` command line helper for simplifying your GitHub experience."
33
33
  # p.description = "The official `github` command line helper for simplifying your GitHub experience."
@@ -35,7 +35,7 @@ module GitHub
35
35
  end
36
36
 
37
37
  def activate(args)
38
- @debug = args.delete('--debug')
38
+ @options = parse_options(args)
39
39
  load 'helpers.rb'
40
40
  load 'commands.rb'
41
41
  invoke(args.shift, *args)
@@ -55,6 +55,25 @@ module GitHub
55
55
  @descriptions ||= {}
56
56
  end
57
57
 
58
+ def options
59
+ @options
60
+ end
61
+
62
+ def parse_options(args)
63
+ @debug = args.delete('--debug')
64
+ args.inject({}) do |memo, arg|
65
+ if arg =~ /^--([^=]+)=(.+)/
66
+ args.delete(arg)
67
+ memo.merge($1.to_sym => $2)
68
+ elsif arg =~ /^--(.+)/
69
+ args.delete(arg)
70
+ memo.merge($1.to_sym => true)
71
+ else
72
+ memo
73
+ end
74
+ end
75
+ end
76
+
58
77
  def load(file)
59
78
  file[0] == ?/ ? super : super(BasePath + "/commands/#{file}")
60
79
  end
@@ -16,6 +16,10 @@ module GitHub
16
16
  @helper ||= Helper.new
17
17
  end
18
18
 
19
+ def options
20
+ GitHub.options
21
+ end
22
+
19
23
  def pgit(*command)
20
24
  puts git(*command)
21
25
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: github
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2008-03-03 00:00:00 -08:00
6
+ version: 0.1.1
7
+ date: 2008-03-26 00:00:00 -04:00
8
8
  summary: The official `github` command line helper for simplifying your GitHub experience.
9
9
  require_paths:
10
10
  - lib