git_reflow 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_reflow (0.2.2)
4
+ git_reflow (0.2.4)
5
5
  colorize (= 0.5.8)
6
6
  github_api (= 0.7.0)
7
7
  gli (= 2.1.0)
data/bin/git-reflow CHANGED
@@ -14,7 +14,6 @@ $: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
14
14
  require 'rubygems'
15
15
  require 'gli'
16
16
  require 'git_reflow'
17
- require 'git_reflow/version'
18
17
 
19
18
  include GLI::App
20
19
 
@@ -22,84 +21,7 @@ program_desc 'Git Reflow manages your git workflow.'
22
21
 
23
22
  version GitReflow::VERSION
24
23
 
25
- desc 'Describe some switch here'
26
- switch [:s,:switch]
27
-
28
- desc 'Describe some flag here'
29
- default_value 'the default'
30
- arg_name 'The name of the argument'
31
- flag [:f,:flagname]
32
-
33
- desc 'Setup your GitHub account'
34
- command :setup do |c|
35
- c.action do |global_options,options,args|
36
- GitReflow.setup
37
- end
38
- end
39
-
40
- desc 'Start will create a new feature branch and setup remote tracking'
41
- arg_name 'Describe arguments to start here'
42
- command :start do |c|
43
- c.desc 'Describe a switch to start'
44
- c.switch :s
45
-
46
- c.desc 'Describe a flag to start'
47
- c.default_value 'default'
48
- c.flag :f
49
- c.action do |global_options,options,args|
50
-
51
- # Your command logic here
52
- if args.empty?
53
- raise "usage: git-reflow start [new-branch-name]"
54
- else
55
- `git push origin master:refs/heads/#{args[0]}`
56
- `git fetch origin`
57
- `git checkout --track -b #{args[0]} origin/#{args[0]}`
58
- end
59
- # If you have any errors, just raise them
60
- # raise "that command made no sense"
61
- end
62
- end
63
-
64
- desc 'Describe review here'
65
- arg_name 'Describe arguments to review here'
66
- command :review do |c|
67
- c.action do |global_options,options,args|
68
- review_options = {'base' => nil, 'title' => nil, 'body' => nil}
69
- case args.length
70
- when 3
71
- review_options['base'] = args[0]
72
- review_options['title'] = args[1]
73
- review_options['body'] = args[2]
74
- when 2
75
- review_options['base'] = args[0]
76
- review_options['title'] = args[1]
77
- review_options['body'] = review_options['title']
78
- when 1
79
- review_options['base'] = args[0]
80
- review_options['title'] = review_options['body'] = GitReflow.get_first_commit_message
81
- else
82
- review_options['title'] = review_options['body'] = GitReflow.get_first_commit_message
83
- end
84
- GitReflow.review review_options
85
- end
86
- end
87
-
88
- desc 'deliver will merge your feature branch down to your base branch'
89
- arg_name 'base_branch - the branch you want to merge into'
90
- command :deliver do |c|
91
- c.action do |global_options,options,args|
92
- deliver_options = {'base' => nil, 'head' => nil}
93
- case args.length
94
- when 2
95
- deliver_options['base'] = args[0]
96
- deliver_options['head'] = args[1]
97
- when 1
98
- deliver_options['base'] = args[0]
99
- end
100
- GitReflow.deliver deliver_options
101
- end
102
- end
24
+ commands_from 'git_reflow/commands'
103
25
 
104
26
  pre do |global,command,options,args|
105
27
  # Pre logic here
@@ -0,0 +1,18 @@
1
+ desc 'deliver your feature branch'
2
+ long_desc 'merge your feature branch down to your base branch, and cleanup your feature branch'
3
+
4
+ command :deliver do |c|
5
+ c.desc 'merge your feature branch down to your base branch, and cleanup your feature branch'
6
+ c.arg_name 'base_branch - the branch you want to merge into'
7
+ c.action do |global_options,options,args|
8
+ deliver_options = {'base' => nil, 'head' => nil}
9
+ case args.length
10
+ when 2
11
+ deliver_options['base'] = args[0]
12
+ deliver_options['head'] = args[1]
13
+ when 1
14
+ deliver_options['base'] = args[0]
15
+ end
16
+ GitReflow.deliver deliver_options
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+ desc 'review will push your latest feature branch changes to your remote repo and create a pull request'
2
+ arg_name 'Describe arguments to review here'
3
+ command :review do |c|
4
+ c.desc 'push your latest feature branch changes to your remote repo and create a pull request against the destination branch'
5
+ c.arg_name '[destination_branch] - the branch you want to merge your feature branch into'
6
+ c.action do |global_options,options,args|
7
+ review_options = {'base' => nil, 'title' => nil, 'body' => nil}
8
+ case args.length
9
+ when 3
10
+ review_options['base'] = args[0]
11
+ review_options['title'] = args[1]
12
+ review_options['body'] = args[2]
13
+ when 2
14
+ review_options['base'] = args[0]
15
+ review_options['title'] = args[1]
16
+ review_options['body'] = review_options['title']
17
+ when 1
18
+ review_options['base'] = args[0]
19
+ review_options['title'] = review_options['body'] = GitReflow.get_first_commit_message
20
+ else
21
+ review_options['title'] = review_options['body'] = GitReflow.get_first_commit_message
22
+ end
23
+ GitReflow.review review_options
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ desc 'Setup your GitHub account'
2
+ command :setup do |c|
3
+ c.desc 'sets up your api token with GitHub'
4
+ c.action do |global_options, options, args|
5
+ GitReflow.setup
6
+ end
7
+ end
@@ -0,0 +1,25 @@
1
+ desc 'Start will create a new feature branch and setup remote tracking'
2
+ long_desc <<LONGTIME
3
+ Performs the following:\n
4
+ \t$ git pull origin <current_branch>\n
5
+ \t$ git push origin master:refs/heads/[new_feature_branch]\n
6
+ \t$ git checkout --track -b [new_feature_branch] origin/[new_feature_branch]\n
7
+ LONGTIME
8
+ arg_name '[new-feature-branch-name] - name of the new feature branch'
9
+ command :start do |c|
10
+ c.desc 'Describe a switch to list'
11
+ c.switch :s
12
+
13
+ c.desc 'Describe a flag to list'
14
+ c.default_value 'default'
15
+ c.flag :f
16
+ c.action do |global_options, options, args|
17
+ if args.empty?
18
+ raise "usage: git-reflow start [new-branch-name]"
19
+ else
20
+ `git pull origin #{GitReflow.current_branch}`
21
+ `git push origin master:refs/heads/#{args[0]}`
22
+ `git checkout --track -b #{args[0]} origin/#{args[0]}`
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ desc 'Display information about the status of your feature in the review process'
2
+ arg_name "destination_branch - the branch you're merging your feature into ('master' is default)"
3
+ command :status do |c|
4
+ c.action do |global_options, options, args|
5
+ destination_branch = args[0] || 'master'
6
+ GitReflow.status destination_branch
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module GitReflow
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
data/lib/git_reflow.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- require 'rake'
2
+ require 'git_reflow/version.rb'
3
3
  require 'open-uri'
4
4
  require "highline/import"
5
5
  require 'httpclient'
@@ -22,6 +22,19 @@ module GitReflow
22
22
  set_oauth_token(oauth_token)
23
23
  end
24
24
 
25
+ def status(destination_branch)
26
+ pull_request = find_pull_request( :from => current_branch, :to => destination_branch )
27
+
28
+ if pull_request.nil?
29
+ puts "\n[notice] No pull request exists for #{current_branch} -> #{destination_branch}"
30
+ puts "[notice] Run 'git reflow review #{destination_branch}' to start the review process"
31
+ else
32
+ puts "Here's the status of your review:"
33
+ display_pull_request_summary(pull_request)
34
+ ask_to_open_in_browser(pull_request)
35
+ end
36
+ end
37
+
25
38
  def review(options = {})
26
39
  options['base'] ||= 'master'
27
40
  fetch_destination options['base']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_reflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-09-17 00:00:00.000000000 Z
14
+ date: 2012-09-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -218,6 +218,11 @@ files:
218
218
  - git_reflow.gemspec
219
219
  - lib/git_reflow.rb
220
220
  - lib/git_reflow/base.rb
221
+ - lib/git_reflow/commands/deliver.rb
222
+ - lib/git_reflow/commands/review.rb
223
+ - lib/git_reflow/commands/setup.rb
224
+ - lib/git_reflow/commands/start.rb
225
+ - lib/git_reflow/commands/status.rb
221
226
  - lib/git_reflow/version.rb
222
227
  - spec/fixtures/git/git_config
223
228
  - spec/fixtures/pull_requests/pull_request.json
@@ -250,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
255
  version: '0'
251
256
  segments:
252
257
  - 0
253
- hash: -900915323995072277
258
+ hash: -1280650752481315877
254
259
  required_rubygems_version: !ruby/object:Gem::Requirement
255
260
  none: false
256
261
  requirements:
@@ -259,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
264
  version: '0'
260
265
  segments:
261
266
  - 0
262
- hash: -900915323995072277
267
+ hash: -1280650752481315877
263
268
  requirements: []
264
269
  rubyforge_project:
265
270
  rubygems_version: 1.8.24