gitcycle 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +1 -1
  2. data/gitcycle.gemspec +1 -1
  3. data/lib/gitcycle.rb +29 -11
  4. metadata +3 -3
data/README.md CHANGED
@@ -126,7 +126,7 @@ Checkout the branch that you will eventually merge your feature into:
126
126
 
127
127
  gitc checkout master
128
128
 
129
- Type `gitc reset` + your ticket URL to reset the branch:
129
+ Type `gitc redo` + your ticket URL to reset the branch:
130
130
 
131
131
  gitc redo https://xxx.lighthouseapp.com/projects/0000/tickets/0000-my-ticket
132
132
 
data/gitcycle.gemspec CHANGED
@@ -6,7 +6,7 @@ $:.unshift lib unless $:.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "gitcycle"
9
- s.version = '0.2.6'
9
+ s.version = '0.2.7'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = [ 'Winton Welsh' ]
12
12
  s.email = [ 'mail@wintoni.us' ]
data/lib/gitcycle.rb CHANGED
@@ -75,19 +75,33 @@ class Gitcycle
75
75
  end
76
76
  alias :co :checkout
77
77
 
78
- def commit_all
79
- branch_info = get('branch',
80
- 'branch[name]' => branches(:current => true),
81
- 'create' => 0
82
- )
78
+ def commit(*args)
79
+ msg = nil
83
80
 
84
- if branch_info && (title = branch_info["title"]) && id = branch_info["body"].match(/#\d+/)
85
- commit_msg = "[#{id}] #{title}"
81
+ if args.empty?
82
+ puts "\nRetrieving branch information from gitcycle.\n".green
83
+ branch = get('branch',
84
+ 'branch[name]' => branches(:current => true),
85
+ 'create' => 0
86
+ )
87
+
88
+ id = branch["lighthouse_url"].match(/tickets\/(\d+)/)[1] rescue nil
89
+ title = branch["title"]
90
+
91
+ if branch && id
92
+ msg = "[#{id}]"
93
+ msg += " #{title}" if title
94
+ end
86
95
  end
87
96
 
88
- run "git add . && git commit -am" + (commit_msg ? " \"#{commit_msg}\"" : "")
97
+ if msg
98
+ run("git add . -u && git commit -am #{msg.dump}")
99
+ Kernel.exec("git commit --amend")
100
+ else
101
+ exec_git(:commit, args)
102
+ end
89
103
  end
90
- alias :ca :commit_all
104
+ alias :ci :commit
91
105
 
92
106
  def create_branch(url_or_title, reset=false)
93
107
  require_git && require_config
@@ -412,8 +426,7 @@ class Gitcycle
412
426
 
413
427
  `git --help`.scan(/\s{3}(\w+)\s{3}/).flatten.each do |cmd|
414
428
  if command == cmd && !self.respond_to?(command)
415
- args.unshift("git", command)
416
- Kernel.exec(*args)
429
+ exec_git(cmd, args)
417
430
  end
418
431
  end
419
432
 
@@ -596,6 +609,11 @@ class Gitcycle
596
609
  end
597
610
  end
598
611
 
612
+ def exec_git(command, args)
613
+ args.unshift("git", command)
614
+ Kernel.exec(*args)
615
+ end
616
+
599
617
  def fix_conflict(options)
600
618
  owner = options[:owner]
601
619
  repo = options[:repo]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitcycle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 6
10
- version: 0.2.6
9
+ - 7
10
+ version: 0.2.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Winton Welsh