fb-git_reflow 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fe7c0db94f0a9c5e8e8cca6ec8a90ed10fbaa348
4
+ data.tar.gz: 9de9c783a9086861aa548419a5ed7ed07a30937f
5
+ SHA512:
6
+ metadata.gz: c1ea09963b5de65890ba39f381db2012cf76412ca2cd20b78e347dc70d557ba8a258d3613d8225af5cd2498509b4783b1050ed7421de1d2b42cdc4fe3a3d4d0c
7
+ data.tar.gz: a4c499d00b1313104b73bf443a40c64bc38ebd012d2b0e36444711828e3039a100041a85d49171727e663c2a0ad61bfb1d7fb46665a1b00246565cdffac4959b
@@ -0,0 +1 @@
1
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,67 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ git_reflow (0.3.5)
5
+ colorize (= 0.6.0)
6
+ github_api (= 0.10.2)
7
+ gli (= 2.8.1)
8
+ highline
9
+ httpclient
10
+ json_pure
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ addressable (2.3.5)
16
+ colorize (0.6.0)
17
+ faraday (0.8.8)
18
+ multipart-post (~> 1.2.0)
19
+ git (1.2.5)
20
+ github_api (0.10.2)
21
+ addressable
22
+ faraday (~> 0.8.7)
23
+ hashie (>= 1.2)
24
+ multi_json (~> 1.4)
25
+ nokogiri (~> 1.6.0)
26
+ oauth2
27
+ gli (2.8.1)
28
+ hashie (2.0.5)
29
+ highline (1.6.20)
30
+ httpauth (0.2.0)
31
+ httpclient (2.3.4.1)
32
+ jeweler (1.8.4)
33
+ bundler (~> 1.0)
34
+ git (>= 1.2.5)
35
+ rake
36
+ rdoc
37
+ json (1.7.5)
38
+ json_pure (1.8.1)
39
+ jwt (0.1.8)
40
+ multi_json (>= 1.5)
41
+ mini_portile (0.5.1)
42
+ multi_json (1.8.4)
43
+ multi_xml (0.5.5)
44
+ multipart-post (1.2.0)
45
+ nokogiri (1.6.0)
46
+ mini_portile (~> 0.5.0)
47
+ oauth2 (0.9.2)
48
+ faraday (~> 0.8)
49
+ httpauth (~> 0.2)
50
+ jwt (~> 0.1.4)
51
+ multi_json (~> 1.0)
52
+ multi_xml (~> 0.5)
53
+ rack (~> 1.2)
54
+ rack (1.5.2)
55
+ rake (0.9.2.2)
56
+ rdoc (3.12)
57
+ json (~> 1.4)
58
+
59
+ PLATFORMS
60
+ ruby
61
+
62
+ DEPENDENCIES
63
+ bundler
64
+ git_reflow!
65
+ jeweler
66
+ rake
67
+ rdoc
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) {{year}} {{fullname}}
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,305 @@
1
+ = git-reflow
2
+
3
+ http://www.reenhanced.com/images/reflow.png
4
+
5
+ If your workflow looks like this:
6
+ 1. Create a feature branch
7
+ 2. Write great code
8
+ 3. Create a pull request against master
9
+ 4. Get 'lgtm' through a code review
10
+ 5. Squash merge to master (Why is squash merging our preferred workflow? https://github.com/reenhanced/gitreflow/issues/52)
11
+ 6. Delete the feature branch
12
+
13
+ Reflow will make your life easier.
14
+
15
+ == Quickstart
16
+ Create and switch to new branch +nh-branchy-branch+:
17
+ $ git reflow start nh-branchy-branch
18
+
19
+ Create a pull request for your branch against +master+:
20
+ $ git reflow review
21
+
22
+ If your code is 'LGTM'd, squash merge to +master+ and delete the feature branch:
23
+ $ git reflow deliver
24
+
25
+ ----
26
+
27
+ == Benefits:
28
+ * Enforce code reviews across your team.
29
+ * Know that your entire team delivers code the same way.
30
+ * Reduce the knowledge needed to deliver great code.
31
+ * Have a commit history that's clean and actually usable.
32
+ * Revert features with ease (if needed).
33
+ * Work with diverse teams with less worry about different processes.
34
+ * Stop searching for other git workflows.
35
+ Reflow covers 90% of your needs without junk you'll never use.
36
+
37
+ == Features:
38
+ * Automatically create pull requests to master
39
+ * Automatically ensure that your code is reviewed before merging
40
+ * Start with sensible commit messages by default
41
+ * Squash merge feature branches because results are more important than details
42
+ * Automatically clean up obsolete feature branches after a successful merge
43
+
44
+ ----
45
+
46
+ == How to use
47
+
48
+ === Installation
49
+ $ gem install reflow
50
+ or
51
+ $ gem install git_reflow
52
+
53
+ === Setup
54
+ On your first install, you'll need to setup your Github credentials. These are used only to get an oauth token that's stored in your global git config.
55
+ We use the Github credentials so we can create pull requests from the command line.
56
+
57
+ After installation, run:
58
+ git reflow setup
59
+
60
+ It looks like this:
61
+ $ git reflow setup
62
+ Please enter your GitHub username: nhance
63
+ Please enter your GitHub password (we do NOT store this):
64
+
65
+ Your GitHub account was successfully setup!
66
+
67
+ This is safe to run multiple times. We don't care.
68
+
69
+ === Usage with Github Enterprise
70
+ To use GitReflow with a GitHub Enterprise account, there are some additional switches available to the GitReflow setup command. You should be able to use GitReflow for both your Enterprise and non-Enterprise repositories. Because of this, there are a few scenarios that may apply to your usage of GitReflow:
71
+
72
+ You use a GitHub Enterprise account for the majority of your repositories:
73
+ git reflow setup --enterprise
74
+ After this, anytime you want to use GitReflow with project that uses a regular GitHub account:
75
+ cd replace_with_your_non_enterprise_project_path
76
+ git reflow setup --local
77
+ This will setup your project's git config with the OAuth token generated from the credentials you provide
78
+
79
+ If you only use GitHub Enterprise for a select few repositories, you'll first want to setup GitReflow as normal:
80
+ git reflow setup
81
+ Then for your Enterprise projects, you have to setup GitReflow for each one:
82
+ cd replace_with_your_enterprise_project_path
83
+ git reflow setup --enterprise --local
84
+
85
+ === Starting a feature branch
86
+ git reflow start
87
+
88
+ This sets up a feature branch remotely and brings a local copy to your machine. Yeah, you can do this by hand pretty easily, so skip this command if you want. This is just a handy shortcut with no magic.
89
+
90
+ $ git reflow start nh-branch-name
91
+
92
+ [PROTIP] Use your initials at the beginning of each branch so your team knows
93
+ who is responsible for each. My initials are 'NH', so all of my branches start with +nh-+
94
+
95
+ === Reviewing your work
96
+ git reflow review
97
+
98
+ All of our work is reviewed by our team. This helps spread knowledge to multiple parties and keeps the quality of our code consistent.
99
+
100
+ The +review+ step creates a pull request for the currently checked out feature branch against master. That's all you want to do most of the time.
101
+ We assume you know what you're doing, so if you need something different, do it by hand.
102
+
103
+ After making commits to your branch, run +review+. Didn't push it up? We don't care, we'll do it for you.
104
+
105
+ $ git reflow review
106
+
107
+ From github.com:reenhanced/gitreflow
108
+ * branch master -> FETCH_HEAD
109
+ Counting objects: 5, done.
110
+ Delta compression using up to 16 threads.
111
+ Compressing objects: 100% (3/3), done.
112
+ Writing objects: 100% (3/3), 1.68 KiB, done.
113
+ Total 3 (delta 1), reused 0 (delta 0)
114
+ To git@github.com:reenhanced/gitreflow.git
115
+ c2ec1b1..1103006 nh-readme-update -> nh-readme-update
116
+
117
+ Successfully created pull request #35: Bootstrapping the readme. This is so I can show how review works
118
+ Pull Request URL: https://github.com/reenhanced/gitreflow/pull/35
119
+ Would you like to open it in your browser? y
120
+
121
+ [OSX/Ubuntu only] You can automatically open your default web browser to the pull request.
122
+ This lets you edit the pull request with all of the detailed information you'll need before submitting it to your team.
123
+
124
+ We output the pull request URL so you can distribute it to your team without leaving the terminal. But don't be a jerk, update the title and description before you send your work around.
125
+
126
+ ==== How it works
127
+ Behind the scenes, this is how +review+ works:
128
+ git fetch origin
129
+
130
+ Are we up-to-date with changes from master?
131
+ If not, fail with "master has newer changes".
132
+
133
+ Then,
134
+ git push origin current-branch # Updates remote branch
135
+
136
+ Do we have pull request?
137
+ If not, create it and print "Pull request created at http://pull-url/". If so, print the url for the existing request.
138
+
139
+ === Checking your branch status
140
+ git reflow status
141
+
142
+ Sometimes you start working on a branch and can't get back to it for a while. It happens. Use +status+ to check on the status of your work.
143
+
144
+ $ git reflow status
145
+
146
+ Here's the status of your review:
147
+ branches: reenhanced:nh-readme-update -> reenhanced:master
148
+ number: 35
149
+ reviewed by:
150
+ url: https://github.com/reenhanced/gitreflow/pull/35
151
+
152
+ [notice] No one has reviewed your pull request...
153
+ Would you like to open it in your browser? n
154
+
155
+ This gives you details on who's reviewed your pull request. If someone has participated, but not given you a 'LGTM', this will tell you.
156
+ +status+ prevents you from having to open a browser to find out where your pull request is at. But in case you want to take a look, we give you the option to open it for you.
157
+
158
+ === Delivering approved code
159
+ git reflow deliver
160
+
161
+ You kick butt. You've got your code reviewed and now you're ready to merge it down to +master+ and deploy. Reflow +deliver+ will take care of all of the steps for you to make this happen.
162
+
163
+ Reflow's +deliver+ requires you to have a pull request, so you'll be protected on those mornings when the coffee isn't working yet.
164
+ We built this <b>to get in your way and make you follow the process</b>. If you don't like it, do it by hand. You already know what you're doing.
165
+
166
+ You'll be presented with a prefilled commit message based on the body of your pull request which includes the text <code>Closes #XX</code> that will automatically close the associated pull request on github when deliver completes.
167
+
168
+ Make a mistake and deliver too early? It happens. You'll be prompted after you edit your commit message if you want to push your updated +master+ to github. If you answer 'n', then you'll want to do <code>git reset --hard origin/master</code> and checkout your branch again.
169
+
170
+ This is what it looks like:
171
+ $ git reflow deliver
172
+ From github.com:reenhanced/gitreflow
173
+ * branch master -> FETCH_HEAD
174
+ Merging pull request #36: 'Enforce at least one LGTM before delivery', from 'reenhanced:nh-fail-without-lgtm' into 'reenhanced:master'
175
+ Switched to branch 'master'
176
+ From github.com:reenhanced/gitreflow
177
+ * branch master -> FETCH_HEAD
178
+ Already up-to-date.
179
+ Switched to branch 'nh-fail-without-lgtm'
180
+ Switched to branch 'master'
181
+ Updating c2ec1b1..f90e111
182
+ Fast-forward
183
+ Squash commit -- not updating HEAD
184
+ lib/git_reflow.rb | 71 +++++++++++++++++++++++++++----------------------------
185
+ 1 file changed, 35 insertions(+), 36 deletions(-)
186
+ [master d1b4dd5] Enforces LGTM before deliver, even with no comments.
187
+ 1 file changed, 35 insertions(+), 36 deletions(-)
188
+ Merge complete!
189
+ Would you like to push this branch to your remote repo and cleanup your feature branch? y
190
+ Counting objects: 7, done.
191
+ Delta compression using up to 16 threads.
192
+ Compressing objects: 100% (4/4), done.
193
+ Writing objects: 100% (4/4), 1.38 KiB, done.
194
+ Total 4 (delta 2), reused 0 (delta 0)
195
+ To git@github.com:reenhanced/gitreflow.git
196
+ c2ec1b1..d1b4dd5 master -> master
197
+
198
+ To git@github.com:reenhanced/gitreflow.git
199
+ - [deleted] nh-fail-without-lgtm
200
+
201
+ Deleted branch nh-fail-without-lgtm (was f90e111).
202
+ Nice job buddy.
203
+
204
+ This is what the default commit message looks like:
205
+ Enforces LGTM before deliver, even with no comments.
206
+ Removes the need to review the pull request yourself if you make a
207
+ comment.
208
+
209
+ Better error message if setup fails.
210
+
211
+ Bug fixes.
212
+
213
+ Closes #36
214
+
215
+ LGTM given by: @codenamev
216
+
217
+ Squashed commit of the following:
218
+
219
+ commit f90e111
220
+ Author: Nicholas Hance <nhance@reenhanced.com>
221
+ Date: Thu Jul 11 15:33:29 2013 -0400
222
+ ...
223
+
224
+ ==== How it works
225
+ This is what we do behind the scenes when you do +deliver+
226
+
227
+ * Does a pull request exist?
228
+
229
+ If not, stop here. You need to run +review+.
230
+
231
+ * Has the review been completed? Did we get a +LGTM+ from everyone who's participated?
232
+
233
+ If not, show a list of authors that need to provide a +LGTM+.
234
+
235
+ If the review is done, it's time to merge. Here's what happens:
236
+
237
+ First, update our local +master+ so we don't get conflicts
238
+ git checkout master
239
+ git pull origin master
240
+
241
+ Next, squash merge our feature branch
242
+ git merge --squash nh-branch-name
243
+
244
+ Now, we'll apply a little magic so we have a great commit message by default. Your editor will open and you'll see a nice default for your commit message based on the pull request body.
245
+
246
+ Once you've saved the commit, prompt the user to see if we should continue
247
+ Merge complete!
248
+ Would you like to push this branch to your remote repo and cleanup your feature branch?
249
+
250
+ If 'y', then we'll push to +master+ and delete the feature branch
251
+ git push origin master
252
+ git push origin :nh-branch-name
253
+ git branch -D nh-branch-name
254
+
255
+ If 'n', then just stop here. The user can reset his local +master+.
256
+
257
+ And we're done.
258
+
259
+
260
+ == Guiding principles:
261
+ * You should already know what you're doing.
262
+ We assume you know how to use git.
263
+
264
+ * The +master+ branch is your codebase.
265
+ You don't need multiple branches for code actually want to use.
266
+
267
+ * +master+ should remain stable at all times.
268
+ The entire team depends on it.
269
+
270
+ * No direct commits to +master+.
271
+ All work happens in feature branches. From a single commit to hundreds.
272
+
273
+ * All feature branches are reviewed via pull requests.
274
+
275
+ * Looks Good To Me. All feature branches require approval.
276
+ We look for the string 'LGTM' in a comment on the pull request to know it's ready to merge.
277
+
278
+ * If you make a new commit in your branch, you require another review.
279
+
280
+ * All participants in a pull request must approve the pull request.
281
+ If 2 guys comment, you need 2 'LGTM's before the code is ready to merge.
282
+
283
+ * Once approved, your feature branch is squash merged to master.
284
+ This makes the history of the master branch extremely clean and easy to follow.
285
+
286
+ * Git blame becomes your friend. You'll know who to blame and can see the full context of changes.
287
+ Squash commits to master mean every commit represents the whole feature, not a "typo fix".
288
+
289
+
290
+ ---
291
+
292
+ == Contributing
293
+ Pull requests are welcome. Please fork and submit. We use this tool every single day and as long as what you want to add doesn't change our workflow, we are happy to accept your updates. Feel free to add your github username to the list below.
294
+
295
+ Authors:
296
+ * @codenamev
297
+ * @armyofgnomes
298
+ * @nhance
299
+
300
+ Built by Reenhanced:
301
+ http://www.reenhanced.com
302
+
303
+ <B>Looking for a capable team for your project? Get in touch. We're looking to grow.</B>
304
+
305
+ <em>Licensed using the MIT license. Do whatever you like with this, but don't blame us if it breaks anything. You're a professional, and you're responsible for the tools you use.</em>
@@ -0,0 +1,2 @@
1
+ require 'rake'
2
+ require 'bundler/gem_tasks'
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ # 1.9 adds realpath to resolve symlinks; 1.8 doesn't
3
+ # have this method, so we add it so we get resolved symlinks
4
+ # and compatibility
5
+ unless File.respond_to? :realpath
6
+ class File #:nodoc:
7
+ def self.realpath path
8
+ return realpath(File.readlink(path)) if symlink?(path)
9
+ path
10
+ end
11
+ end
12
+ end
13
+ $: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
14
+ require 'rubygems'
15
+ require 'gli'
16
+ require 'git_reflow'
17
+
18
+ include GLI::App
19
+
20
+ program_desc 'Git Reflow manages your git workflow.'
21
+
22
+ version GitReflow::VERSION
23
+
24
+ commands_from 'git_reflow/commands'
25
+
26
+ pre do |global,command,options,args|
27
+ # Pre logic here
28
+ # Return true to proceed; false to abourt and not call the
29
+ # chosen command
30
+ # Use skips_pre before a command to skip this block
31
+ # on that command only
32
+ true
33
+ end
34
+
35
+ post do |global,command,options,args|
36
+ # Post logic here
37
+ # Use skips_post before a command to skip this
38
+ # block on that command only
39
+ end
40
+
41
+ on_error do |exception|
42
+ # Error logic here
43
+ # return false to skip default error handling
44
+ true
45
+ end
46
+
47
+ exit run(ARGV)