give 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/README.md +7 -2
  2. data/VERSION +1 -1
  3. data/give.gemspec +2 -2
  4. data/lib/give.rb +10 -8
  5. data/spec/give_spec.rb +34 -13
  6. metadata +95 -146
data/README.md CHANGED
@@ -10,13 +10,13 @@ You must have set your git username and api token, if you not please follow [the
10
10
 
11
11
  ### Usage
12
12
 
13
- You will need the name of the GitHub user, and the repository name for the project in question. In this example we'll the give gem itself.
13
+ You will need the name of the GitHub user, and the repository name for the project in question. In this example we'll use the give gem itself.
14
14
 
15
15
  First up, fork the project and check out your new copy of the repo with the `give setup` command.
16
16
 
17
17
  give setup seenmyfate give
18
18
 
19
- Next, create a feature branch to work in.
19
+ Next `cd` into your newly created git repo, and create a feature branch to work in.
20
20
 
21
21
  give start feature/my_awesome_feature
22
22
 
@@ -24,6 +24,11 @@ Commit away as usual, but be sure to keep your feature branch up to date with an
24
24
 
25
25
  give update feature/my_awesome_feature
26
26
 
27
+ Give assumes you will be contributing to the 'master' branch of the project you have forked. If this is not case, add the name of the branch as a second argument when updating
28
+
29
+ give update feature/my_awesome_feature develop
30
+
31
+
27
32
  When the work is complete, push up the branch and send a pull request with `give finish`
28
33
 
29
34
  give finish seenmyfate give feature/my_awesome_feature
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "give"
8
- s.version = "0.1.2"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["seenmyfate"]
12
- s.date = "2011-12-31"
12
+ s.date = "2012-01-17"
13
13
  s.description = "The aim of Give is to make contributing to open source projects on Github just that bit easier, by wrapping some simple commands around a common workflow."
14
14
  s.email = "seenmyfate@gmail.com"
15
15
  s.executables = ["give"]
@@ -28,9 +28,10 @@ module Give
28
28
  Give::Repo.new(:branch => branch).checkout_branch
29
29
  end
30
30
 
31
- desc "update BRANCH", "Updates your master branch with upstream changes, then rebases your working branch"
32
- def update(branch)
33
- Give::Repo.new(:branch => branch).update
31
+ desc "update BRANCH [UPSTREAM_BRANCH]", "Updates your master branch with upstream changes, then rebases your working branch. Specify an upstream branch if you are using anything other than master"
32
+ def update(branch,upstream_branch=:master)
33
+ Give::Repo.new(:branch => branch,
34
+ :upstream_branch => upstream_branch).update
34
35
  end
35
36
 
36
37
  desc "finish OWNER PROJECT BRANCH", "Pushes up your working branch, then submits a pull request."
@@ -145,9 +146,10 @@ module Give
145
146
  #
146
147
  class Repo
147
148
  include Commands
148
- attr_accessor :branch
149
+ attr_accessor :branch, :upstream_branch
149
150
  def initialize(opts={})
150
- @branch = opts.fetch(:branch, 'master')
151
+ @branch = opts.fetch(:branch, :master)
152
+ @upstream_branch = opts.fetch(:upstream_branch, :master)
151
153
  end
152
154
 
153
155
  def push
@@ -156,10 +158,10 @@ module Give
156
158
 
157
159
  def update
158
160
  git('fetch upstream')
159
- git('checkout master')
160
- git('pull upstream master')
161
+ git("checkout #{upstream_branch}")
162
+ git("pull upstream #{upstream_branch}")
161
163
  git("checkout #{branch}")
162
- git('rebase master')
164
+ git("rebase #{upstream_branch}")
163
165
  end
164
166
 
165
167
  def checkout_branch
@@ -1,9 +1,10 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe Give::CLI do
4
- let(:owner) { 'seenmyfate' }
4
+ let(:owner) { 'github_user' }
5
5
  let(:project) { 'give' }
6
6
  let(:branch) { 'feaature/my_awesome_feature' }
7
+ let(:upstream_branch) { 'upstream_branch' }
7
8
  let(:give) { Give::CLI.new }
8
9
  let(:project) { stub }
9
10
  let(:repo) { stub }
@@ -30,7 +31,7 @@ describe Give::CLI do
30
31
  it "updates" do
31
32
  Give::Repo.should_receive(:new).and_return(repo)
32
33
  repo.should_receive(:update)
33
- subject.update(branch)
34
+ subject.update(branch, upstream_branch)
34
35
  end
35
36
  end
36
37
 
@@ -46,18 +47,20 @@ describe Give::CLI do
46
47
  end
47
48
 
48
49
  describe Give::Project do
49
- let(:owner) { 'seenmyfate' }
50
+ let(:owner) { 'github_owner' }
50
51
  let(:title) { 'give' }
51
- let(:reference) { 'seenmyfate/give' }
52
+ let(:github_login) { 'github_user' }
53
+ let(:reference) { 'github_owner/give' }
52
54
  let(:request_title) { 'awesome feature' }
53
55
  let(:request_body) { 'is awesome' }
54
56
  subject { Give::Project.new(owner, title) }
55
57
 
56
58
  before do
59
+ Give::User.any_instance.stub(:github_login).and_return github_login
57
60
  Give::Project.any_instance.stub(:request_body).and_return request_body
58
61
  Give::Project.any_instance.stub(:request_title).and_return request_title
59
62
  end
60
-
63
+
61
64
  context "#new" do
62
65
 
63
66
  it "should have an owner" do
@@ -90,8 +93,8 @@ describe Give::Project do
90
93
 
91
94
  it "forks with octokit" do
92
95
  subject.client.should_receive(:fork!).with(subject.reference)
93
- subject.should_receive(:git).with('clone git@github.com:seenmyfate/give.git')
94
- subject.should_receive(:sh).with('cd give;git remote add upstream git://github.com/seenmyfate/give.git')
96
+ subject.should_receive(:git).with('clone git@github.com:github_user/give.git')
97
+ subject.should_receive(:sh).with('cd give;git remote add upstream git://github.com/github_owner/give.git')
95
98
  subject.fork
96
99
  end
97
100
  end
@@ -100,7 +103,7 @@ describe Give::Project do
100
103
  let(:local_repo) { stub(:branch => 'my_awesome_feature') }
101
104
  let(:title) { 'title' }
102
105
  let(:body) { 'body' }
103
- let(:local_ref) { 'seenmyfate:my_awesome_feature' }
106
+ let(:local_ref) { 'github_user:my_awesome_feature' }
104
107
  let(:target_branch) { 'master' }
105
108
 
106
109
  before do
@@ -152,13 +155,14 @@ end
152
155
  describe Give::Repo do
153
156
 
154
157
  let(:branch) { 'feature/my_awesome_feature' }
158
+ let(:upstream_branch) { 'upstream_branch' }
155
159
  context "#new" do
156
160
 
157
161
  context "without a branch" do
158
162
  subject { Give::Repo.new }
159
163
 
160
164
  it "has master as the branch" do
161
- subject.branch.should eq 'master'
165
+ subject.branch.should eq :master
162
166
  end
163
167
  end
164
168
 
@@ -169,18 +173,35 @@ describe Give::Repo do
169
173
  subject.branch.should eq branch
170
174
  end
171
175
  end
176
+
177
+ context "with an upstream branch" do
178
+
179
+ subject { Give::Repo.new(:upstream_branch => upstream_branch) }
172
180
 
181
+ it "has the upstream branch" do
182
+ subject.upstream_branch.should eq upstream_branch
183
+ end
184
+ end
173
185
  end
174
186
 
175
- context "#update" do
187
+ context "without an upstream branch" do
188
+
176
189
  subject { Give::Repo.new(:branch => branch) }
190
+
191
+ it "has the upstream as master" do
192
+ subject.upstream_branch.should eq :master
193
+ end
194
+ end
195
+
196
+ context "#update" do
197
+ subject { Give::Repo.new(:branch => branch, :upstream_branch => upstream_branch) }
177
198
 
178
199
  it "updates the branch" do
179
200
  subject.should_receive(:git).with('fetch upstream')
180
- subject.should_receive(:git).with('checkout master')
181
- subject.should_receive(:git).with('pull upstream master')
201
+ subject.should_receive(:git).with('checkout upstream_branch')
202
+ subject.should_receive(:git).with('pull upstream upstream_branch')
182
203
  subject.should_receive(:git).with("checkout #{branch}")
183
- subject.should_receive(:git).with('rebase master')
204
+ subject.should_receive(:git).with('rebase upstream_branch')
184
205
  subject.update
185
206
  end
186
207
  end
metadata CHANGED
@@ -1,170 +1,125 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: give
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - seenmyfate
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-12-31 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- requirement: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- hash: 3
27
- segments:
28
- - 0
29
- version: "0"
30
- version_requirements: *id001
12
+ date: 2012-01-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
31
15
  name: thor
32
- prerelease: false
16
+ requirement: &70149714051280 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- - !ruby/object:Gem::Dependency
35
- requirement: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: *70149714051280
25
+ - !ruby/object:Gem::Dependency
26
+ name: octokit
27
+ requirement: &70149714050340 !ruby/object:Gem::Requirement
36
28
  none: false
37
- requirements:
38
- - - "="
39
- - !ruby/object:Gem::Version
40
- hash: 9
41
- segments:
42
- - 0
43
- - 5
44
- - 1
29
+ requirements:
30
+ - - =
31
+ - !ruby/object:Gem::Version
45
32
  version: 0.5.1
46
- version_requirements: *id002
47
- name: octokit
48
- prerelease: false
49
33
  type: :runtime
50
- - !ruby/object:Gem::Dependency
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
60
- version_requirements: *id003
61
- name: highline
62
34
  prerelease: false
35
+ version_requirements: *70149714050340
36
+ - !ruby/object:Gem::Dependency
37
+ name: highline
38
+ requirement: &70149714049480 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
63
44
  type: :runtime
64
- - !ruby/object:Gem::Dependency
65
- requirement: &id004 !ruby/object:Gem::Requirement
45
+ prerelease: false
46
+ version_requirements: *70149714049480
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &70149714048380 !ruby/object:Gem::Requirement
66
50
  none: false
67
- requirements:
51
+ requirements:
68
52
  - - ~>
69
- - !ruby/object:Gem::Version
70
- hash: 19
71
- segments:
72
- - 2
73
- - 7
74
- - 0
53
+ - !ruby/object:Gem::Version
75
54
  version: 2.7.0
76
- version_requirements: *id004
77
- name: rspec
78
- prerelease: false
79
55
  type: :development
80
- - !ruby/object:Gem::Dependency
81
- requirement: &id005 !ruby/object:Gem::Requirement
56
+ prerelease: false
57
+ version_requirements: *70149714048380
58
+ - !ruby/object:Gem::Dependency
59
+ name: yard
60
+ requirement: &70149714070680 !ruby/object:Gem::Requirement
82
61
  none: false
83
- requirements:
62
+ requirements:
84
63
  - - ~>
85
- - !ruby/object:Gem::Version
86
- hash: 7
87
- segments:
88
- - 0
89
- - 6
90
- - 0
64
+ - !ruby/object:Gem::Version
91
65
  version: 0.6.0
92
- version_requirements: *id005
93
- name: yard
94
- prerelease: false
95
66
  type: :development
96
- - !ruby/object:Gem::Dependency
97
- requirement: &id006 !ruby/object:Gem::Requirement
67
+ prerelease: false
68
+ version_requirements: *70149714070680
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: &70149714068840 !ruby/object:Gem::Requirement
98
72
  none: false
99
- requirements:
73
+ requirements:
100
74
  - - ~>
101
- - !ruby/object:Gem::Version
102
- hash: 23
103
- segments:
104
- - 1
105
- - 0
106
- - 0
75
+ - !ruby/object:Gem::Version
107
76
  version: 1.0.0
108
- version_requirements: *id006
109
- name: bundler
110
- prerelease: false
111
77
  type: :development
112
- - !ruby/object:Gem::Dependency
113
- requirement: &id007 !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ version_requirements: *70149714068840
80
+ - !ruby/object:Gem::Dependency
81
+ name: jeweler
82
+ requirement: &70149714068000 !ruby/object:Gem::Requirement
114
83
  none: false
115
- requirements:
84
+ requirements:
116
85
  - - ~>
117
- - !ruby/object:Gem::Version
118
- hash: 7
119
- segments:
120
- - 1
121
- - 6
122
- - 4
86
+ - !ruby/object:Gem::Version
123
87
  version: 1.6.4
124
- version_requirements: *id007
125
- name: jeweler
126
- prerelease: false
127
88
  type: :development
128
- - !ruby/object:Gem::Dependency
129
- requirement: &id008 !ruby/object:Gem::Requirement
130
- none: false
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- hash: 3
135
- segments:
136
- - 0
137
- version: "0"
138
- version_requirements: *id008
139
- name: rcov
140
89
  prerelease: false
90
+ version_requirements: *70149714068000
91
+ - !ruby/object:Gem::Dependency
92
+ name: rcov
93
+ requirement: &70149714067180 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
141
99
  type: :development
142
- - !ruby/object:Gem::Dependency
143
- requirement: &id009 !ruby/object:Gem::Requirement
100
+ prerelease: false
101
+ version_requirements: *70149714067180
102
+ - !ruby/object:Gem::Dependency
103
+ name: reek
104
+ requirement: &70149714065960 !ruby/object:Gem::Requirement
144
105
  none: false
145
- requirements:
106
+ requirements:
146
107
  - - ~>
147
- - !ruby/object:Gem::Version
148
- hash: 15
149
- segments:
150
- - 1
151
- - 2
152
- - 8
108
+ - !ruby/object:Gem::Version
153
109
  version: 1.2.8
154
- version_requirements: *id009
155
- name: reek
156
- prerelease: false
157
110
  type: :development
158
- description: The aim of Give is to make contributing to open source projects on Github just that bit easier, by wrapping some simple commands around a common workflow.
111
+ prerelease: false
112
+ version_requirements: *70149714065960
113
+ description: The aim of Give is to make contributing to open source projects on Github
114
+ just that bit easier, by wrapping some simple commands around a common workflow.
159
115
  email: seenmyfate@gmail.com
160
- executables:
116
+ executables:
161
117
  - give
162
118
  extensions: []
163
-
164
- extra_rdoc_files:
119
+ extra_rdoc_files:
165
120
  - LICENSE.txt
166
121
  - README.md
167
- files:
122
+ files:
168
123
  - .document
169
124
  - .rspec
170
125
  - .rvmrc
@@ -183,37 +138,31 @@ files:
183
138
  - spec/reek_spec.rb
184
139
  - spec/spec_helper.rb
185
140
  homepage: http://github.com/seenmyfate/give
186
- licenses:
141
+ licenses:
187
142
  - MIT
188
143
  post_install_message:
189
144
  rdoc_options: []
190
-
191
- require_paths:
145
+ require_paths:
192
146
  - lib
193
- required_ruby_version: !ruby/object:Gem::Requirement
147
+ required_ruby_version: !ruby/object:Gem::Requirement
194
148
  none: false
195
- requirements:
196
- - - ">="
197
- - !ruby/object:Gem::Version
198
- hash: 3
199
- segments:
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ segments:
200
154
  - 0
201
- version: "0"
202
- required_rubygems_version: !ruby/object:Gem::Requirement
155
+ hash: -659059737953798153
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
203
157
  none: false
204
- requirements:
205
- - - ">="
206
- - !ruby/object:Gem::Version
207
- hash: 3
208
- segments:
209
- - 0
210
- version: "0"
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
211
162
  requirements: []
212
-
213
163
  rubyforge_project:
214
164
  rubygems_version: 1.8.10
215
165
  signing_key:
216
166
  specification_version: 3
217
167
  summary: Makes contributing to open source projects on Github just that bit easier
218
168
  test_files: []
219
-