add feature to commit message

This commit is contained in:
rkiel
2015-06-06 08:13:39 -04:00
parent be68a8b6c8
commit 2cda5ed133
2 changed files with 16 additions and 3 deletions

View File

@@ -1,6 +1,13 @@
require_relative '../shared/branchability'
require_relative '../shared/runnable'
module Commit module Commit
class Commander class Commander
include Shared::Branchability
include Shared::Runnable
attr_reader :argv attr_reader :argv
def initialize (argv) def initialize (argv)
@@ -19,10 +26,12 @@ module Commit
end end
def execute def execute
comment = argv.reject { |x| x == '-m' }.join(' ') parts = parse_branch(current_branch)
command = "git commit -m \"#{comment}\"" comment = argv.reject { |x| x == '-m' }.join(' ')
exec command comment = "#{parts[:feature]}: #{comment}"
git_commit comment
end end
end end

View File

@@ -58,6 +58,10 @@ module Shared
def git_local_branch_create (branch) def git_local_branch_create (branch)
run_cmd "git checkout -b #{branch}" run_cmd "git checkout -b #{branch}"
end end
def git_commit (message)
run_cmd "git commit -m \"#{message}\""
end
end end
end end